Skip to main content

LocalStack Extension: OpenAI

Project description

LocalStack OpenAI Extension

GitHub license Python version Build Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localstack_extension_openai-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file localstack_extension_openai-0.1.0.tar.gz.

File metadata

File hashes

Hashes for localstack_extension_openai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 447c53716f3c6bd028c56f7c318a3b356943df928a7722fb1e6bedde2ae34bd9
MD5 09da6121282a1562d1104ac257127918
BLAKE2b-256 593ce59d50aebac35d03ab3971520a60e95688325d37516eba7a30d5f1241439

See more details on using hashes here.

File details

Details for the file localstack_extension_openai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for localstack_extension_openai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3539a9e4b874b8e0875ff7a01605456d794f5ae70f3b370c9e495730df0c9b3d
MD5 cc9b56f1d9e7c213c55c3070e013388a
BLAKE2b-256 9c30bb22497f74201c1e6da569fb96099a709d19a75cd8805e6764847e2ddbce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page