Skip to content

chat

The chat module provides classes for creating and managing chat sessions that leverage OpenAI's language models to generate conversational responses.

The module supports both synchronous and asynchronous operations, offering interfaces for direct interaction with the completion endpoints tailored for chat applications. Designed for developers looking to integrate AI-powered chat functionalities into their applications and features like raw and streaming response handling for more flexible integration.

Classes:

Name Description
AsyncChat
AsyncChatWithRawResponse
AsyncChatWithStreamingResponse
Chat
ChatWithRawResponse
ChatWithStreamingResponse

AsyncChat

AsyncChat(client: AsyncOpenAI)

Methods:

Name Description
completions
with_raw_response
with_streaming_response

completions

completions() -> AsyncCompletions

with_raw_response

with_raw_response() -> AsyncChatWithRawResponse

with_streaming_response

with_streaming_response() -> AsyncChatWithStreamingResponse

AsyncChatWithRawResponse

AsyncChatWithRawResponse(chat: AsyncChat)

Methods:

Name Description
completions

completions

AsyncChatWithStreamingResponse

AsyncChatWithStreamingResponse(chat: AsyncChat)

Methods:

Name Description
completions

completions

Chat

Chat(client: OpenAI)

Methods:

Name Description
completions
with_raw_response
with_streaming_response

completions

completions() -> Completions

with_raw_response

with_raw_response() -> ChatWithRawResponse

with_streaming_response

with_streaming_response() -> ChatWithStreamingResponse

ChatWithRawResponse

ChatWithRawResponse(chat: Chat)

Methods:

Name Description
completions

completions

completions() -> CompletionsWithRawResponse

ChatWithStreamingResponse

ChatWithStreamingResponse(chat: Chat)

Methods:

Name Description
completions

completions