OpenAIBuilder class

OpenAI-specific LLM builder with provider-specific configuration methods

This builder provides a layered configuration approach where OpenAI-specific parameters are handled separately from the generic LLMBuilder, keeping the main builder clean and focused.

Use this for OpenAI-specific parameters only. For common parameters like apiKey, model, temperature, etc., continue using the base LLMBuilder methods.

Constructors

OpenAIBuilder(LLMBuilder _baseBuilder)

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() → Future<ChatCapability>
Builds and returns a configured LLM provider instance
buildAssistant() → Future<AssistantCapability>
Builds a provider with AssistantCapability
buildAudio() → Future<AudioCapability>
Builds a provider with AudioCapability
buildEmbedding() → Future<EmbeddingCapability>
Builds a provider with EmbeddingCapability
buildFileManagement() → Future<FileManagementCapability>
Builds a provider with FileManagementCapability
buildImageGeneration() → Future<ImageGenerationCapability>
Builds a provider with ImageGenerationCapability
buildModelListing() → Future<ModelListingCapability>
Builds a provider with ModelListingCapability
buildModeration() → Future<ModerationCapability>
Builds a provider with ModerationCapability
buildOpenAIResponses() → Future<OpenAIProvider>
Builds an OpenAI provider with Responses API enabled
computerUseTool({required int displayWidth, required int displayHeight, required String environment, Map<String, dynamic>? parameters}) → OpenAIBuilder
Adds computer use built-in tool
fileSearchTool({List<String>? vectorStoreIds, Map<String, dynamic>? parameters}) → OpenAIBuilder
Adds file search built-in tool
forAnalysis({int topLogprobsCount = 5}) → OpenAIBuilder
Configure for analysis tasks with log probabilities
forCodeGeneration({int? seed}) → OpenAIBuilder
Configure for code generation with deterministic output
forConversation() → OpenAIBuilder
Configure for conversational AI with balanced creativity
forCreativeWriting() → OpenAIBuilder
Configure for creative writing with reduced repetition
forFactualResponses({int? seed}) → OpenAIBuilder
Configure for factual and consistent responses
frequencyPenalty(double penalty) → OpenAIBuilder
Sets frequency penalty for reducing repetition (-2.0 to 2.0)
logitBias(Map<String, double> bias) → OpenAIBuilder
Sets logit bias for specific tokens
logprobs(bool enabled) → OpenAIBuilder
Enables or disables log probabilities
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parallelToolCalls(bool enabled) → OpenAIBuilder
Enables or disables parallel tool calls
presencePenalty(double penalty) → OpenAIBuilder
Sets presence penalty for encouraging topic diversity (-2.0 to 2.0)
previousResponseId(String responseId) → OpenAIBuilder
Sets previous response ID for chaining responses
seed(int seedValue) → OpenAIBuilder
Sets seed for deterministic outputs
topLogprobs(int count) → OpenAIBuilder
Sets the number of most likely tokens to return log probabilities for
toString() → String
A string representation of this object.
inherited
useResponsesAPI([bool use = true]) → OpenAIBuilder
Enables the new Responses API instead of Chat Completions API
verbosity(Verbosity level) → OpenAIBuilder
Sets verbosity level for GPT-5 family models
webSearch({WebSearchContextSize contextSize = WebSearchContextSize.medium}) → OpenAIBuilder
Configures web search for OpenAI models
webSearchTool() → OpenAIBuilder
Adds web search built-in tool

Operators

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