Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import inspect
|
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, PythonInterpreterTool, Tool, tool, VisitWebpageTool, LiteLLMModel
|
| 7 |
from groq import Groq
|
|
|
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
|
@@ -19,7 +20,8 @@ class BasicAgent:
|
|
| 19 |
self.model = LiteLLMModel(
|
| 20 |
"llama-3.3-70b-versatile",
|
| 21 |
api_base="https://api.groq.com/openai/v1",
|
| 22 |
-
api_key=GROQ_KEY
|
|
|
|
| 23 |
)
|
| 24 |
self.model.flatten_messages_as_text = True
|
| 25 |
|
|
@@ -27,12 +29,11 @@ class BasicAgent:
|
|
| 27 |
tools=[DuckDuckGoSearchTool(), FinalAnswerTool(), VisitWebpageTool(), PythonInterpreterTool(), ],
|
| 28 |
model=self.model,
|
| 29 |
add_base_tools=False,
|
| 30 |
-
max_print_outputs_length=2048,
|
| 31 |
-
|
| 32 |
)
|
| 33 |
|
| 34 |
def __call__(self, question: str) -> str:
|
| 35 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 36 |
response = self.agent.run(question)
|
| 37 |
print(response)
|
| 38 |
return response
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, PythonInterpreterTool, Tool, tool, VisitWebpageTool, LiteLLMModel
|
| 7 |
from groq import Groq
|
| 8 |
+
import time
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
| 11 |
# --- Constants ---
|
|
|
|
| 20 |
self.model = LiteLLMModel(
|
| 21 |
"llama-3.3-70b-versatile",
|
| 22 |
api_base="https://api.groq.com/openai/v1",
|
| 23 |
+
api_key=GROQ_KEY,
|
| 24 |
+
max_tokens=2048
|
| 25 |
)
|
| 26 |
self.model.flatten_messages_as_text = True
|
| 27 |
|
|
|
|
| 29 |
tools=[DuckDuckGoSearchTool(), FinalAnswerTool(), VisitWebpageTool(), PythonInterpreterTool(), ],
|
| 30 |
model=self.model,
|
| 31 |
add_base_tools=False,
|
|
|
|
|
|
|
| 32 |
)
|
| 33 |
|
| 34 |
def __call__(self, question: str) -> str:
|
| 35 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 36 |
+
time.sleep(10)
|
| 37 |
response = self.agent.run(question)
|
| 38 |
print(response)
|
| 39 |
return response
|