Skip to main content

Superduper allows users to work with openai API models.

Project description

superduper_openai

Superduper allows users to work with openai API models.

Installation

pip install superduper_openai

API

Class Description
superduper_openai.model.OpenAIEmbedding OpenAI embedding predictor.
superduper_openai.model.OpenAIChatCompletion OpenAI chat completion predictor.
superduper_openai.model.OpenAIImageCreation OpenAI image creation predictor.
superduper_openai.model.OpenAIImageEdit OpenAI image edit predictor.
superduper_openai.model.OpenAIAudioTranscription OpenAI audio transcription predictor.
superduper_openai.model.OpenAIAudioTranslation OpenAI audio translation predictor.

Examples

OpenAIEmbedding

from superduper_openai.model import OpenAIEmbedding
model = OpenAIEmbedding(identifier='text-embedding-ada-002')
model.predict('Hello, world!')

OpenAIChatCompletion

from superduper_openai.model import OpenAIChatCompletion
model = OpenAIChatCompletion(model='gpt-3.5-turbo', prompt='Hello, {context}')
model.predict('Hello, world!')

OpenAIImageCreation

from superduper_openai.model import OpenAIImageCreation

model = OpenAIImageCreation(
    model="dall-e",
    prompt="a close up, studio photographic portrait of a {context}",
    response_format="url",
)
model.predict("cat")

OpenAIImageEdit

import io

from superduper_openai.model import OpenAIImageEdit

model = OpenAIImageEdit(
    model="dall-e",
    prompt="A celebration party at the launch of {context}",
    response_format="url",
)
with open("test/material/data/rickroll.png", "rb") as f:
    buffer = io.BytesIO(f.read())
model.predict(buffer, context=["superduper"])

OpenAIAudioTranscription

import io
from superduper_openai.model import OpenAIAudioTranscription
with open('test/material/data/test.wav', 'rb') as f:
    buffer = io.BytesIO(f.read())
buffer.name = 'test.wav'
prompt = (
    'i have some advice for you. write all text in lower-case.'
    'only make an exception for the following words: {context}'
)
model = OpenAIAudioTranscription(identifier='whisper-1', prompt=prompt)
model.predict(buffer, context=['United States'])

OpenAIAudioTranslation

import io
from superduper_openai.model import OpenAIAudioTranslation
with open('test/material/data/german.wav', 'rb') as f:
    buffer = io.BytesIO(f.read())
buffer.name = 'test.wav'
prompt = (
    'i have some advice for you. write all text in lower-case.'
    'only make an exception for the following words: {context}'
)
e = OpenAIAudioTranslation(identifier='whisper-1', prompt=prompt)
resp = e.predict(buffer, context=['Emmerich'])
buffer.close()

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

superduper_openai-0.6.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superduper_openai-0.6.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file superduper_openai-0.6.0.tar.gz.

File metadata

  • Download URL: superduper_openai-0.6.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for superduper_openai-0.6.0.tar.gz
Algorithm Hash digest
SHA256 66eaddbec8066276317cf4062726753e97dc7b0fd56f27ef6fceb6c9f139ccf0
MD5 823a70802e002ecd09b9d7c2739d7a89
BLAKE2b-256 ba8190baa49262585c57327f36fce6bcec96c99c06071c2a1c3dafa6d83ede5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_openai-0.6.0.tar.gz:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file superduper_openai-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superduper_openai-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da565fe97bc3b47285e011e1331be2db61cd3681e0c5818b648b8660ca40b843
MD5 897abf81ce49db66c6f03ca7f14b8721
BLAKE2b-256 523f74161bd6ac259daca7b3871ebb04e2894bf5d2abfdc37bd6e33cec62ce2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_openai-0.6.0-py3-none-any.whl:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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