Lhumpal commited on
Commit
b045ce8
·
verified ·
1 Parent(s): 5efbc3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -42,7 +42,7 @@ def retrieve(query, vectorstore, top_k=5):
42
  class ChatRequest(BaseModel):
43
  message: str
44
  system_message: str = """You are Dan Infalt, a friendly public land deer hunting expert specializing in targeting mature bucks in pressured areas, but
45
- don’t worry, you won’t take yourself too seriously. You respond in a conversational matter. And you have dry humor you mix in every once in a while.
46
  You focus on buck bedding, terrain reading, and aggressive yet calculated mobile tactics. Your blue-collar, no-nonsense approach
47
  emphasizes deep scouting, strategic access, and minimalist setups. Through The Hunting Beast, you teach hunters how to kill big bucks
48
  using terrain, wind, and thermals. You speak from firsthand experience, keeping your advice practical and to the point. Provide detailed
@@ -103,20 +103,20 @@ async def chat(request: ChatRequest):
103
  results = retrieve(request.message, vectorstore, top_k=5)
104
  formatted_results = "\n\n".join(results)
105
 
106
- rag_prompt = textwrap.dedent(f"""You have access to the following relevant information retrieved based on the user's query:
107
 
108
  {formatted_results}
109
 
110
  Using the information above, answer the user's query as accurately as possible:
111
 
112
  User's Query: {request.message}
113
- """)
114
 
115
  # remove the unfformatted user message
116
  del request.chat_history[-1]
117
 
118
  # add the user message with RAG data
119
- request.chat_history.append({"role": "user", "parts": [{"text": rag_prompt}]})
120
 
121
  response = client.models.generate_content(
122
  model="gemini-2.0-flash",
 
42
  class ChatRequest(BaseModel):
43
  message: str
44
  system_message: str = """You are Dan Infalt, a friendly public land deer hunting expert specializing in targeting mature bucks in pressured areas, but
45
+ don’t worry, you won’t take yourself too seriously. You respond in a conversational matter but still direct. You have dry humor you mix in every once in a while.
46
  You focus on buck bedding, terrain reading, and aggressive yet calculated mobile tactics. Your blue-collar, no-nonsense approach
47
  emphasizes deep scouting, strategic access, and minimalist setups. Through The Hunting Beast, you teach hunters how to kill big bucks
48
  using terrain, wind, and thermals. You speak from firsthand experience, keeping your advice practical and to the point. Provide detailed
 
103
  results = retrieve(request.message, vectorstore, top_k=5)
104
  formatted_results = "\n\n".join(results)
105
 
106
+ rag_prompt = f"""You have access to the following relevant information retrieved based on the user's query:
107
 
108
  {formatted_results}
109
 
110
  Using the information above, answer the user's query as accurately as possible:
111
 
112
  User's Query: {request.message}
113
+ """
114
 
115
  # remove the unfformatted user message
116
  del request.chat_history[-1]
117
 
118
  # add the user message with RAG data
119
+ request.chat_history.append({"role": "user", "parts": [{"text": textwrap.dedent(rag_prompt)}]})
120
 
121
  response = client.models.generate_content(
122
  model="gemini-2.0-flash",