Update agent.py
Browse files
agent.py
CHANGED
|
@@ -27,6 +27,7 @@ load_dotenv()
|
|
| 27 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 28 |
|
| 29 |
### ======================================== MATHEMATICAL TOOLS ======================================== ###
|
|
|
|
| 30 |
def multiply(a: int, b: int) -> int:
|
| 31 |
return a * b
|
| 32 |
|
|
@@ -148,6 +149,7 @@ arvix_search_tool = Tool(
|
|
| 148 |
|
| 149 |
|
| 150 |
### ======================================== CODE INTERPRETER TOOLS ======================================== ###
|
|
|
|
| 151 |
def execute_code_multilang(code: str, language: str = "python") -> str:
|
| 152 |
"""Execute code in multiple languages (Python, Bash, SQL, C, Java) and return results.
|
| 153 |
Args:
|
|
@@ -221,6 +223,9 @@ execute_code_multilang_tool = Tool(
|
|
| 221 |
)
|
| 222 |
|
| 223 |
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
# load the system prompt from the file
|
| 226 |
with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
|
@@ -240,6 +245,8 @@ tools = [
|
|
| 240 |
wiki_search_tool,
|
| 241 |
web_search_tool,
|
| 242 |
arvix_search_tool,
|
|
|
|
|
|
|
| 243 |
]
|
| 244 |
|
| 245 |
# Build graph function
|
|
|
|
| 27 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 28 |
|
| 29 |
### ======================================== MATHEMATICAL TOOLS ======================================== ###
|
| 30 |
+
|
| 31 |
def multiply(a: int, b: int) -> int:
|
| 32 |
return a * b
|
| 33 |
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
### ======================================== CODE INTERPRETER TOOLS ======================================== ###
|
| 152 |
+
|
| 153 |
def execute_code_multilang(code: str, language: str = "python") -> str:
|
| 154 |
"""Execute code in multiple languages (Python, Bash, SQL, C, Java) and return results.
|
| 155 |
Args:
|
|
|
|
| 223 |
)
|
| 224 |
|
| 225 |
|
| 226 |
+
### ======================================== DOCUMENT PROCESSING TOOLS ======================================== ###
|
| 227 |
+
|
| 228 |
+
|
| 229 |
|
| 230 |
# load the system prompt from the file
|
| 231 |
with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
|
|
|
| 245 |
wiki_search_tool,
|
| 246 |
web_search_tool,
|
| 247 |
arvix_search_tool,
|
| 248 |
+
execute_code_multilang_tool,
|
| 249 |
+
|
| 250 |
]
|
| 251 |
|
| 252 |
# Build graph function
|