OpenAIResponses class

OpenAI Responses API capability implementation

This module handles the new Responses API which combines the simplicity of Chat Completions with the tool-use capabilities of the Assistants API. It supports built-in tools like web search, file search, and computer use.

Implemented types
Available extensions

Constructors

OpenAIResponses.new(OpenAIClient client, OpenAIConfig config)

Properties

client OpenAIClient
final
config OpenAIConfig
final
hashCode int
The hash code for this object.
no setterinherited
responsesEndpoint String
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelResponse(String responseId) Future<ChatResponse>
Cancel a background response by ID
override
chat(List<ChatMessage> messages) Future<ChatResponse>
Sends a chat request to the provider with a sequence of messages.
override
chat(List<ChatMessage> messages) Future<ChatResponse>

Available on OpenAIResponsesCapability, provided by the OpenAIResponsesCapabilityExtensions extension

Convenience method for simple chat without tools
chatBackground(List<ChatMessage> messages) Future<ChatResponse>

Available on OpenAIResponsesCapability, provided by the OpenAIResponsesCapabilityExtensions extension

Convenience method for background chat without tools
chatStream(List<ChatMessage> messages, {List<Tool>? tools}) Stream<ChatStreamEvent>
Sends a streaming chat request to the provider
override
chatWithTools(List<ChatMessage> messages, List<Tool>? tools) Future<ChatResponse>
Sends a chat request to the provider with a sequence of messages and tools.
override
chatWithToolsBackground(List<ChatMessage> messages, List<Tool>? tools) Future<ChatResponse>
Create a response with background processing
override
continueConversation(String previousResponseId, List<ChatMessage> newMessages, {List<Tool>? tools, bool background = false}) Future<ChatResponse>
Create a new response that continues from a previous response
override
deleteResponse(String responseId) Future<bool>
Delete a model response by ID
override
forkConversation(String fromResponseId, List<ChatMessage> newMessages, {List<Tool>? tools, bool background = false}) Future<ChatResponse>
Fork a conversation from a specific response
override
getResponse(String responseId, {List<String>? include, int? startingAfter, bool stream = false}) Future<ChatResponse>
Retrieve a model response by ID
override
getResponseText(String responseId) Future<String?>

Available on OpenAIResponsesCapability, provided by the OpenAIResponsesCapabilityExtensions extension

Get response text directly
getResponseThinking(String responseId) Future<String?>

Available on OpenAIResponsesCapability, provided by the OpenAIResponsesCapabilityExtensions extension

Get response thinking content directly
listInputItems(String responseId, {String? after, String? before, List<String>? include, int limit = 20, String order = 'desc'}) Future<ResponseInputItemsList>
List input items for a response
override
memoryContents() Future<List<ChatMessage>?>
Get current memory contents if provider supports memory
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
responseExists(String responseId) Future<bool>

Available on OpenAIResponsesCapability, provided by the OpenAIResponsesCapabilityExtensions extension

Check if a response exists and is accessible
summarizeHistory(List<ChatMessage> messages) Future<String>
Summarizes a conversation history into a concise 2-3 sentence summary
override
toString() String
A string representation of this object.
inherited

Operators

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