# 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/*`
Raw data
{
"_id": null,
"home_page": "https://github.com/FlowiseAI/FlowisePy",
"name": "flowise",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Henry Heng",
"author_email": "support@flowiseai.com",
"download_url": "https://files.pythonhosted.org/packages/c3/1b/5ae9df6eda4e5c4934ab11cdacaf8e409e09d7f9baa0012c1caa10537c34/flowise-1.0.4.tar.gz",
"platform": null,
"description": "# Flowise SDK - Python\r\n\r\nThe **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.\r\n\r\n## Features\r\n\r\n- Support for streaming and non-streaming API responses\r\n- Ability to include message history and file uploads\r\n\r\n## Installation\r\n\r\nYou can install the SDK via pip:\r\n\r\n```bash\r\npip install flowise\r\n```\r\n\r\nUpgrade version:\r\n\r\n```bash\r\npip install --upgrade flowise\r\n```\r\n\r\n## Example\r\n\r\n```py\r\nfrom flowise import Flowise, PredictionData, IMessage, IFileUpload\r\n\r\ndef example_non_streaming():\r\n # Initialize Flowise client\r\n client = Flowise()\r\n\r\n # Create a prediction without streaming\r\n completion = client.create_prediction(\r\n PredictionData(\r\n chatflowId=\"abc\",\r\n question=\"What is the capital of France?\",\r\n streaming=False # Non-streaming mode\r\n )\r\n )\r\n\r\n # Process and print the full response\r\n for response in completion:\r\n print(\"Non-streaming response:\", response)\r\n\r\ndef example_streaming():\r\n # Initialize Flowise client\r\n client = Flowise()\r\n\r\n # Create a prediction with streaming enabled\r\n completion = client.create_prediction(\r\n PredictionData(\r\n chatflowId=\"abc\",\r\n question=\"Tell me a joke!\",\r\n streaming=True # Enable streaming\r\n )\r\n )\r\n\r\n # Process and print each streamed chunk\r\n print(\"Streaming response:\")\r\n for chunk in completion:\r\n print(chunk)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n # Run the non-streaming example\r\n example_non_streaming()\r\n\r\n # Run the streaming example\r\n example_streaming()\r\n```\r\n\r\n## Build & Publish\r\n\r\n1. Increment version on `setup.py`\r\n1. `pip install wheel`\r\n2. `python setup.py sdist bdist_wheel`\r\n3. `twine upload --skip-existing dist/*`\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Flowise SDK for Python to interact with the Flowise API.",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/FlowiseAI/FlowisePy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b93e5b99fc503a99c4cb461977b9f13da3b8411bfcf132b0b545e067e187881b",
"md5": "18ca0f2bb4a91af1c6435788c3b7e5d5",
"sha256": "013767dbebcccb6540735723022a2474543c8ea3d73e46b957b759f14c46fd2d"
},
"downloads": -1,
"filename": "flowise-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18ca0f2bb4a91af1c6435788c3b7e5d5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4148,
"upload_time": "2024-09-23T12:55:10",
"upload_time_iso_8601": "2024-09-23T12:55:10.163959Z",
"url": "https://files.pythonhosted.org/packages/b9/3e/5b99fc503a99c4cb461977b9f13da3b8411bfcf132b0b545e067e187881b/flowise-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c31b5ae9df6eda4e5c4934ab11cdacaf8e409e09d7f9baa0012c1caa10537c34",
"md5": "d0ec363e055af838c91ce5cdfdc5ba85",
"sha256": "a1a155787cda477402537af88f9dad8716ccc9b15b80ec80f68dd209c20f11b8"
},
"downloads": -1,
"filename": "flowise-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "d0ec363e055af838c91ce5cdfdc5ba85",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4029,
"upload_time": "2024-09-23T12:55:11",
"upload_time_iso_8601": "2024-09-23T12:55:11.306469Z",
"url": "https://files.pythonhosted.org/packages/c3/1b/5ae9df6eda4e5c4934ab11cdacaf8e409e09d7f9baa0012c1caa10537c34/flowise-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-23 12:55:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FlowiseAI",
"github_project": "FlowisePy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flowise"
}