The Flowise SDK for Python provides an easy way to interact with the Flowise API for creating predictions, supporting both streaming and non-streaming responses. This SDK allows users to create predictions with customizable options, including history, file uploads, and more.
- Support for streaming and non-streaming API responses
- Ability to include message history and file uploads
You can install the SDK via pip:
pip install flowiseUpgrade version:
pip install --upgrade flowisefromflowiseimportFlowise, PredictionData, IMessage, IFileUploaddefexample_non_streaming(): # Initialize Flowise clientclient=Flowise() # Create a prediction without streamingcompletion=client.create_prediction( PredictionData( chatflowId="abc", question="What is the capital of France?", streaming=False# Non-streaming mode ) ) # Process and print the full responseforresponseincompletion: print("Non-streaming response:", response) defexample_streaming(): # Initialize Flowise clientclient=Flowise() # Create a prediction with streaming enabledcompletion=client.create_prediction( PredictionData( chatflowId="abc", question="Tell me a joke!", streaming=True# Enable streaming ) ) # Process and print each streamed chunkprint("Streaming response:") forchunkincompletion: print(chunk) if__name__=="__main__": # Run the non-streaming exampleexample_non_streaming() # Run the streaming exampleexample_streaming()- Increment version on
setup.py pip install wheelpython setup.py sdist bdist_wheeltwine upload --skip-existing dist/*