Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -47,22 +47,7 @@ def invoke(openai_api_key, prompt, agent_option):
|
|
47 |
|
48 |
output = completion.choices[0].message.content
|
49 |
else:
|
50 |
-
|
51 |
-
model_name = config["model"],
|
52 |
-
openai_api_key = openai_api_key,
|
53 |
-
temperature = config["temperature"])
|
54 |
-
|
55 |
-
tools = load_tools(["openweathermap-api"])
|
56 |
-
|
57 |
-
agent = initialize_agent(
|
58 |
-
tools + # built-in tools
|
59 |
-
[date_tool], # custom tools
|
60 |
-
llm,
|
61 |
-
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
62 |
-
handle_parsing_errors = True,
|
63 |
-
verbose = True)
|
64 |
-
|
65 |
-
completion = agent(prompt)
|
66 |
|
67 |
output = completion["output"]
|
68 |
except Exception as e:
|
|
|
47 |
|
48 |
output = completion.choices[0].message.content
|
49 |
else:
|
50 |
+
completion = invoke_agent(openai_api_key, prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
output = completion["output"]
|
53 |
except Exception as e:
|