Open nat-n opened 6 months ago
Can use this as a work-around for now: https://github.com/langchain-ai/langserve/blob/main/examples/chat_playground/server.py
We'll need to investigate, but we likely doing some gymantics with input and output schema and in the process forgot to support the simplest case of just wrapping a chat model
I'm having the same issue with the popup:
Expected content-type to be text/event-stream, Actual: application/json Check your backend logs for errors.
I don't quite understand what workaround was supposed to be used in the script example given. My chain is a LangGraph workflow that has a string as input and output.
Even I am having the same issue I am trying it with a local Ollama model
I'm having the same issue with the popup:
Expected content-type to be text/event-stream, Actual: application/json Check your backend logs for errors.
I don't quite understand what workaround was supposed to be used in the script example given. My chain is a LangGraph workflow that has a string as input and output.
After looking at the FastAPI Swagger and playing with some Curl request, I realized what my specific issue was. The type expected for the stream_log
endpoint is different when you switch from normal playground mode to the chat mode. The client sends out a dict when the request is triggered. After changing the entry type to a dict (instead of a string) on my chain, it works normally.
add_routes(
app,
custom_chain.with_types(input_type=dict,output_type=str),
# custom_chain.with_types(input_type=str,output_type=str), # endpoint type change for default playground
path="/local_assistant",
playground_type="chat",
)
I like the look of the newer chat playground_type, but I can't seem to get it work. When I try send a chat message the UI pops up the following error and the request (exported as curl below) looks malformed.
The error:
The malformed looking request:
Minimal app to reproduce the issue:
Full project for this app: langserve-test.zip
I'm using python 3.10 on macOS, latest stable release of each dependency.