hgdgng commited on
Commit
fdc9e55
1 Parent(s): b9bfc9e

Create src/search.py

Browse files
Files changed (1) hide show
  1. src/search.py +9 -0
src/search.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from tavily import TavilyClient
2
+
3
+ def perform_search(query):
4
+ try:
5
+ client = TavilyClient(api_key=os.environ.get("TAVILY_API_KEY"))
6
+ result = client.search(query, include_answer=True)
7
+ return result["answer"]
8
+ except Exception as e:
9
+ return f"Error: {str(e)}"