Comments (2)
I switched to using ",
(double quote followed by comma) as the delimiter always, and getting the LLM to always double quote each value in the CSV. Then strip the double quotes from each value, which leaves you with clean values, unless a value itself contains ",
. This will always be a problem unless the LLM can properly escape the delimiters and double quotes inside each value.
from autocrew.
In the original script, the parse_csv_data function splits the lines of the CSV data using the delimiter (, in this case). However, this approach fails when Ollama inserts "," within the quoted areas, as it incorrectly splits the values.
To handle this scenario, we can use the csv module provided by Python. This module has a reader function that can parse CSV data while taking into account the quoting rules.
In the modified parse_csv_data function, we import the csv module and create a csv_data object using the csv.reader function. We pass the response string and the delimiter (, in this case) to the reader function.
Next, we convert the csv_data object to a list of lines using list(csv_data). This allows us to access individual lines of the CSV data.
We then process each line of the CSV data. For each line, we iterate over the values and the corresponding header indices. We use the header indices to map the values to the correct header names.
To handle the double quotes within the values, we use the strip('"') method to remove the leading and trailing quotes from each value.
Finally, we append the agent data to the agents_data list and return it.
With these modifications, the parse_csv_data function will correctly handle the scenario where Ollama inserts "," within the quoted areas in the CSV output.
from autocrew.
Related Issues (20)
- Provide compatibility with OpenAI HOT 1
- Summary of issues with individual scripts
- requirements.txt for langchain-community HOT 2
- Structuring CrewAI scripts to use the OpenAI api HOT 3
- c++ developer creates a bad Agent Name HOT 1
- Error in Autocrew 2.0.7: Role Component Missing in CSV Data HOT 10
- bad import HOT 2
- openai key is now needed. HOT 4
- version3 bug
- Allow Delegation should be Yes/No
- SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='? HOT 2
- ValueError: Missing or incomplete data for "role" HOT 2
- AutoCrew failed during the script generation phase due to a specific error encountered when attempting to process the response from LLM + Log attached
- Error during saving crews - missing ollama folder. HOT 1
- Tutorial should mention about install requirements.txt file HOT 1
- Why insist on Ubuntu/WSL? HOT 5
- Autocrew+Ollama failures HOT 1
- ValueError: No CSV data found in the response HOT 2
- No script file found for the selected crew
- Any idea how to set OPENAI_BASE_URL and system proxy? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autocrew.