Scott Cogan
commited on
Commit
·
def383b
1
Parent(s):
ea9d55b
requirements update for llm compat
Browse files
app.py
CHANGED
|
@@ -402,6 +402,17 @@ class BasicAgent:
|
|
| 402 |
# If no tool call, check if it's a final answer
|
| 403 |
content = response.content.strip()
|
| 404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
# Clean up the content to ensure it's in the correct format
|
| 406 |
if content.startswith("**Final Answer**: "):
|
| 407 |
content = content.replace("**Final Answer**: ", "").strip()
|
|
|
|
| 402 |
# If no tool call, check if it's a final answer
|
| 403 |
content = response.content.strip()
|
| 404 |
|
| 405 |
+
# If the model is just acknowledging or explaining, prompt it to use the tool
|
| 406 |
+
if any(phrase in content.lower() for phrase in ["let me", "i'll", "i will", "sure", "okay", "alright"]):
|
| 407 |
+
logger.info("Model provided acknowledgment instead of tool call, prompting for search")
|
| 408 |
+
return {
|
| 409 |
+
"messages": messages + [
|
| 410 |
+
AIMessage(content="Please use the google_search tool to find the information."),
|
| 411 |
+
HumanMessage(content="Please search for the information using the google_search tool.")
|
| 412 |
+
],
|
| 413 |
+
"next": "agent"
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
# Clean up the content to ensure it's in the correct format
|
| 417 |
if content.startswith("**Final Answer**: "):
|
| 418 |
content = content.replace("**Final Answer**: ", "").strip()
|