You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I'm getting something similar.. when the ChatInterfaces's fn is called, i get this error:
gradio.exceptions.Error: "Data incompatible with messages format. Each message should be a dictionary with 'role' and 'content' keys or a ChatMessage object.
and indeed, my history[] has that metadata component in it too. So in the declaration of fn, I used a lambda function to try to address that by add clean_history() on the history parameter:
def clean_history(history):
# Keep only 'role' and 'content' keys from each history entry
return [{"role": entry["role"], "content": entry["content"]} for entry in history]
but I'm still getting the same error...
Any help would be great!
This is running under FastAPI framework. I had this thing running fine with flask, but the app and chatbbot were on different ports. With FastAPI, it's running on the same port by:
gr.mount_gradio_app(app, chatter, "/chat")
where /chat if the src of the iframe it's running in.
Describe the bug
When set type="messages" for ChatInterface. In the GUI, history is in messages format, but from API call, history is in tuples format.
Have you searched existing issues? 🔎
Reproduction
The following is from Gradio Web:
The following is from gradio_client:
where history format is inconsistent.
Screenshot
No response
Logs
No response
System Info
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered: