-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocalLLM Error 400 - chat messages must alternate roles between 'user' and 'assistant' #1159
Comments
The error you're encountering with the To resolve the issue, double-check the sequence of messages being sent to the If the problem persists, reviewing the complete error stack trace and the specific configuration of your By adjusting your message sequencing and verifying your
|
These are the logs in pandasai.log 2024-05-16 15:59:38 [INFO] Question: Which are the top 5 countries by GDP? France,7981801142,5.12 Germany,8803724522,6.94 Canada,0022525473,5.87 Update this initial code: # TODO: import the required dependencies
import pandas as pd
# Write code here
# Declare result var:
type (possible values "string", "number", "dataframe", "plot"). Examples: { "type": "string", "value": f"The highest salary is {highest_salary}." } or { "type": "number", "value": 125 } or { "type": "dataframe", "value": pd.DataFrame({...}) } or { "type": "plot", "value": "temp_chart.png" } QUERYWhich are the top 5 countries by GDP? Variable At the end, declare "result" variable as a dictionary of type and value. If you are asked to plot a chart, use "matplotlib" for charts, save as png. Generate python code and return full updated code: |
To address the error you're encountering with the Here are some steps to troubleshoot and potentially resolve the issue:
By focusing on these areas, you should be able to identify and correct the issue with the message structure that's causing the BadRequestError.
|
I have the same issue. What I have done is have a custom local llm, and set the messages to an empty list within the chat_completion function. This is just a temporary solution, and will not include any chat history. |
@qgzhaodow1 Do you also use SmartDataframe? As I need it to connect to the df. If so, could you attach your code for reference? Thank you! |
I just set messages to empty list before append the current prompt.
|
System Info
pandasai version 2.0.42
python version 3.10.0 and 3.11.9
馃悰 Describe the bug
There will be error:
How to solve this issue? Or am I doing anything wrong?
Btw, the llm is connected successfully. As when I execute
It will return something such as "' According to the International Monetary Fund (IMF) World Economic Outlook Update'".
The text was updated successfully, but these errors were encountered: