FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow

Home Page:https://flowiseai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] CSV agent is not working with OpenAI ChatGPT

automaton82 opened this issue · comments

Describe the bug
If you attempt to use the CSV agent with the attached public csv city data file, you get the following error:

Question: what cities are there

Response:

{'LatD': 'int64', ' "LatM"': 'int64', ' "LatS"': 'int64', ' "NS"': 'object', ' "LonD"': 'int64', ' "LonM"': 'int64', ' "LonS"': 'int64', ' "EW"': 'object', ' "City"': 'object', ' "State"': 'object'}
2024-05-06 19:54:32 [ERROR]: [server]: Error: Sorry, I'm unable to find answer for question: "what cities do you have" using following code: "df["City"].unique()"
Error: Sorry, I'm unable to find answer for question: "what cities do you have" using following code: "df["City"].unique()"
    at CSV_Agents.run (C:\git\flowise\packages\components\dist\nodes\agents\CSVAgent\CSVAgent.js:165:23)
    at async utilBuildChatflow (C:\git\flowise\packages\server\dist\utils\buildChatflow.js:232:15)
    at async createInternalPrediction (C:\git\flowise\packages\server\dist\controllers\internal-predictions\index.js:7:29)

All questions will fail though.

CSV file: cities.csv

To Reproduce
Steps to reproduce the behavior:

  1. Create a chatflow and add a CSV agent node
  2. Use OpenAI ChatGPT Chat Model or LLM node, it's the same result for both
  3. Upload the attached csv file
  4. Ask "what cities are there"

Expected behavior
This should work.

Setup

  • Installation pnpm start
  • Flowise Version latest as of ef53286
  • OS: Windows 11
  • Browser all

Additional context
Aside from this problem, it also appears the uploaded file does not go into DISK BLOB storage. It goes into the database as base64. This behaviour is different than the CSV document loader which does go into DISK BLOB storage immediately when uploaded. Not sure if this is intended or not.

OpenAI suddenly gives the prefix python, so the whole code becomes:

import pandas as pd
```python
print(df["Company Name"])
` ` `

which causes error when trying to run on pyodide
image

so the solution is to do some regex check to get rid of the prefix

@HenryHengZJ

It looks like the same issue I just reported with the Airtable Agent.

#2364

I would like to take up this issue, planning to implement the changes in the ChatflowPool, kindly assign me @HenryHengZJ. Thanks in advance.