Update app.py
Browse files
app.py
CHANGED
|
@@ -48,21 +48,21 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 48 |
try:
|
| 49 |
llm = ChatOllama(model="llama3.1")
|
| 50 |
|
| 51 |
-
search = DuckDuckGoSearchRun()
|
| 52 |
-
tools = [
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
]
|
| 59 |
agent = initialize_agent(
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
)
|
| 66 |
except Exception as e:
|
| 67 |
print(f"Error instantiating agent: {e}")
|
| 68 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 48 |
try:
|
| 49 |
llm = ChatOllama(model="llama3.1")
|
| 50 |
|
| 51 |
+
search = DuckDuckGoSearchRun()
|
| 52 |
+
tools = [
|
| 53 |
+
Tool(
|
| 54 |
+
name="DuckDuckGo Search",
|
| 55 |
+
func=search.run,
|
| 56 |
+
description="Useful for answering questions about current events or the web."
|
| 57 |
+
)
|
| 58 |
+
]
|
| 59 |
agent = initialize_agent(
|
| 60 |
+
tools,
|
| 61 |
+
llm,
|
| 62 |
+
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 63 |
+
verbose=True,
|
| 64 |
+
handle_parsing_errors=True
|
| 65 |
+
)
|
| 66 |
except Exception as e:
|
| 67 |
print(f"Error instantiating agent: {e}")
|
| 68 |
return f"Error initializing agent: {e}", None
|