OpenAIDVAIAdapter class

Talks to the OpenAI REST API. OpenRouterDVAIAdapter reuses this wire format against a different host.

Inheritance

Constructors

OpenAIDVAIAdapter({required String apiKey, String model = defaultModel, String embeddingModel = defaultEmbeddingModel, String transcriptionModel = defaultTranscriptionModel, int maxOutputTokens = 4096, Uri? baseUrl, Map<String, String> extraHeaders = const <String, String>{}, DVAIHttpSend send = dvSendAIHttpRequest})

Properties

apiKey String
finalinherited
authHeaders Map<String, String>
Headers applied to every JSON request for this provider.
no setteroverride
baseUrl Uri
finalinherited
embeddingModel String
finalinherited
extraHeaders Map<String, String>
final
hashCode int
The hash code for this object.
no setterinherited
maxAgentIterations int
Upper bound on model turns in a native tool-calling loop. Reaching it is an error, not a silent truncation.
no setterinherited
maxOutputTokens int
finalinherited
model String
finalinherited
providerName String
Identifier reported in errors and passed through to generated logs.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
send DVAIHttpSend
finalinherited
transcriptionModel String
finalinherited

Methods

agentDidNotFinish() → Never
inherited
agentPrompt(DVAIAgentRequest request) String
inherited
agentTools(DVAIAgentRequest request) List<DVAIToolDefinition>
Registered definitions for the tools this request allows.
inherited
chat(String prompt, {String provider = 'gemini'}) Future<String>
The provider argument on chat is a caller hint retained for source compatibility; the configured adapter decides which service is used.
override
decodeJsonResponse(DVAIHttpResponse response) Map<String, Object?>
inherited
decodeToolInput(Object? raw) DVJsonObject
inherited
embed(String text) Future<List<double>>
override
endpoint(String path, [Map<String, String> query = const {}]) Uri
inherited
invokeAgentTool(DVAIToolDefinition tool, DVJsonObject input) Future<({bool isError, DVJsonValue value})>
Runs one registered tool, converting a thrown handler error into a value the model can read and recover from.
inherited
malformed(String description, [String? body]) → Never
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseStructuredText(String text) DVJsonObject
Providers return structured output as a JSON document inside a text field; this parses that document into Dartvel's typed value tree.
inherited
postJson(Uri url, Map<String, Object?> body) Future<Map<String, Object?>>
inherited
readDoubles(List<Object?> source, String description) List<double>
inherited
readList(Map<String, Object?> source, String key) List<Object?>
inherited
readMap(Map<String, Object?> source, String key) Map<String, Object?>
inherited
readString(Map<String, Object?> source, String key) String
inherited
runAgent(DVAIAgentRequest request) Future<DVAIAgentResult>
Native chat-completions tool-calling loop. Falls back to the prompt-based run when the request names no registered tools.
override
structuredOutput(String prompt, DVJsonObject schema) Future<DVJsonObject>
override
toString() String
A string representation of this object.
inherited
transcribe(List<int> audioBytes, {String mimeType = 'audio/wav', String language = 'und'}) Future<DVAITranscript>
override
unsupported(String capability) → Never
inherited

Operators

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