polyMoe commited on
Commit
0bd1a1f
·
verified ·
1 Parent(s): b8cb75f

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +10 -0
tools.py CHANGED
@@ -1,5 +1,9 @@
1
  from smolagents import DuckDuckGoSearchTool
2
  from smolagents import Tool
 
 
 
 
3
  import random
4
  from huggingface_hub import list_models
5
 
@@ -7,6 +11,12 @@ from huggingface_hub import list_models
7
  # Initialize the DuckDuckGo search tool
8
  search_tool = DuckDuckGoSearchTool()
9
 
 
 
 
 
 
 
10
 
11
  class WeatherInfoTool(Tool):
12
  name = "weather_info"
 
1
  from smolagents import DuckDuckGoSearchTool
2
  from smolagents import Tool
3
+ from llama_index.core import SimpleDirectoryReader
4
+ from llama_index.readers.file import (
5
+ PDFReader,
6
+ )
7
  import random
8
  from huggingface_hub import list_models
9
 
 
11
  # Initialize the DuckDuckGo search tool
12
  search_tool = DuckDuckGoSearchTool()
13
 
14
+ # PDF Reader with `SimpleDirectoryReader`
15
+ parser = PDFReader()
16
+ file_extractor = {".pdf": parser}
17
+ documents = SimpleDirectoryReader(
18
+ "./questions_files", file_extractor=file_extractor
19
+ ).load_data()
20
 
21
  class WeatherInfoTool(Tool):
22
  name = "weather_info"