dlaima commited on
Commit
6db476e
·
verified ·
1 Parent(s): c2f416b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -5,7 +5,6 @@ import requests
5
  import pandas as pd
6
 
7
  from smolagents import Tool, CodeAgent, HfApiModel
8
- #from smolagents.models import HfApiModel
9
 
10
  from audio_transcriber import AudioTranscriptionTool
11
  from image_analyzer import ImageAnalysisTool
@@ -34,13 +33,19 @@ Only return the exact answer."""
34
  # Define agent tools
35
  audio_tool = AudioTranscriptionTool()
36
  image_tool = ImageAnalysisTool()
37
- wiki_tool = Tool.from_function(
38
- name="wikipedia_search",
39
- description="Search for facts using Wikipedia.",
40
- input_schema={"query": {"type": "string", "description": "Search query"}},
41
- output_type="string",
42
- forward=lambda query: WikipediaSearcher().search(query)
43
- )
 
 
 
 
 
 
44
 
45
  tools = [audio_tool, image_tool, wiki_tool]
46
 
 
5
  import pandas as pd
6
 
7
  from smolagents import Tool, CodeAgent, HfApiModel
 
8
 
9
  from audio_transcriber import AudioTranscriptionTool
10
  from image_analyzer import ImageAnalysisTool
 
33
  # Define agent tools
34
  audio_tool = AudioTranscriptionTool()
35
  image_tool = ImageAnalysisTool()
36
+
37
+ class WikipediaTool(Tool):
38
+ name = "wikipedia_search"
39
+ description = "Search for facts using Wikipedia."
40
+ inputs = {
41
+ "query": {"type": "string", "description": "Search query"}
42
+ }
43
+ output_type = "string"
44
+
45
+ def forward(self, query: str) -> str:
46
+ return WikipediaSearcher().search(query)
47
+
48
+ wiki_tool = WikipediaTool()
49
 
50
  tools = [audio_tool, image_tool, wiki_tool]
51