Spaces:
Runtime error
Runtime error
Commit
·
bcfb892
1
Parent(s):
9e7afb7
add conversation agenet
Browse files
app.py
CHANGED
|
@@ -461,7 +461,8 @@ def UpdateDb():
|
|
| 461 |
print("Pinecone Updated Done")
|
| 462 |
print(index.describe_index_stats())
|
| 463 |
|
| 464 |
-
ListAgentWithRemoteGPT = ['Zero Short React 2',
|
|
|
|
| 465 |
|
| 466 |
def SummarizeDoc():
|
| 467 |
global vectordb_p
|
|
@@ -916,6 +917,28 @@ agent_ZEROSHOT_REACT_2 = initialize_agent(tools_remote, GPTfake,
|
|
| 916 |
|
| 917 |
)
|
| 918 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 919 |
|
| 920 |
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
| 921 |
llm_chain_2 = LLMChain(llm=GPTfake, prompt=prompt)
|
|
@@ -997,9 +1020,9 @@ def SetAgent(Choice):
|
|
| 997 |
elif Choice == "None":
|
| 998 |
agent = None
|
| 999 |
print("Set to:", Choice)
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
|
| 1004 |
global agent
|
| 1005 |
Choice = os.environ["agent_type"]
|
|
@@ -1489,7 +1512,7 @@ with gr.Blocks() as demo:
|
|
| 1489 |
|
| 1490 |
agentchoice = gr.Dropdown(
|
| 1491 |
choices=['Zero Short Agent','Zero Short React','OpenAI Multi',
|
| 1492 |
-
'Zero Short React 2','Zero Short Agent 2','None','
|
| 1493 |
label="SELECT AI AGENT",
|
| 1494 |
scale= 2,
|
| 1495 |
show_label = True,
|
|
|
|
| 461 |
print("Pinecone Updated Done")
|
| 462 |
print(index.describe_index_stats())
|
| 463 |
|
| 464 |
+
ListAgentWithRemoteGPT = ['Zero Short React 2','Zero Short Agent 2',
|
| 465 |
+
'OpenAI Multi 2', 'Conversation Agent']
|
| 466 |
|
| 467 |
def SummarizeDoc():
|
| 468 |
global vectordb_p
|
|
|
|
| 917 |
|
| 918 |
)
|
| 919 |
|
| 920 |
+
agent_CONVERSATION = initialize_agent(tools_remote, GPTfake,
|
| 921 |
+
# agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 922 |
+
agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION,
|
| 923 |
+
verbose = True,
|
| 924 |
+
handle_parsing_errors = True,
|
| 925 |
+
max_iterations = int(os.environ["max_iterations"]),
|
| 926 |
+
early_stopping_method="generate",
|
| 927 |
+
memory = memory2,
|
| 928 |
+
# agent_kwargs={
|
| 929 |
+
# 'prefix': PREFIX_2,
|
| 930 |
+
# 'format_instructions': FORMAT_INSTRUCTIONS_3,
|
| 931 |
+
# 'suffix': SUFFIX2,
|
| 932 |
+
# 'input_variables': input_variables,
|
| 933 |
+
|
| 934 |
+
# },
|
| 935 |
+
# input_variables = input_variables,
|
| 936 |
+
# agent_kwargs={
|
| 937 |
+
# 'prompt': prompt,
|
| 938 |
+
# }
|
| 939 |
+
|
| 940 |
+
)
|
| 941 |
+
|
| 942 |
|
| 943 |
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
| 944 |
llm_chain_2 = LLMChain(llm=GPTfake, prompt=prompt)
|
|
|
|
| 1020 |
elif Choice == "None":
|
| 1021 |
agent = None
|
| 1022 |
print("Set to:", Choice)
|
| 1023 |
+
elif Choice =='Conversation Agent':
|
| 1024 |
+
agent = agent_CONVERSATION
|
| 1025 |
+
print("Set to:", Choice)
|
| 1026 |
|
| 1027 |
global agent
|
| 1028 |
Choice = os.environ["agent_type"]
|
|
|
|
| 1512 |
|
| 1513 |
agentchoice = gr.Dropdown(
|
| 1514 |
choices=['Zero Short Agent','Zero Short React','OpenAI Multi',
|
| 1515 |
+
'Zero Short React 2','Zero Short Agent 2','None','Conversation Agent'],
|
| 1516 |
label="SELECT AI AGENT",
|
| 1517 |
scale= 2,
|
| 1518 |
show_label = True,
|