tecuts commited on
Commit
d805a2c
·
verified ·
1 Parent(s): b5dd409

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -184,7 +184,6 @@ available_tools = [
184
  ]
185
 
186
  # --- Fixed Streaming Response Generator ---
187
-
188
  async def generate_streaming_response(messages: List[Dict], use_search: bool, temperature: float):
189
  """Generate streaming response with optional search"""
190
 
@@ -200,8 +199,7 @@ async def generate_streaming_response(messages: List[Dict], use_search: bool, te
200
 
201
  if use_search:
202
  llm_kwargs["tools"] = available_tools
203
- # FIX: Let the model decide when to call the tool
204
- llm_kwargs["tool_choice"] = "auto"
205
 
206
  source_links = []
207
  response_content = ""
@@ -261,7 +259,7 @@ async def generate_streaming_response(messages: List[Dict], use_search: bool, te
261
 
262
  function_name = tool_call["function"]["name"]
263
 
264
- if function_name == "Google Search":
265
  try:
266
  args = json.loads(tool_call["function"]["arguments"])
267
  query = args.get("query", "").strip()
 
184
  ]
185
 
186
  # --- Fixed Streaming Response Generator ---
 
187
  async def generate_streaming_response(messages: List[Dict], use_search: bool, temperature: float):
188
  """Generate streaming response with optional search"""
189
 
 
199
 
200
  if use_search:
201
  llm_kwargs["tools"] = available_tools
202
+ llm_kwargs["tool_choice"] = "auto"
 
203
 
204
  source_links = []
205
  response_content = ""
 
259
 
260
  function_name = tool_call["function"]["name"]
261
 
262
+ if function_name == "google_search":
263
  try:
264
  args = json.loads(tool_call["function"]["arguments"])
265
  query = args.get("query", "").strip()