Update app.py
Browse files
app.py
CHANGED
|
@@ -284,11 +284,11 @@ async def chat_endpoint(request: Request, _: None = Depends(verify_origin)):
|
|
| 284 |
raise HTTPException(status_code=400, detail="No message provided")
|
| 285 |
|
| 286 |
# Auto-decide search usage if not specified
|
| 287 |
-
if use_search is None:
|
| 288 |
use_search = should_use_search(user_message)
|
| 289 |
logger.info(f"Auto-decided search usage: {use_search}")
|
| 290 |
else:
|
| 291 |
-
logger.info(f"Manual search setting: {use_search}")
|
| 292 |
|
| 293 |
# Prepare messages with appropriate system prompt based on search availability
|
| 294 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
|
@@ -311,7 +311,7 @@ async def chat_endpoint(request: Request, _: None = Depends(verify_origin)):
|
|
| 311 |
if use_search:
|
| 312 |
logger.info("Search is ENABLED - tools will be available to the model")
|
| 313 |
llm_kwargs["tools"] = available_tools
|
| 314 |
-
llm_kwargs["tool_choice"] = "
|
| 315 |
else:
|
| 316 |
logger.info("Search is DISABLED - no tools available")
|
| 317 |
|
|
|
|
| 284 |
raise HTTPException(status_code=400, detail="No message provided")
|
| 285 |
|
| 286 |
# Auto-decide search usage if not specified
|
| 287 |
+
'''if use_search is None:
|
| 288 |
use_search = should_use_search(user_message)
|
| 289 |
logger.info(f"Auto-decided search usage: {use_search}")
|
| 290 |
else:
|
| 291 |
+
logger.info(f"Manual search setting: {use_search}")'''
|
| 292 |
|
| 293 |
# Prepare messages with appropriate system prompt based on search availability
|
| 294 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
|
|
|
| 311 |
if use_search:
|
| 312 |
logger.info("Search is ENABLED - tools will be available to the model")
|
| 313 |
llm_kwargs["tools"] = available_tools
|
| 314 |
+
llm_kwargs["tool_choice"] = "required" # Consider using "required" for testing
|
| 315 |
else:
|
| 316 |
logger.info("Search is DISABLED - no tools available")
|
| 317 |
|