llm_dart_provider 0.11.0-alpha.1
llm_dart_provider: ^0.11.0-alpha.1 copied to clipboard
Provider specification contracts and shared provider-facing data structures for llm_dart.
llm_dart_provider #
Shared provider contracts and provider-neutral data structures for llm_dart.
Shared chat UI projection and chat UI JSON helpers live in
llm_dart_ai, not here.
Most applications should use the root llm_dart package instead. Depend on
llm_dart_provider directly when you are writing a provider package, a custom
model implementation, or an integration that needs the shared prompt/result
types without also depending on runtime helpers, HTTP clients, chat sessions, or
Flutter adapters.
What It Provides #
- prompt messages and content parts
- tool definitions and explicit
ToolOutputvariants for text, JSON, error, denied, and content-rich tool results - provider metadata on shared content and tool payloads
- language, embedding, image, speech, and transcription model interfaces
- model results, warnings, errors, usage, metadata, and finish reasons
- model capability profiles for UI gating and provider discovery
- JSON codecs for prompts and text stream events
- shared request controls such as
CallOptions.timeout,headers,maxRetries, cancellation, and typedproviderOptions
When To Use It #
Use this package directly when you need to:
- implement a custom
LanguageModelor other shared model interface - build a provider package that should stay independent from the root facade
- serialize shared prompt, stream, or chat UI payloads
- encode richer tool results such as multimodal content or provider-native file/custom payloads
- inspect capability profiles without taking a dependency on app runtimes
ToolResultPromptPart and ToolResultContent both accept toolOutput: so
provider code can keep tool result structure explicit. The compatibility
output: and isError: shorthand remain available for older call sites.
Use ExecutionDeniedToolOutput for denied execution or denied approval
outcomes that the application should preserve in prompt history, stream JSON,
or chat UI snapshots. Provider packages still decide how much of that shared
state can be replayed through their native request formats.
CallOptions.maxRetries mirrors the Vercel AI SDK request option shape. The
transport layer can still apply its own default retry policy, but per-call
retry counts stay explicit and provider-neutral.
When Not To Use It #
This package does not include:
- generation helper functions such as
generateTextCall(...) - Dio/HTTP transport clients
- provider-specific request codecs or options
- chat session orchestration
- Flutter controller adapters
For those layers, use llm_dart_ai, llm_dart_transport, provider packages,
llm_dart_chat, or llm_dart_flutter.