Lhumpal commited on
Commit
0f0d7e3
·
verified ·
1 Parent(s): 7e649a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -51,14 +51,8 @@ def retrieve(query, vectorstore, top_k=8):
51
  return docs_content, filtered_docs_and_scores
52
 
53
  class ChatRequest(BaseModel):
54
- message: str
55
- system_message: str = """You are Dan Infalt, a friendly public land deer hunting expert specializing in targeting mature bucks in pressured areas, but
56
- 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.
57
- You focus on buck bedding, terrain reading, and aggressive yet calculated mobile tactics. Your blue-collar, no-nonsense approach
58
- emphasizes deep scouting, strategic access, and minimalist setups. Through The Hunting Beast, you teach hunters how to kill big bucks
59
- using terrain, wind, and thermals. You speak from firsthand experience, keeping your advice practical and to the point. Provide detailed
60
- yet concise responses that fully articulate your experience and answer the user query.
61
- """
62
  temperature: float = 1.5
63
  max_output_tokens: int = 200
64
  chat_history: List[Dict[str, Any]] = []
@@ -79,6 +73,12 @@ async def chat(request: ChatRequest):
79
  try:
80
  if request.model_choice == "google":
81
  client = genai.Client(api_key=google_api_key)
 
 
 
 
 
 
82
 
83
  # ------------ summarize chat history ------------
84
  summary_thresh = 10
@@ -170,7 +170,7 @@ async def chat(request: ChatRequest):
170
  model="gemini-2.0-flash",
171
  contents=request.chat_history,
172
  config=GenerateContentConfig(
173
- system_instruction=[request.system_message],
174
  max_output_tokens=request.max_output_tokens,
175
  temperature=request.temperature
176
  ),
 
51
  return docs_content, filtered_docs_and_scores
52
 
53
  class ChatRequest(BaseModel):
54
+ message: str = ""
55
+ system_message: str = ""
 
 
 
 
 
 
56
  temperature: float = 1.5
57
  max_output_tokens: int = 200
58
  chat_history: List[Dict[str, Any]] = []
 
73
  try:
74
  if request.model_choice == "google":
75
  client = genai.Client(api_key=google_api_key)
76
+ system_message = f"""You are Dan Infalt, a friendly public land deer hunting expert specializing in targeting mature bucks in pressured areas, but
77
+ 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.
78
+ You focus on buck bedding, terrain reading, and aggressive yet calculated mobile tactics. Your blue-collar, no-nonsense approach
79
+ emphasizes deep scouting, strategic access, and minimalist setups. Through The Hunting Beast, you teach hunters how to kill big bucks
80
+ using terrain, wind, and thermals. You speak from firsthand experience, keeping your advice practical and to the point. Provide detailed
81
+ yet concise responses that fully articulate your experience and answer the user query. Please keep your reponses between 0 and {request.max_output_tokens} words."""
82
 
83
  # ------------ summarize chat history ------------
84
  summary_thresh = 10
 
170
  model="gemini-2.0-flash",
171
  contents=request.chat_history,
172
  config=GenerateContentConfig(
173
+ system_instruction=[system_message],
174
  max_output_tokens=request.max_output_tokens,
175
  temperature=request.temperature
176
  ),