Spaces:
Runtime error
Runtime error
Commit
·
d8a62af
1
Parent(s):
4a9eea6
add structured agent
Browse files
app.py
CHANGED
@@ -542,7 +542,7 @@ def UpdateDb():
|
|
542 |
|
543 |
ListAgentWithRemoteGPT = ['Zero Short React 2','Zero Short Agent 2',
|
544 |
'OpenAI Multi 2', 'Conversation Agent',
|
545 |
-
'Code Interpreter']
|
546 |
|
547 |
def SummarizeDoc():
|
548 |
global vectordb_p
|
@@ -1011,6 +1011,30 @@ agent_ZEROSHOT_REACT_2 = initialize_agent(tools_remote, GPTfake,
|
|
1011 |
|
1012 |
)
|
1013 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1014 |
agent_CODE_INTERPRETER = initialize_agent(tools_remote, GPTfake,
|
1015 |
# agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
1016 |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
@@ -1143,6 +1167,12 @@ def SetAgent(Choice):
|
|
1143 |
elif Choice =='Code Interpreter':
|
1144 |
agent = agent_CODE_INTERPRETER
|
1145 |
print("Set to:", Choice)
|
|
|
|
|
|
|
|
|
|
|
|
|
1146 |
|
1147 |
|
1148 |
|
@@ -1702,7 +1732,7 @@ with gr.Blocks() as demo:
|
|
1702 |
agentchoice = gr.Dropdown(
|
1703 |
choices=['Zero Short Agent','Zero Short React','OpenAI Multi',
|
1704 |
'Zero Short React 2','Zero Short Agent 2','None','Conversation Agent',
|
1705 |
-
'Code Interpreter'],
|
1706 |
label="SELECT AI AGENT",
|
1707 |
scale= 2,
|
1708 |
show_label = True,
|
|
|
542 |
|
543 |
ListAgentWithRemoteGPT = ['Zero Short React 2','Zero Short Agent 2',
|
544 |
'OpenAI Multi 2', 'Conversation Agent',
|
545 |
+
'Code Interpreter', 'Structured Zero Short Agent']
|
546 |
|
547 |
def SummarizeDoc():
|
548 |
global vectordb_p
|
|
|
1011 |
|
1012 |
)
|
1013 |
|
1014 |
+
agent_STRUCTURED_ZEROSHOT_REACT = initialize_agent(tools_remote, GPTfake,
|
1015 |
+
# agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
1016 |
+
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
1017 |
+
verbose = True,
|
1018 |
+
handle_parsing_errors = True,
|
1019 |
+
max_iterations = int(os.environ["max_iterations"]),
|
1020 |
+
early_stopping_method="generate",
|
1021 |
+
memory = memory2,
|
1022 |
+
agent_kwargs={
|
1023 |
+
'prefix': PREFIX_2,
|
1024 |
+
'format_instructions': FORMAT_INSTRUCTIONS_3,
|
1025 |
+
'suffix': SUFFIX2,
|
1026 |
+
'input_variables': input_variables,
|
1027 |
+
|
1028 |
+
},
|
1029 |
+
# input_variables = input_variables,
|
1030 |
+
# agent_kwargs={
|
1031 |
+
# 'prompt': prompt,
|
1032 |
+
# }
|
1033 |
+
|
1034 |
+
)
|
1035 |
+
|
1036 |
+
|
1037 |
+
|
1038 |
agent_CODE_INTERPRETER = initialize_agent(tools_remote, GPTfake,
|
1039 |
# agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
1040 |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
|
|
1167 |
elif Choice =='Code Interpreter':
|
1168 |
agent = agent_CODE_INTERPRETER
|
1169 |
print("Set to:", Choice)
|
1170 |
+
elif Choice =='Structured Zero Short Agent':
|
1171 |
+
agent = agent_STRUCTURED_ZEROSHOT_REACT
|
1172 |
+
print("Set to:", Choice)
|
1173 |
+
|
1174 |
+
|
1175 |
+
|
1176 |
|
1177 |
|
1178 |
|
|
|
1732 |
agentchoice = gr.Dropdown(
|
1733 |
choices=['Zero Short Agent','Zero Short React','OpenAI Multi',
|
1734 |
'Zero Short React 2','Zero Short Agent 2','None','Conversation Agent',
|
1735 |
+
'Code Interpreter', 'Structured Zero Short Agent'],
|
1736 |
label="SELECT AI AGENT",
|
1737 |
scale= 2,
|
1738 |
show_label = True,
|