# OpenAI Streamer
A Python package for streaming text completion using OpenAI's Responses API.
## Installation
You can install the package directly from the source:
```bash
# Activate your conda environment
conda activate OpenRAPI
# Install the package in development mode
pip install -e .
```
Or you can build and install the package:
```bash
# Activate your conda environment
conda activate OpenRAPI
# Build the package
python setup.py sdist bdist_wheel
# Install the package
pip install dist/openai_streamer-0.1.0-py3-none-any.whl
```
## Usage
### Basic Usage
```python
from openai_streamer.streamer import stream_completion
# Simple example
prompt = "Write a short poem about artificial intelligence."
instructions = "You are a creative poet with a technical background."
response = stream_completion(prompt, instructions=instructions)
```
### Using the Class
```python
from openai_streamer.streamer import OpenAIStreamer
# Create an instance
streamer = OpenAIStreamer()
# Generate a completion
prompt = "Explain quantum computing in simple terms."
instructions = "You are a science educator explaining complex topics to beginners."
response = streamer.stream_completion(prompt, instructions=instructions)
```
## Configuration
The package uses environment variables for configuration. Create a `.env` file in your project root with:
```
OPENAI_API_KEY=your_api_key_here
```
## Requirements
- Python 3.8+
- openai>=1.0.0
- python-dotenv>=0.19.0
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/openai-streamer",
"name": "openai-streamer",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "openai, ai, streaming, text completion, gpt",
"author": "Serge",
"author_email": "your.email@example.com",
"download_url": "https://files.pythonhosted.org/packages/d6/ae/514f69f43131e1f4566c012bb9c421b03b5251630170dd63339e11252d22/openai_streamer-0.1.0.tar.gz",
"platform": null,
"description": "# OpenAI Streamer\n\nA Python package for streaming text completion using OpenAI's Responses API.\n\n## Installation\n\nYou can install the package directly from the source:\n\n```bash\n# Activate your conda environment\nconda activate OpenRAPI\n\n# Install the package in development mode\npip install -e .\n```\n\nOr you can build and install the package:\n\n```bash\n# Activate your conda environment\nconda activate OpenRAPI\n\n# Build the package\npython setup.py sdist bdist_wheel\n\n# Install the package\npip install dist/openai_streamer-0.1.0-py3-none-any.whl\n```\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom openai_streamer.streamer import stream_completion\n\n# Simple example\nprompt = \"Write a short poem about artificial intelligence.\"\ninstructions = \"You are a creative poet with a technical background.\"\n\nresponse = stream_completion(prompt, instructions=instructions)\n```\n\n### Using the Class\n\n```python\nfrom openai_streamer.streamer import OpenAIStreamer\n\n# Create an instance\nstreamer = OpenAIStreamer()\n\n# Generate a completion\nprompt = \"Explain quantum computing in simple terms.\"\ninstructions = \"You are a science educator explaining complex topics to beginners.\"\n\nresponse = streamer.stream_completion(prompt, instructions=instructions)\n```\n\n## Configuration\n\nThe package uses environment variables for configuration. Create a `.env` file in your project root with:\n\n```\nOPENAI_API_KEY=your_api_key_here\n```\n\n## Requirements\n\n- Python 3.8+\n- openai>=1.0.0\n- python-dotenv>=0.19.0\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": null,
"summary": "A package for streaming text completion using OpenAI's Responses API",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/yourusername/openai-streamer/issues",
"Homepage": "https://github.com/yourusername/openai-streamer"
},
"split_keywords": [
"openai",
" ai",
" streaming",
" text completion",
" gpt"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "589fbb5fa061a42546fc7035d242de1e279ccff73a6accedb8f724bbaf218e39",
"md5": "cf087b80a19917234b517564bfb91f68",
"sha256": "d955f1091b4a398f47829e749c2e5ab863cb47e12a47cb220ad4d468dc0e8fb4"
},
"downloads": -1,
"filename": "openai_streamer-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cf087b80a19917234b517564bfb91f68",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4699,
"upload_time": "2025-03-18T11:43:39",
"upload_time_iso_8601": "2025-03-18T11:43:39.905482Z",
"url": "https://files.pythonhosted.org/packages/58/9f/bb5fa061a42546fc7035d242de1e279ccff73a6accedb8f724bbaf218e39/openai_streamer-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d6ae514f69f43131e1f4566c012bb9c421b03b5251630170dd63339e11252d22",
"md5": "243c010bcc81dc5f647ab635bf9e1bb6",
"sha256": "0867f9b268cfdc7c69de80e8ae00451862f87ab3b9a16f5bf6ddaa1882bf3245"
},
"downloads": -1,
"filename": "openai_streamer-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "243c010bcc81dc5f647ab635bf9e1bb6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4184,
"upload_time": "2025-03-18T11:43:41",
"upload_time_iso_8601": "2025-03-18T11:43:41.175787Z",
"url": "https://files.pythonhosted.org/packages/d6/ae/514f69f43131e1f4566c012bb9c421b03b5251630170dd63339e11252d22/openai_streamer-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-18 11:43:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "openai-streamer",
"github_not_found": true,
"lcname": "openai-streamer"
}