flutter_ai_core 0.1.6
flutter_ai_core: ^0.1.6 copied to clipboard
Dependency-free Dart foundation for AI chat: message and conversation models, a streaming MessageProcessor with granular mutations, and the provider and renderer contracts the rest of the flutter_ai f [...]
Changelog #
0.1.6 #
ReasoningPart/ReasoningDeltagain an optionalsignature(preserved and replayed so providers like Anthropic accept thinking blocks on tool rounds).MessageProcessorkeeps the last good partial tool-call args instead of clobbering them to{}mid-stream.
0.1.5 #
AiRequestOptions.cachePrompt: hint that the stable prompt prefix (system + tools) should be cached. Anthropic appliescache_control; OpenAI/Gemini cache automatically (no-op).
0.1.4 #
AiResponseFormat(+AiRequestOptions.responseFormat): request structured output constrained to a JSON schema. Providers route it to their native mechanism; the assistant's text is the JSON object.
0.1.3 #
AiUsagemodel (input/output/cached/reasoning/total tokens) with+to accumulate andestimateCost(...)for cost from per-million prices. Carried onMessageFinishedand stored on the completedAiMessage; the processor applies it on finish.
0.1.2 #
- Docs: added a "Buy me a coffee" (Ko-fi) support section to the README. No code changes.
0.1.1 #
Bug fixes in MessageProcessor:
- Zero-argument tool calls (a
ToolCallReadywith no streamed arguments) now resolve to empty args +inputAvailableinstead of being marked errored. - A
ToolResultReceivedwhosemessageIddiffers from the call's message (the normal case — results arrive in a separate tool-role message) now correctly advances the original call tooutputAvailable. - A tool-scoped
StreamErrorEvent(withtoolCallId) now marks only that call errored and lets generation continue, instead of failing the whole message — matchingUseChatController. - Doc fix: corrected a stale reference to
flutter_markdown_plus. JsonAccumulatorno longer surfaces an unterminated trailing number/keyword (e.g.1234from{"n": 1234) as a complete value — a literal must be delimiter-terminated, preserving the "a partial is always a prefix" contract.MessageProcessorresolves a tool result to its owning call by scanning the conversation when the in-memory map misses (afterreset()/rehydration).deepHashuses order-independent hashing for maps (better distribution).
0.1.0 #
Initial release.
- Models:
AiConversation,AiMessage,AiMessageStatus,AiRole,FinishReason, and the sealedAiParthierarchy (TextPart,ReasoningPart,ToolCallPart,ToolResultPart,FilePart,SourcePart,DataPart) with manual JSON serialization and value equality. - Streaming: sealed
AiStreamEventset,MessageProcessorreducer with granularMutationResults, and the tolerantJsonAccumulatorfor partial tool-call arguments. - Contracts:
LlmProvider,TextRenderer,AiRequestOptions,ToolDefinition. - Zero runtime dependencies (
dart:core+dart:convertonly).