Spaces:
Runtime error
Runtime error
Commit
·
c06dab4
1
Parent(s):
d0fdfbe
add zero short agent 2
Browse files
app.py
CHANGED
@@ -697,10 +697,12 @@ agent_ZEROSHOT_REACT_2 = initialize_agent(tools2, GPTfake,
|
|
697 |
|
698 |
|
699 |
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
|
|
700 |
|
701 |
# llm_chain_openai = LLMChain(llm=llm, prompt=prompt_openai, verbose=True)
|
702 |
|
703 |
agent_core = ZeroShotAgent(llm_chain=llm_chain, tools=tools2, verbose=True)
|
|
|
704 |
|
705 |
agent_core_openai = OpenAIMultiFunctionsAgent(llm=llm, tools=tools, prompt=prompt_openai, verbose=True)
|
706 |
|
@@ -714,6 +716,17 @@ agent_ZEROSHOT_AGENT = AgentExecutor.from_agent_and_tools(
|
|
714 |
early_stopping_method="generate",
|
715 |
)
|
716 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
agent_OPENAI_MULTI = AgentExecutor.from_agent_and_tools(
|
718 |
agent=agent_core_openai,
|
719 |
tools=tools,
|
@@ -743,6 +756,11 @@ elif Choice =='OpenAI Multi':
|
|
743 |
elif Choice =='Zero Short React 2':
|
744 |
agent = agent_ZEROSHOT_REACT_2
|
745 |
print("Set to:", Choice)
|
|
|
|
|
|
|
|
|
|
|
746 |
|
747 |
# agent = agent_ZEROSHOT_AGENT
|
748 |
|
@@ -893,7 +911,10 @@ def SetAgent(Choice):
|
|
893 |
print("Set to:", Choice)
|
894 |
elif Choice =='Zero Short React 2':
|
895 |
agent = agent_ZEROSHOT_REACT_2
|
896 |
-
|
|
|
|
|
|
|
897 |
|
898 |
global record
|
899 |
record = []
|
@@ -1214,7 +1235,7 @@ with gr.Blocks() as demo:
|
|
1214 |
with gr.Row():
|
1215 |
|
1216 |
agentchoice = gr.Dropdown(
|
1217 |
-
choices=['Zero Short Agent','Zero Short React','OpenAI Multi','Zero Short React 2'],
|
1218 |
label="SELECT AI AGENT",
|
1219 |
scale= 2,
|
1220 |
show_label = True,
|
|
|
697 |
|
698 |
|
699 |
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
700 |
+
llm_chain_2 = LLMChain(llm=GPTfake, prompt=prompt)
|
701 |
|
702 |
# llm_chain_openai = LLMChain(llm=llm, prompt=prompt_openai, verbose=True)
|
703 |
|
704 |
agent_core = ZeroShotAgent(llm_chain=llm_chain, tools=tools2, verbose=True)
|
705 |
+
agent_core_2 = ZeroShotAgent(llm_chain=llm_chain_2, tools=tools2, verbose=True)
|
706 |
|
707 |
agent_core_openai = OpenAIMultiFunctionsAgent(llm=llm, tools=tools, prompt=prompt_openai, verbose=True)
|
708 |
|
|
|
716 |
early_stopping_method="generate",
|
717 |
)
|
718 |
|
719 |
+
agent_ZEROSHOT_AGENT_2 = AgentExecutor.from_agent_and_tools(
|
720 |
+
agent=agent_core_2,
|
721 |
+
tools=tools2,
|
722 |
+
verbose=True,
|
723 |
+
# memory=memory,
|
724 |
+
handle_parsing_errors = True,
|
725 |
+
max_iterations = int(os.environ["max_iterations"]),
|
726 |
+
early_stopping_method="generate",
|
727 |
+
)
|
728 |
+
|
729 |
+
|
730 |
agent_OPENAI_MULTI = AgentExecutor.from_agent_and_tools(
|
731 |
agent=agent_core_openai,
|
732 |
tools=tools,
|
|
|
756 |
elif Choice =='Zero Short React 2':
|
757 |
agent = agent_ZEROSHOT_REACT_2
|
758 |
print("Set to:", Choice)
|
759 |
+
elif Choice =='Zero Short Agent 2':
|
760 |
+
agent = agent_ZEROSHOT_AGENT_2
|
761 |
+
print("Set to:", Choice)
|
762 |
+
|
763 |
+
|
764 |
|
765 |
# agent = agent_ZEROSHOT_AGENT
|
766 |
|
|
|
911 |
print("Set to:", Choice)
|
912 |
elif Choice =='Zero Short React 2':
|
913 |
agent = agent_ZEROSHOT_REACT_2
|
914 |
+
print("Set to:", Choice)
|
915 |
+
elif Choice =='Zero Short Agent 2':
|
916 |
+
agent = agent_ZEROSHOT_AGENT_2
|
917 |
+
print("Set to:", Choice)
|
918 |
|
919 |
global record
|
920 |
record = []
|
|
|
1235 |
with gr.Row():
|
1236 |
|
1237 |
agentchoice = gr.Dropdown(
|
1238 |
+
choices=['Zero Short Agent','Zero Short React','OpenAI Multi','Zero Short React 2','Zero Short Agent 2'],
|
1239 |
label="SELECT AI AGENT",
|
1240 |
scale= 2,
|
1241 |
show_label = True,
|