Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 7 |
-
from tools import
|
| 8 |
from smolagents import CodeAgent
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
|
@@ -20,7 +20,7 @@ class BasicAgent:
|
|
| 20 |
model = ChatGoogleGenerativeAI(model="gemini-1.5-flash-latest")
|
| 21 |
|
| 22 |
# Initialize the web search tool
|
| 23 |
-
search_tool =
|
| 24 |
|
| 25 |
# Initialize the weather tool
|
| 26 |
weather_info_tool = WeatherInfoTool()
|
|
@@ -37,12 +37,8 @@ class BasicAgent:
|
|
| 37 |
prompt = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 38 |
|
| 39 |
QUESTION:
|
| 40 |
-
```{}```
|
| 41 |
"""
|
| 42 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 43 |
-
print(type(prompt))
|
| 44 |
-
print(type(question))
|
| 45 |
-
print(type(prompt + question))
|
| 46 |
answer = self.agent.run(prompt + question)
|
| 47 |
print(type(answer))
|
| 48 |
print(f"Agent returning answer: {str(answer)}")
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 7 |
+
from tools import InternetSearchTool, WeatherInfoTool
|
| 8 |
from smolagents import CodeAgent
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
|
|
|
| 20 |
model = ChatGoogleGenerativeAI(model="gemini-1.5-flash-latest")
|
| 21 |
|
| 22 |
# Initialize the web search tool
|
| 23 |
+
search_tool = InternetSearchTool()
|
| 24 |
|
| 25 |
# Initialize the weather tool
|
| 26 |
weather_info_tool = WeatherInfoTool()
|
|
|
|
| 37 |
prompt = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 38 |
|
| 39 |
QUESTION:
|
|
|
|
| 40 |
"""
|
| 41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
|
|
|
|
|
|
| 42 |
answer = self.agent.run(prompt + question)
|
| 43 |
print(type(answer))
|
| 44 |
print(f"Agent returning answer: {str(answer)}")
|