Skip to content

How to use streamText.toDataStreamResponse() with FastAPI endpoint? #2599

Answered by lgrammel
muke5hy asked this question in Help
Discussion options

You must be logged in to vote

In your case, StreamingTextResponse is not doing anything special. You can just return a regular JS Response object:

return new Response(stream, {
  status: 200,
  contentType: 'text/plain; charset=utf-8',
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kimchankwon
Comment options

Answer selected by lgrammel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants