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.0.6.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

superduper_openai-0.0.6-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: superduper_openai-0.0.6.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for superduper_openai-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c176dad18fb653760a4ea302c6e274c33de0e7367ae8fc19ed3d70ecfb429d08
MD5 9c08e910ca1eddfe18db964b3799a120
BLAKE2b-256 05e8ba152048bf98af1b05e0bb0862a6b02596b9767f59d673c1b3182023a852

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for superduper_openai-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 02e93b34ddc3cc98e2d714acc134fb6796cdd8add6c998a752242f518bb98b5a
MD5 e594628205dd244d299c8e709fd617b5
BLAKE2b-256 3f68c87d8476bcb7a152878176c233f83aa710c673785e5d2f48d8615618734a

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