Find answers from the community

Updated 2 years ago

While streaming the data words are

While streaming the data, words are getting broken up. Has anyone faced this issue?
L
j
3 comments
how are you streaming/viewing the stream?
Plain Text
@app.route('/answer')
def answer():
    ##index created
    response = index.as_query_engine(streaming=True).query(prompt)
    def generate():
        for row in response.response_gen:
            yield "data: %s\n\n" % char
    return app.response_class(generate(), content_type='text/event-stream')
Well, you have two newline characters to every token in your generator πŸ˜…
Add a reply
Sign up and join the conversation on Discord