open_responses 0.1.4
open_responses: ^0.1.4 copied to clipboard
Dart client for the OpenResponses API. Provides a unified, type-safe interface for interacting with multiple LLM providers through the OpenResponses specification.
0.1.4 #
0.1.3 #
0.1.2 #
0.1.1 #
0.1.0 #
Initial release of the OpenResponses Dart client.
Features #
- Core Client:
OpenResponsesClientwith configurable base URL and authentication - Response Creation:
responses.create()for non-streaming requests - Streaming:
responses.createStream()andresponses.stream()with builder pattern - Multi-provider Support: Works with OpenAI, Ollama, Hugging Face, OpenRouter, and LM Studio
Request Features #
- String or message item list input
- System instructions via
instructionsparameter - Multi-turn conversations with
previousResponseId - Temperature and max output tokens control
- Service tier selection
Tools #
FunctionTool: Define custom functions with JSON Schema parametersMcpTool: Remote Model Context Protocol server tools- Tool choice configuration (auto, required, specific function)
Structured Output #
TextConfigwith format optionsJsonSchemaFormatfor structured JSON responses with strict modeTextResponseFormatandJsonObjectFormat
Reasoning Models #
ReasoningConfigwith effort levels (low, medium, high)- Reasoning summary modes (concise, detailed, auto)
- Access to reasoning items via
response.reasoningItems
Streaming Events #
- Full SSE event parsing with 25+ event types
- Response lifecycle events (created, queued, in_progress, completed, failed)
- Output item and content part events
- Text delta and done events
- Function call argument streaming
- Reasoning delta and summary events
- Error events
Content Types #
InputTextContent: Text inputInputImageContent: Image URLs with detail levelInputFileContent: File referencesOutputTextContent: Text output with annotationsRefusalContent: Model refusal messages
Message Items #
MessageItemwith role (user, assistant, system, developer)- Convenience factories:
userText(),systemText(),assistantText() FunctionCallItemandFunctionCallOutputItemItemReferencefor referencing previous items
DX Extensions #
response.outputText: Concatenated text from outputresponse.functionCalls: All function call itemsresponse.reasoningItems: All reasoning itemsresponse.hasToolCalls,response.isCompleted,response.isFailedevent.textDelta,event.isFinalstream.text,stream.finalResponse
Error Handling #
OpenResponsesExceptionsealed class hierarchyApiExceptionwith error code and detailsAuthenticationExceptionfor auth failuresRateLimitExceptionwith retry-after durationValidationExceptionfor invalid requestsTimeoutExceptionandAbortedException
Authentication #
BearerTokenProviderfor API key authenticationNoAuthProviderfor local providers (Ollama, LM Studio)- Extensible
AuthProviderinterface
Configuration #
OpenResponsesConfigwith base URL, auth, headers, timeoutRetryPolicywith exponential backoff and jitter- Custom HTTP client support
Commits #
- FEAT: Initial implementation of OpenResponses Dart client (#10). (4fac8fa6)
- FEAT: Comprehensive model improvements with new features (#16). (6b6450a7)
- FEAT: Add SummaryTextContent for reasoning models (#23). (93ce0a00)
- FEAT: Add ReasoningInputItem, UnknownEvent, and provider aliases (#28). (e1fa0afe)
- REFACTOR: Align client package architecture across SDK packages (#37). (cf741ee1)
- REFACTOR: Align API surface across all SDK packages (#36). (ed969cc7)