Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No streaming with Python #2442

Open
Petopp opened this issue May 18, 2024 · 3 comments
Open

No streaming with Python #2442

Petopp opened this issue May 18, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Petopp
Copy link

Petopp commented May 18, 2024

Hello everyone,

I am trying to process the response from the LLM from a Flowise endpoint in a structured way, e.g. to have it output in Streamlit as you know it from OpenAI etc..

Unfortunately I am not able to do this. The response as such works, but unfortunately not as a stream.

import requests


API_URL = "http://192.168.0.133:7000/api/v1/prediction/e8c074c0-0956-4cdf-9786-86b0aa47a989"

def query(payload):
    
    response = requests.post(API_URL, json=payload, stream=True)
    
    if response.status_code == 200:
        for line in response.iter_lines():
            if line:
                # Verarbeitung der Streaming-Daten hier
                data = line.decode('utf-8')
                print("Stream:", data)
                
    else:
        print("Error:", response.status_code)

# Beispielabfrage
query({
    "question": "How fast it's the light?",
    "overrideConfig": {
        "sessionId": "user1"
    }
})

Does anyone have any ideas on how to do this?

Here the Flowise part:

image

@Petopp
Copy link
Author

Petopp commented May 18, 2024

Flowise Version 1.7.2

@csningli
Copy link

also want to know how to handle the stream with python

@HenryHengZJ
Copy link
Contributor

for now you will have to use socket IO for streaming - https://docs.flowiseai.com/using-flowise/streaming
we're working on to change that to SSE

@HenryHengZJ HenryHengZJ added the enhancement New feature or request label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants