llm_sdk 0.5.0
llm_sdk: ^0.5.0 copied to clipboard
Unified interface for talking to LLMs (Claude, OpenAI, Gemini) from Dart/Flutter: multi-provider, streaming, tool calling, structured outputs.
0.5.0 #
- Sampling options: new
GenerationOptions(temperature,topP,stopSequences) accepted by everyLlmClientmethod (generate,generateText,streamText,streamEvents,generateObject) and mapped by each adapter to its own dialect (temperature/top_p/stopon OpenAI,stop_sequenceson Claude,generationConfigon Gemini). Anullfield is omitted, so the model's default applies. - Network resilience: new
RetryPolicy(configurable per provider via theretry:constructor argument). Thegeneratepath now retries transient failures — HTTP 408/429/5xx, timeouts, and dropped connections — with exponential backoff, and every request is bounded by atimeout. Streaming applies the connection timeout only (replaying a started stream is unsafe).RetryPolicy.noneopts out. - +12 tests (42 total): options mapping per provider, backoff timing, retry / exhaustion / non-retryable-status / network-drop / timeout, and client-level options passthrough. No breaking change: the new parameters are optional.
0.4.0 #
- Local models via
OpenAIProvider:apiKeyis now optional (defaults to empty) and theAuthorizationheader is omitted when empty, for self-hosted OpenAI-compatible servers (Ollama, LM Studio, llama.cpp, vLLM).baseUrlwas already overridable — no other API change. - Added
example/ollama_example.dart(fully local streaming + tool calling). - README: new "Local models" section.
0.3.1 #
- README: demo GIFs ("switch provider = 1 line", word-by-word streaming).
- pubspec:
screenshots:(shown on pub.dev). - No code or API change.
0.3.0 #
GeminiProvideradapter (Generative LanguagegenerateContentAPI): assistant role →model,system_instruction, tool results re-attached by name asfunctionResponse(Gemini has no call ID — we mapToolCallPart.id == name), forcing viatool_configmodeANY, SSE streaming (streamGenerateContent?alt=sse),usageandfinishReason. API key in thex-goog-api-keyheader, configurablebaseUrl.- +7 Gemini tests (29 total). No change to the core: all 3 providers share the same abstraction.
0.2.0 #
OpenAIProvideradapter (Chat Completions API): encoding/decoding, tool calling (tool_calls+ JSON-string arguments), structured outputs via forced tool, SSE streaming (assembling tool calls byindex),usageandfinishReason. ConfigurablebaseUrl(compatible with OpenAI-like endpoints). No change to the core: the abstraction holds as-is.- +8 OpenAI tests (22 total).
0.1.0 #
First slice: provider-agnostic core + complete Claude adapter.
- Core: types (
Message/Part/Tool/LlmResponse/LlmStreamEvent),LlmProvidercontract (generate+generateStream),LlmClientcarrying the tool loop,streamText,generateTextandgenerateObject<T>. ClaudeProvideradapter (Anthropic Messages API): encoding/decoding, tool calling, structured outputs via forced tool, SSE streaming (TextDelta/ToolCallDelta/StreamDone),usageandfinishReason.- 20 tests (client logic on a mocked provider + Claude round-trip/SSE).
