ChatResource class

Resource for chat-related operations.

Access this resource through OpenAIClient.chat.

Example

final response = await client.chat.completions.create(
  ChatCompletionCreateRequest(
    model: 'gpt-4o',
    messages: [ChatMessage.user('Hello!')],
  ),
);
print(response.text);
Inheritance

Constructors

ChatResource({required OpenAIConfig config, required Client httpClient, required InterceptorChain interceptorChain, required RequestBuilder requestBuilder, void ensureNotClosed()?, Client streamClientFactory()?})
Creates a ChatResource.

Properties

completions ChatCompletionsResource
Access to chat completions operations.
no setter
config OpenAIConfig
Client configuration.
finalinherited
ensureNotClosed → void Function()?
Callback to check if the client has been closed.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
httpClient → Client
HTTP client for making requests.
finalinherited
interceptorChain InterceptorChain
Interceptor chain for request/response processing.
finalinherited
requestBuilder → RequestBuilder
Request builder for constructing HTTP requests.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
streamClientFactory → Client Function()?
Factory for creating dedicated HTTP clients for streaming requests.
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited