LocalStack Extension: OpenAI
Project description
LocalStack OpenAI Extension
This is a LocalStack extension that allows you to mock the OpenAI API for testing and development purposes. It provides a convenient way to interact with a mock OpenAI service locally using LocalStack.
Installation
You can install this extension directly using the LocalStack extension manager:
localstack extensions install localstack-extension-openai
Using
Once installed, you can access the OpenAI Mock API through localhost:4510/v1
.
Example
import openai
openai.organization = "org-test"
openai.api_key = "test"
openai.api_base = "http://localhost:4510/v1"
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(completion.choices)
Coverage
- Chat completion
- Engines Listing
- Transcribe
- Translate
- Generate Image URL
- Generate Image Base64
- Embeddings
- Fine Tuning
- Files
- Moderations
Authors
Cristopher Pinzon cristopher.pinzon@localstack.cloud
Licensing
- The extension code is licensed under the Apache 2.0 License
Thank you for using the LocalStack OpenAI Extension!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file localstack_extension_openai-0.1.0.tar.gz
.
File metadata
- Download URL: localstack_extension_openai-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 447c53716f3c6bd028c56f7c318a3b356943df928a7722fb1e6bedde2ae34bd9 |
|
MD5 | 09da6121282a1562d1104ac257127918 |
|
BLAKE2b-256 | 593ce59d50aebac35d03ab3971520a60e95688325d37516eba7a30d5f1241439 |
File details
Details for the file localstack_extension_openai-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: localstack_extension_openai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3539a9e4b874b8e0875ff7a01605456d794f5ae70f3b370c9e495730df0c9b3d |
|
MD5 | cc9b56f1d9e7c213c55c3070e013388a |
|
BLAKE2b-256 | 9c30bb22497f74201c1e6da569fb96099a709d19a75cd8805e6764847e2ddbce |