agentic_llm 0.3.1
agentic_llm: ^0.3.1 copied to clipboard
Provider-independent chat and embedding models with streaming, tool calling and structured output. Adapters for OpenAI-compatible APIs, Anthropic and Gemini.
Changelog #
0.3.1 #
- Updated package documentation for the published 0.3.x release line.
0.3.0 #
Added #
- Every provider request now carries
traceparent(andtracestate) when theAgenticContexthas a trace. Providers do not read it; the proxy, gateway or backend in front of one does — and without it, "the model call" and "the request that reached our proxy" are two unrelated traces, so nobody can say which turn was slow. Trace headers are merged beneath the configured ones, so a name collision can never displace authentication.
Added #
- Model constants for every provider.
AnthropicModels.opus,.sonnet,.haiku;OpenAiModels,GeminiModels,GrokModels,DeepSeekModelsandMistralModels.modelis still a plainStringeverywhere, so any identifier a provider serves works, including one released after this package: the constants are a convenience, not a whitelist. ModelDirectory.listModels()on the OpenAI-compatible, Anthropic and Gemini adapters, following each provider's pagination to the end. This is what a model picker in an app should read, because only the provider knows what a given key may call today. Ollama and llama.cpp answer it too.SwitchableChatModel, so the model can be changed at run time — from a settings screen, say — without rebuilding the agent holding it, which would otherwise lose the session. A request in flight finishes on the model it started.LlmHttpTransport.getJson, the read-only call the listing endpoints need.
Changed #
-
Default model identifiers now name models that exist. Every default had gone stale, and two were retired outright:
Adapter Was Now OpenAiCompatibleChatModel.openAigpt-4ogpt-5.6AnthropicChatModelclaude-sonnet-4-20250514(retired)claude-sonnet-5OpenAiCompatibleChatModel.grokgrok-2-latest(retired)grok-4.6GeminiChatModelgemini-2.5-flashgemini-3.8-flashGeminiEmbeddingModelgemini-embedding-001gemini-embedding-2Pass
modelexplicitly to pin any of them.text-embedding-3-smallis unchanged, and still current. -
packages/agentic_integrationgainedbin/check_models.dart, run nightly in CI: it asks each provider for its model list and fails when a name this framework ships is no longer served. The two defaults that rotted before were both found by users, not by us.
Breaking #
GeminiEmbeddingModeldefaults to a different embedding model, and embedding spaces are not comparable across models: an index written withgemini-embedding-001cannot be searched withgemini-embedding-2queries, and the results are plausible nonsense rather than an error. Either passmodel: GeminiModels.embeddingLegacyto keep an existing index working, or re-embed every document.OpenAiCompatibleChatModel.deepSeekand.mistralnow requiremodel. Both providers publish dated identifiers or serve retired names through their replacements, so a default was deciding — silently, and differently over time — which model you pay for.DeepSeekModelsandMistralModelsname the published options.
0.2.0 #
- Released with the rest of the framework at 0.2.0, which it now depends on. No changes to this package's API or behaviour.
0.1.2 #
Fixes for Gemini. No API changes; upgrade with dart pub upgrade.
GeminiChatModeldefaults togemini-2.5-flash. The previous default,gemini-2.0-flash, has been retired by Google and returns 404.GeminiEmbeddingModeldefaults togemini-embedding-001. The previous default,text-embedding-004, has been retired and returns 404. BecauseRagIndexerrecords a failed document in its report rather than throwing, this showed up as documents indexed into zero passages, not as an error. The default of 768 dimensions is unchanged.- An API key Google rejects is now an
AuthenticationException. Google reports a bad key as400 INVALID_ARGUMENTwith reasonAPI_KEY_INVALID, which was mapped by status alone to a genericProviderException, so apps never showed their "check your key" message to Gemini users.
0.1.1 #
- Shortened the package description to the 60-180 character window pana scores against. Search engines truncate anything longer, so the ten points it withheld were pointing at a real defect: the useful half of the sentence was never being shown.
0.1.0 #
Initial release of the model layer.
Added #
- Ports —
ChatModelandEmbeddingModel, withChatRequest,ChatResponse,ModelInfo,ModelCapabilityandModelPricing. Capability negotiation fails unsupported requests with a message naming the missing feature rather than a provider 400. - Streaming —
ChatChunk,ToolCallDeltaandChatResponseBuilder, which reassembles fragmented tool-call JSON, keeps parallel calls apart, orders by provider index and tolerates truncation. A collected stream produces the sameChatResponsea non-streaming call would. - Transport — a shared HTTP client with cancellation, timeouts, and error
mapping onto the core hierarchy, including the 429-versus-quota distinction
and
Retry-Afterin both legal formats. A specification-compliant server-sent-event decoder that survives chunk boundaries and multi-byte splits. - Providers —
OpenAiCompatibleChatModel(OpenAI, DeepSeek, Grok, Mistral, Together, Groq, Ollama, llama.cpp),AnthropicChatModel,GeminiChatModel, plus OpenAI-compatible and Gemini embedding adapters. - Middleware —
RetryingChatModel,FallbackChatModelwith per-provider circuit breakers,CachingChatModelwithChatCacheandInMemoryChatCache, andObservableChatModelfor logs, traces and events. - Events —
LlmRequestStarted,LlmFirstTokenReceived,LlmResponseCompleted,LlmRequestFailedandLlmFailoverOccurred. - Testing —
package:agentic_llm/testing.dartexportsFakeChatModel,FakeTurnandFakeEmbeddingModel.