Skip to content

Latest commit

 

History

History
411 lines (301 loc) · 24.3 KB

api.md

File metadata and controls

411 lines (301 loc) · 24.3 KB

Shared Types

from openai.types import ErrorObject, FunctionDefinition, FunctionParameters

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,
    ChatCompletionContentPartText,
    ChatCompletionFunctionCallOption,
    ChatCompletionFunctionMessageParam,
    ChatCompletionMessage,
    ChatCompletionMessageParam,
    ChatCompletionMessageToolCall,
    ChatCompletionNamedToolChoice,
    ChatCompletionRole,
    ChatCompletionStreamOptions,
    ChatCompletionSystemMessageParam,
    ChatCompletionTokenLogprob,
    ChatCompletionTool,
    ChatCompletionToolChoiceOption,
    ChatCompletionToolMessageParam,
    ChatCompletionUserMessageParam,
)

Methods:

Embeddings

Types:

from openai.types import CreateEmbeddingResponse, Embedding

Methods:

Files

Types:

from openai.types import FileContent, FileDeleted, FileObject

Methods:

Images

Types:

from openai.types import Image, ImagesResponse

Methods:

Audio

Transcriptions

Types:

from openai.types.audio import Transcription

Methods:

Translations

Types:

from openai.types.audio import Translation

Methods:

Speech

Methods:

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

Moderations

Types:

from openai.types import Moderation, 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 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 (
    AssistantResponseFormat,
    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,
    ToolCall,
    ToolCallDelta,
    ToolCallDeltaObject,
    ToolCallsStepDetails,
)

Methods:

Messages

Types:

from openai.types.beta.threads import (
    Annotation,
    AnnotationDelta,
    FileCitationAnnotation,
    FileCitationDeltaAnnotation,
    FilePathAnnotation,
    FilePathDeltaAnnotation,
    ImageFile,
    ImageFileContentBlock,
    ImageFileDelta,
    ImageFileDeltaBlock,
    Message,
    MessageContent,
    MessageContentDelta,
    MessageDeleted,
    MessageDelta,
    MessageDeltaEvent,
    Text,
    TextContentBlock,
    TextDelta,
    TextDeltaBlock,
)

Methods:

Batches

Types:

from openai.types import Batch, BatchError, BatchRequestCounts

Methods: