Update agent.py
Browse files
agent.py
CHANGED
|
@@ -13,6 +13,7 @@ from langchain_google_genai import ChatGoogleGenerativeAI
|
|
| 13 |
from pathlib import Path
|
| 14 |
import tempfile
|
| 15 |
from dotenv import load_dotenv
|
|
|
|
| 16 |
|
| 17 |
# constants
|
| 18 |
API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
@@ -224,14 +225,18 @@ def wikipedia_search(query: str):
|
|
| 224 |
|
| 225 |
|
| 226 |
model = build_gemini_llm()
|
|
|
|
| 227 |
tools = [
|
| 228 |
add_numbers,
|
| 229 |
subtract_numbers,
|
| 230 |
multiply_numbers,
|
| 231 |
divide_numbers,
|
| 232 |
extract_text_from_image,
|
| 233 |
-
|
|
|
|
|
|
|
| 234 |
]
|
|
|
|
| 235 |
model_with_tools = model.bind_tools(tools)
|
| 236 |
|
| 237 |
def assistant(state: AgentState):
|
|
|
|
| 13 |
from pathlib import Path
|
| 14 |
import tempfile
|
| 15 |
from dotenv import load_dotenv
|
| 16 |
+
import wikipedia
|
| 17 |
|
| 18 |
# constants
|
| 19 |
API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 225 |
|
| 226 |
|
| 227 |
model = build_gemini_llm()
|
| 228 |
+
web_search = DuckDuckGoSearchRun()
|
| 229 |
tools = [
|
| 230 |
add_numbers,
|
| 231 |
subtract_numbers,
|
| 232 |
multiply_numbers,
|
| 233 |
divide_numbers,
|
| 234 |
extract_text_from_image,
|
| 235 |
+
download_and_read_file,
|
| 236 |
+
wikipedia_search,
|
| 237 |
+
web_search
|
| 238 |
]
|
| 239 |
+
|
| 240 |
model_with_tools = model.bind_tools(tools)
|
| 241 |
|
| 242 |
def assistant(state: AgentState):
|