Spaces:
Sleeping
Sleeping
Download test_tools.py from batgre/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/spaces/batgre/Final_Assignment_Template/resolve/main/test_tools.py
- Command line
-
hf download hf://spaces/batgre/Final_Assignment_Template/test_tools.py
-
curl -L -o test_tools.py https://huggingface.co/spaces/batgre/Final_Assignment_Template/resolve/main/test_tools.py
517 Bytes
| """Quick local test for tools. Run with: .venv/bin/python test_tools.py""" | |
| import os | |
| import sys | |
| from tools import search_tool | |
| def main(): | |
| if not os.getenv("TAVILY_API_KEY"): | |
| print("ERROR: set TAVILY_API_KEY first: export TAVILY_API_KEY=tvly-...") | |
| sys.exit(1) | |
| query = sys.argv[1] if len(sys.argv) > 1 else "Who won the 2024 Nobel Prize in Physics?" | |
| print(f"Query: {query}\n") | |
| result = search_tool.invoke({"query": query}) | |
| print(result) | |
| if __name__ == "__main__": | |
| main() | |