Spaces:
Running on Zero
Running on Zero
grevy commited on
Commit ·
7dfdca0
1
Parent(s): 123d40d
Add research agent.
Browse files- test_tools.py +22 -0
test_tools.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Quick local test for tools. Run with: .venv/bin/python test_tools.py"""
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
from tools import search_tool
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def main():
|
| 10 |
+
if not os.getenv("TAVILY_API_KEY"):
|
| 11 |
+
print("ERROR: set TAVILY_API_KEY first: export TAVILY_API_KEY=tvly-...")
|
| 12 |
+
sys.exit(1)
|
| 13 |
+
|
| 14 |
+
query = sys.argv[1] if len(sys.argv) > 1 else "Who won the 2024 Nobel Prize in Physics?"
|
| 15 |
+
print(f"Query: {query}\n")
|
| 16 |
+
|
| 17 |
+
result = search_tool.invoke({"query": query})
|
| 18 |
+
print(result)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
main()
|