naveenvenkatesh commited on
Commit
33c99ba
1 Parent(s): 96d1ed4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -135,16 +135,16 @@ class ChatDocumentQA:
135
  file_extension = os.path.splitext(file_path)[1]
136
 
137
  if file_extension == '.csv':
138
- # agent = self.create_agent(file_path)
139
- # tools = self.get_agent_tools(agent)
140
- # memory,tools,prompt = self.create_memory_for_csv_qa(tools)
141
- # agent_chain = self.create_agent_chain_for_csv_qa(memory,tools,prompt)
142
- agent_chain = create_csv_agent(
143
- AzureOpenAI(azure_deployment = "ChatGPT"),
144
- file_path,
145
- verbose=True,
146
- agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
147
- )
148
  return "file uploaded", {"knowledge_base": agent_chain}
149
 
150
  else:
@@ -211,7 +211,7 @@ class ChatDocumentQA:
211
 
212
  def create_agent_chain_for_csv_qa(self,memory,tools,prompt):
213
 
214
- llm_chain = LLMChain(llm=OpenAI(temperature=0), prompt=prompt)
215
  agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True)
216
  agent_chain = AgentExecutor.from_agent_and_tools(
217
  agent=agent, tools=tools, verbose=True, memory=memory
 
135
  file_extension = os.path.splitext(file_path)[1]
136
 
137
  if file_extension == '.csv':
138
+ agent = self.create_agent(file_path)
139
+ tools = self.get_agent_tools(agent)
140
+ memory,tools,prompt = self.create_memory_for_csv_qa(tools)
141
+ agent_chain = self.create_agent_chain_for_csv_qa(memory,tools,prompt)
142
+ # agent_chain = create_csv_agent(
143
+ # AzureOpenAI(azure_deployment = "ChatGPT"),
144
+ # file_path,
145
+ # verbose=True,
146
+ # agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
147
+ # )
148
  return "file uploaded", {"knowledge_base": agent_chain}
149
 
150
  else:
 
211
 
212
  def create_agent_chain_for_csv_qa(self,memory,tools,prompt):
213
 
214
+ llm_chain = LLMChain(llm=AzureChatOpenAI(azure_deployment = "ChatGPT"), prompt=prompt)
215
  agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True)
216
  agent_chain = AgentExecutor.from_agent_and_tools(
217
  agent=agent, tools=tools, verbose=True, memory=memory