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.10.0.tar.gz (14.2 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.10.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: superduper_openai-0.10.0.tar.gz
  • Upload date:
  • Size: 14.2 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.10.0.tar.gz
Algorithm Hash digest
SHA256 d60908157e7a51a88262d8a9b9d36ba50b0f9b87b6dab4db91d02d1489de9bd7
MD5 1d2fd3459182065fd6cbe405802c266b
BLAKE2b-256 d7babe257ea216482a9f07f970ba248294cb75b38ed6d6587795f01c0b0ea1d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_openai-0.10.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.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superduper_openai-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b8c1c4778a4c214c9f6536b312cde0e3d492688cf4e559d5a75851409906d7e
MD5 ca347242439543c4d89734af82672033
BLAKE2b-256 f0b7d72d86f6a14858f3827bca291ebd49b470a175501a989e09f1100fd5d47b

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_openai-0.10.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