Spaces:
Runtime error
Runtime error
Duygu Jones
commited on
Update app.py
Browse filesexcluded tavily tool
app.py
CHANGED
|
@@ -68,27 +68,27 @@ def wiki_search(query: str, sentences: int = 3) -> str:
|
|
| 68 |
return f"Error searching Wikipedia: {str(e)}"
|
| 69 |
|
| 70 |
|
| 71 |
-
@tool
|
| 72 |
-
def tavily_search(query: str) -> str:
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
|
| 93 |
|
| 94 |
@tool
|
|
@@ -132,7 +132,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 132 |
# Initialize agent with tools
|
| 133 |
agent = CodeAgent(
|
| 134 |
model=model,
|
| 135 |
-
tools=[final_answer,
|
| 136 |
max_steps=6,
|
| 137 |
verbosity_level=1,
|
| 138 |
grammar=None,
|
|
|
|
| 68 |
return f"Error searching Wikipedia: {str(e)}"
|
| 69 |
|
| 70 |
|
| 71 |
+
# @tool
|
| 72 |
+
# def tavily_search(query: str) -> str:
|
| 73 |
+
# """A tool that performs web search using Tavily API and formats the results.
|
| 74 |
+
# Args:
|
| 75 |
+
# query: The search query to look up
|
| 76 |
+
# Returns:
|
| 77 |
+
# str: A formatted summary of search results
|
| 78 |
+
# """
|
| 79 |
+
# try:
|
| 80 |
+
# client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])
|
| 81 |
+
# search_result = client.search(query=query, search_depth="advanced")
|
| 82 |
|
| 83 |
+
# # Format the results in a user-friendly way
|
| 84 |
+
# summary = f"Here are the search results for: {query}\n\n"
|
| 85 |
+
# for result in search_result['results'][:5]: # Top 5 results
|
| 86 |
+
# summary += f"• {result['title']}\n"
|
| 87 |
+
# summary += f" Summary: {result['description'][:200]}...\n\n"
|
| 88 |
|
| 89 |
+
# return summary
|
| 90 |
+
# except Exception as e:
|
| 91 |
+
# return f"Error performing search: {str(e)}"
|
| 92 |
|
| 93 |
|
| 94 |
@tool
|
|
|
|
| 132 |
# Initialize agent with tools
|
| 133 |
agent = CodeAgent(
|
| 134 |
model=model,
|
| 135 |
+
tools=[final_answer, wiki_search, get_current_time_in_timezone, image_generation_tool], # tavily_search,
|
| 136 |
max_steps=6,
|
| 137 |
verbosity_level=1,
|
| 138 |
grammar=None,
|