Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -35,22 +35,26 @@ def invoke(openai_api_key, prompt, agent_option):
|
|
35 |
output = ""
|
36 |
|
37 |
try:
|
|
|
|
|
|
|
|
|
38 |
if (agent_option == AGENT_OFF):
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
else:
|
41 |
-
|
42 |
-
|
43 |
-
temperature = config["temperature"])
|
44 |
-
|
45 |
-
agent = initialize_agent([time],
|
46 |
-
llm,
|
47 |
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
48 |
handle_parsing_errors = True,
|
49 |
verbose = True)
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
except Exception as e:
|
55 |
err_msg = e
|
56 |
|
|
|
35 |
output = ""
|
36 |
|
37 |
try:
|
38 |
+
llm = ChatOpenAI(model_name = config["model_name"],
|
39 |
+
openai_api_key = openai_api_key,
|
40 |
+
temperature = config["temperature"])
|
41 |
+
|
42 |
if (agent_option == AGENT_OFF):
|
43 |
+
agent = initialize_agent([],
|
44 |
+
llm,
|
45 |
+
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
46 |
+
handle_parsing_errors = True,
|
47 |
+
verbose = True)
|
48 |
else:
|
49 |
+
agent = initialize_agent([time],
|
50 |
+
llm,
|
|
|
|
|
|
|
|
|
51 |
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
52 |
handle_parsing_errors = True,
|
53 |
verbose = True)
|
54 |
|
55 |
+
completion = agent(prompt)
|
56 |
|
57 |
+
output = completion["output"]
|
58 |
except Exception as e:
|
59 |
err_msg = e
|
60 |
|