File size: 517 Bytes
7dfdca0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""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()