Spaces:
Runtime error
Runtime error
Commit
·
23e1297
1
Parent(s):
e6b2623
Update query_solver.py
Browse files- query_solver.py +28 -1
query_solver.py
CHANGED
|
@@ -3,8 +3,35 @@ import json
|
|
| 3 |
import autogen
|
| 4 |
from autogen.agentchat.contrib.math_user_proxy_agent import MathUserProxyAgent
|
| 5 |
|
|
|
|
| 6 |
def run_query(math_problem, api_key):
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
if __name__ == "__main__":
|
| 10 |
input_data = json.loads(sys.stdin.read())
|
|
|
|
| 3 |
import autogen
|
| 4 |
from autogen.agentchat.contrib.math_user_proxy_agent import MathUserProxyAgent
|
| 5 |
|
| 6 |
+
# Function to run the query
|
| 7 |
def run_query(math_problem, api_key):
|
| 8 |
+
config_list = [
|
| 9 |
+
{
|
| 10 |
+
'model': 'gpt-3.5-turbo',
|
| 11 |
+
'api_key': api_key,
|
| 12 |
+
},
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
autogen.ChatCompletion.start_logging()
|
| 16 |
+
|
| 17 |
+
assistant = autogen.AssistantAgent(
|
| 18 |
+
name="assistant",
|
| 19 |
+
system_message="You are a helpful assistant.",
|
| 20 |
+
llm_config={
|
| 21 |
+
"request_timeout": 600,
|
| 22 |
+
"seed": 42,
|
| 23 |
+
"config_list": config_list,
|
| 24 |
+
}
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
mathproxyagent = MathUserProxyAgent(
|
| 28 |
+
name="mathproxyagent",
|
| 29 |
+
human_input_mode="NEVER",
|
| 30 |
+
code_execution_config={"use_docker": False},
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
return mathproxyagent.initiate_chat(assistant, problem=math_problem)
|
| 34 |
+
|
| 35 |
|
| 36 |
if __name__ == "__main__":
|
| 37 |
input_data = json.loads(sys.stdin.read())
|