Skip to content

Latest commit

 

History

History
488 lines (364 loc) · 26.6 KB

api.md

File metadata and controls

488 lines (364 loc) · 26.6 KB

Shared Types

from openai.types import (
    ErrorObject,
    FunctionDefinition,
    FunctionParameters,
    ResponseFormatJSONObject,
    ResponseFormatJSONSchema,
    ResponseFormatText,
)

Completions

Types:

from openai.types import Completion, CompletionChoice, CompletionUsage

Methods:

Chat

Types:

from openai.types import ChatModel

Completions

Types:

from openai.types.chat import (
    ChatCompletion,
    ChatCompletionAssistantMessageParam,
    ChatCompletionChunk,
    ChatCompletionContentPart,
    ChatCompletionContentPartImage,
    ChatCompletionContentPartRefusal,
    ChatCompletionContentPartText,
    ChatCompletionFunctionCallOption,
    ChatCompletionFunctionMessageParam,
    ChatCompletionMessage,
    ChatCompletionMessageParam,
    ChatCompletionMessageToolCall,
    ChatCompletionNamedToolChoice,
    ChatCompletionRole,
    ChatCompletionStreamOptions,
    ChatCompletionSystemMessageParam,
    ChatCompletionTokenLogprob,
    ChatCompletionTool,
    ChatCompletionToolChoiceOption,
    ChatCompletionToolMessageParam,
    ChatCompletionUserMessageParam,
)

Methods:

Embeddings

Types:

from openai.types import CreateEmbeddingResponse, Embedding, EmbeddingModel

Methods:

Files

Types:

from openai.types import FileContent, FileDeleted, FileObject, FilePurpose

Methods:

Images

Types:

from openai.types import Image, ImageModel, ImagesResponse

Methods:

Audio

Types:

from openai.types import AudioModel, AudioResponseFormat

Transcriptions

Types:

from openai.types.audio import (
    Transcription,
    TranscriptionSegment,
    TranscriptionVerbose,
    TranscriptionWord,
    TranscriptionCreateResponse,
)

Methods:

Translations

Types:

from openai.types.audio import Translation, TranslationVerbose, TranslationCreateResponse

Methods:

Speech

Types:

from openai.types.audio import SpeechModel

Methods:

  • client.audio.speech.create(**params) -> HttpxBinaryResponseContent

Moderations

Types:

from openai.types import (
    Moderation,
    ModerationImageURLInput,
    ModerationModel,
    ModerationMultiModalInput,
    ModerationTextInput,
    ModerationCreateResponse,
)

Methods:

Models

Types:

from openai.types import Model, ModelDeleted

Methods:

FineTuning

Jobs

Types:

from openai.types.fine_tuning import (
    FineTuningJob,
    FineTuningJobEvent,
    FineTuningJobIntegration,
    FineTuningJobWandbIntegration,
    FineTuningJobWandbIntegrationObject,
)

Methods:

Checkpoints

Types:

from openai.types.fine_tuning.jobs import FineTuningJobCheckpoint

Methods:

Beta

VectorStores

Types:

from openai.types.beta import (
    AutoFileChunkingStrategyParam,
    FileChunkingStrategy,
    FileChunkingStrategyParam,
    OtherFileChunkingStrategyObject,
    StaticFileChunkingStrategy,
    StaticFileChunkingStrategyObject,
    StaticFileChunkingStrategyParam,
    VectorStore,
    VectorStoreDeleted,
)

Methods:

Files

Types:

from openai.types.beta.vector_stores import VectorStoreFile, VectorStoreFileDeleted

Methods:

FileBatches

Types:

from openai.types.beta.vector_stores import VectorStoreFileBatch

Methods:

Assistants

Types:

from openai.types.beta import (
    Assistant,
    AssistantDeleted,
    AssistantStreamEvent,
    AssistantTool,
    CodeInterpreterTool,
    FileSearchTool,
    FunctionTool,
    MessageStreamEvent,
    RunStepStreamEvent,
    RunStreamEvent,
    ThreadStreamEvent,
)

Methods:

Threads

Types:

from openai.types.beta import (
    AssistantResponseFormatOption,
    AssistantToolChoice,
    AssistantToolChoiceFunction,
    AssistantToolChoiceOption,
    Thread,
    ThreadDeleted,
)

Methods:

Runs

Types:

from openai.types.beta.threads import RequiredActionFunctionToolCall, Run, RunStatus

Methods:

  • client.beta.threads.runs.create(thread_id, **params) -> Run
  • client.beta.threads.runs.retrieve(run_id, *, thread_id) -> Run
  • client.beta.threads.runs.update(run_id, *, thread_id, **params) -> Run
  • client.beta.threads.runs.list(thread_id, **params) -> SyncCursorPage[Run]
  • client.beta.threads.runs.cancel(run_id, *, thread_id) -> Run
  • client.beta.threads.runs.submit_tool_outputs(run_id, *, thread_id, **params) -> Run
  • client.beta.threads.runs.create_and_poll(*args) -> Run
  • client.beta.threads.runs.create_and_stream(*args) -> AssistantStreamManager[AssistantEventHandler] | AssistantStreamManager[AssistantEventHandlerT]
  • client.beta.threads.runs.poll(*args) -> Run
  • client.beta.threads.runs.stream(*args) -> AssistantStreamManager[AssistantEventHandler] | AssistantStreamManager[AssistantEventHandlerT]
  • client.beta.threads.runs.submit_tool_outputs_and_poll(*args) -> Run
  • client.beta.threads.runs.submit_tool_outputs_stream(*args) -> AssistantStreamManager[AssistantEventHandler] | AssistantStreamManager[AssistantEventHandlerT]

Steps

Types:

from openai.types.beta.threads.runs import (
    CodeInterpreterLogs,
    CodeInterpreterOutputImage,
    CodeInterpreterToolCall,
    CodeInterpreterToolCallDelta,
    FileSearchToolCall,
    FileSearchToolCallDelta,
    FunctionToolCall,
    FunctionToolCallDelta,
    MessageCreationStepDetails,
    RunStep,
    RunStepDelta,
    RunStepDeltaEvent,
    RunStepDeltaMessageDelta,
    RunStepInclude,
    ToolCall,
    ToolCallDelta,
    ToolCallDeltaObject,
    ToolCallsStepDetails,
)

Methods:

Messages

Types:

from openai.types.beta.threads import (
    Annotation,
    AnnotationDelta,
    FileCitationAnnotation,
    FileCitationDeltaAnnotation,
    FilePathAnnotation,
    FilePathDeltaAnnotation,
    ImageFile,
    ImageFileContentBlock,
    ImageFileDelta,
    ImageFileDeltaBlock,
    ImageURL,
    ImageURLContentBlock,
    ImageURLDelta,
    ImageURLDeltaBlock,
    Message,
    MessageContent,
    MessageContentDelta,
    MessageContentPartParam,
    MessageDeleted,
    MessageDelta,
    MessageDeltaEvent,
    RefusalContentBlock,
    RefusalDeltaBlock,
    Text,
    TextContentBlock,
    TextContentBlockParam,
    TextDelta,
    TextDeltaBlock,
)

Methods:

Batches

Types:

from openai.types import Batch, BatchError, BatchRequestCounts

Methods:

Uploads

Types:

from openai.types import Upload

Methods:

Parts

Types:

from openai.types.uploads import UploadPart

Methods: