srkdev384 commited on
Commit
e0ae2d4
·
verified ·
1 Parent(s): 19f23c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -34
app.py CHANGED
@@ -9,7 +9,6 @@ from smolagents.agent_types import AgentImage
9
  import uuid
10
  import requests
11
  import os
12
- from smolagents import ToolCallingAgent
13
 
14
  CRICKET_API_KEY = os.getenv("CRICKET_API_KEY")
15
 
@@ -145,37 +144,6 @@ def get_today_matches() -> str:
145
 
146
  return result
147
 
148
- @tool
149
- def wiki_search(query: str) -> dict:
150
- """
151
- Fetches a short summary from Wikipedia for a given topic.
152
-
153
- Args:
154
- query: The topic or keyword to search on Wikipedia.
155
-
156
- Returns:
157
- A dictionary containing the page title, summary, and URL.
158
- """
159
-
160
- encoded_query = urllib.parse.quote(query)
161
- url = f"https://en.wikipedia.org/api/rest_v1/page/summary/{encoded_query}"
162
-
163
- try:
164
- response = requests.get(url, timeout=10)
165
-
166
- if response.status_code != 200:
167
- return {"error": "No Wikipedia page found."}
168
-
169
- data = response.json()
170
-
171
- return {
172
- "title": data.get("title"),
173
- "summary": data.get("extract"),
174
- "url": data.get("content_urls", {}).get("desktop", {}).get("page"),
175
- }
176
-
177
- except Exception as e:
178
- return {"error": str(e)}
179
 
180
  final_answer = FinalAnswerTool()
181
 
@@ -194,9 +162,9 @@ with open("prompts.yaml", 'r') as stream:
194
  prompt_templates = yaml.safe_load(stream)
195
 
196
 
197
- agent = ToolCallingAgent(
198
  model=model,
199
- tools=[final_answer, generate_image, get_current_time_in_timezone, get_live_cricket_score, get_today_matches, wiki_search], ## add your tools here (don't remove final answer)
200
  max_steps=6,
201
  verbosity_level=1,
202
  grammar=None,
 
9
  import uuid
10
  import requests
11
  import os
 
12
 
13
  CRICKET_API_KEY = os.getenv("CRICKET_API_KEY")
14
 
 
144
 
145
  return result
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
  final_answer = FinalAnswerTool()
149
 
 
162
  prompt_templates = yaml.safe_load(stream)
163
 
164
 
165
+ agent = CodeAgent(
166
  model=model,
167
+ tools=[final_answer, generate_image, get_current_time_in_timezone, get_live_cricket_score, get_today_matches], ## add your tools here (don't remove final answer)
168
  max_steps=6,
169
  verbosity_level=1,
170
  grammar=None,