StreamBotAPI
StreamBotAPI is a Python package that provides a simple Flask-based API for interacting with the StreamBot which is a wrapper of OpenAI's ChatGPT.
Installation
StreamBotAPI can be installed using pip:
pip install streambot-api
Usage
To use StreamBotAPI, first initialize an instance of the StreamBot class from the streambot package:
from streambot import StreamBot
streambot = StreamBot(
openai_key='your_openai_key',
bot_name='your_bot_name',
genesis_prompt='You are a helpful translator.'
)
You can then create an instance of the StreamBotAPI class by passing in the initialized StreamBot object:
from streambot_api import StreamBotAPI
server = StreamBotAPI(streambot, host='127.0.0.1', port=8080, origins=['http://localhost:3000', 'https://myapp.com'])
server.start()
This will start the Flask app with the specified configuration options and routes.
Configuration Options
The StreamBotAPI class takes the following configuration options:
- streambot: An instance of the StreamBot class from the streambot package.
- host: The hostname to listen on. Defaults to 0.0.0.0.
- port: The port of the web server. Defaults to 80.
- origins: A list of allowed origins for CORS. Defaults to ['*'].
Routes
The following routes are available:
GET /api/getmessages/<user_id>
Returns a JSON object containing all messages for the specified user.
POST /api/messages
Handles incoming chat messages from the user. Expects a JSON payload with the following fields:
connection_id: A unique ID for the user. message: The message from the user. Returns a JSON object containing all messages for the user.
POST /api/newchat
Resets the chat history for the specified user. Expects a JSON payload with the following field:
connection_id: A unique ID for the user. Returns a JSON object with a value of true.
License
This package is licensed under the MIT license. See the LICENSE file for more details.
Metadata
Release files for streambotapi 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| streambotapi-1.2.4.tar.gz | 3.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streambotapi-1.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / streambotapi-1.2.4.tar.gz
| Download URL | streambotapi-1.2.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14586b3b3662fc09a83ab530f06ecd3748be06756fde6f0414257a30797105bc
|
|
BLAKE2b-256 checksum How to use checksums |
6d59d668b37e1d12007cb5f8c490216859bc55a41625b074db3d66fe7d42540c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.10.10 Darwin/21.6.0
|
Release files / streambotapi-1.2.4-py3-none-any.whl
| Download URL | streambotapi-1.2.4-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0b362d5d3542ce13b8a88774fd47802e88b1be3b7be841954e071f9dc78dd8d
|
|
BLAKE2b-256 checksum How to use checksums |
91ae091905f3c3512f98e678d2acc82c73e33368976e227f1d5b682bc990764f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.10.10 Darwin/21.6.0
|
Security for streambotapi 1.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.