Spaces:
Sleeping
Sleeping
Create tools.py
Browse files- src/tools.py +26 -0
src/tools.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_core.tools import tool
|
| 2 |
+
from tools.intelligent_retrieval_tool import get_machine_context_async
|
| 3 |
+
|
| 4 |
+
@tool
|
| 5 |
+
async def wurthlac_machine_expert(query: str) -> str:
|
| 6 |
+
"""
|
| 7 |
+
Use this tool for ANY question about products, machinery, or specific models,
|
| 8 |
+
such as 'JDT75' or 'Cantek DT65'. It is the primary source of truth for all
|
| 9 |
+
product-related inquiries, including features, price, specifications,
|
| 10 |
+
comparisons, or recommendations. Do NOT use this tool for simple greetings
|
| 11 |
+
or general questions about the company (e.g., 'who are you?', 'what are your shipping policies?').
|
| 12 |
+
"""
|
| 13 |
+
print(f"--- Agent decided to call the Wurthlac Machine Expert tool ---")
|
| 14 |
+
...
|
| 15 |
+
print(f"--- Passing query: '{query}' to the expert tool... ---")
|
| 16 |
+
|
| 17 |
+
context = await get_machine_context_async(query=query)
|
| 18 |
+
|
| 19 |
+
print("\n" + "="*50)
|
| 20 |
+
print("--- [TOOL DEBUG] RAW CONTEXT RETURNED FROM RETRIEVER ---")
|
| 21 |
+
print(f"RAW DATA: {context}")
|
| 22 |
+
print("--- [TOOL DEBUG] END OF RAW CONTEXT ---")
|
| 23 |
+
print("="*50 + "\n")
|
| 24 |
+
return context
|
| 25 |
+
|
| 26 |
+
all_tools = [wurthlac_machine_expert]
|