Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,18 @@ import gradio as gr
|
|
| 2 |
import os
|
| 3 |
import requests
|
| 4 |
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
from src.agent import Agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
|
@@ -33,7 +42,12 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 33 |
|
| 34 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 35 |
try:
|
| 36 |
-
agent = Agent(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
except Exception as e:
|
| 38 |
print(f"Error instantiating agent: {e}")
|
| 39 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 2 |
import os
|
| 3 |
import requests
|
| 4 |
|
| 5 |
+
from langchain_community.tools import DuckDuckGoSearchResults
|
| 6 |
import pandas as pd
|
| 7 |
|
| 8 |
from src.agent import Agent
|
| 9 |
+
from src.tools import (
|
| 10 |
+
multiply, add, subtract, divide, modulus
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
tools = [
|
| 14 |
+
multiply, add, subtract, divide, modulus,
|
| 15 |
+
]
|
| 16 |
+
tools.append(DuckDuckGoSearchResults())
|
| 17 |
|
| 18 |
# (Keep Constants as is)
|
| 19 |
# --- Constants ---
|
|
|
|
| 42 |
|
| 43 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 44 |
try:
|
| 45 |
+
agent = Agent(
|
| 46 |
+
model="gpt-4o",
|
| 47 |
+
tools=tools,
|
| 48 |
+
system_prompt_path="prompts/system_prompt.txt",
|
| 49 |
+
openai_api_key=os.environ.get("OPENAI_API_KEY")
|
| 50 |
+
)
|
| 51 |
except Exception as e:
|
| 52 |
print(f"Error instantiating agent: {e}")
|
| 53 |
return f"Error initializing agent: {e}", None
|