https://github.com/flowiseai/flowisepy
https://github.com/flowiseai/flowisepy
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/flowiseai/flowisepy
- Owner: FlowiseAI
- License: mit
- Created: 2024-09-05T10:52:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-23T12:55:35.000Z (over 1 year ago)
- Last Synced: 2025-07-30T08:07:10.548Z (7 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 25
- Watchers: 1
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Flowise SDK - Python
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.
## Features
- Support for streaming and non-streaming API responses
- Ability to include message history and file uploads
## Installation
You can install the SDK via pip:
```bash
pip install flowise
```
Upgrade version:
```bash
pip install --upgrade flowise
```
## Example
```py
from flowise import Flowise, PredictionData, IMessage, IFileUpload
def example_non_streaming():
# Initialize Flowise client
client = Flowise()
# Create a prediction without streaming
completion = client.create_prediction(
PredictionData(
chatflowId="abc",
question="What is the capital of France?",
streaming=False # Non-streaming mode
)
)
# Process and print the full response
for response in completion:
print("Non-streaming response:", response)
def example_streaming():
# Initialize Flowise client
client = Flowise()
# Create a prediction with streaming enabled
completion = client.create_prediction(
PredictionData(
chatflowId="abc",
question="Tell me a joke!",
streaming=True # Enable streaming
)
)
# Process and print each streamed chunk
print("Streaming response:")
for chunk in completion:
print(chunk)
if __name__ == "__main__":
# Run the non-streaming example
example_non_streaming()
# Run the streaming example
example_streaming()
```
## Build & Publish
1. Increment version on `setup.py`
1. `pip install wheel`
2. `python setup.py sdist bdist_wheel`
3. `twine upload --skip-existing dist/*`