Spaces:
Runtime error
Runtime error
Commit
·
00a5144
1
Parent(s):
9c7e962
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,11 +134,17 @@ class ChatDocumentQA:
|
|
| 134 |
vectorstore = self._create_vector_store_from_text_chunks(text_chunks)
|
| 135 |
return "file uploaded", {"knowledge_base": vectorstore}
|
| 136 |
elif file_extension == '.csv':
|
| 137 |
-
df = pd.read_csv(file_path)
|
| 138 |
-
pd_agent = create_pandas_dataframe_agent(OpenAI(temperature=0), df, verbose=True)
|
| 139 |
-
tools = self.get_agent_tools(pd_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 |
return "file uploaded", {"knowledge_base": agent_chain}
|
| 143 |
|
| 144 |
else:
|
|
|
|
| 134 |
vectorstore = self._create_vector_store_from_text_chunks(text_chunks)
|
| 135 |
return "file uploaded", {"knowledge_base": vectorstore}
|
| 136 |
elif file_extension == '.csv':
|
| 137 |
+
# df = pd.read_csv(file_path)
|
| 138 |
+
# pd_agent = create_pandas_dataframe_agent(OpenAI(temperature=0), df, verbose=True)
|
| 139 |
+
# tools = self.get_agent_tools(pd_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 |
+
OpenAI(temperature=0),
|
| 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:
|