flutter_ai_client 0.1.5 copy "flutter_ai_client: ^0.1.5" to clipboard
flutter_ai_client: ^0.1.5 copied to clipboard

Provider-agnostic chat controller for flutter_ai. Wraps any LlmProvider in a Listenable UseChatController with optimistic send, cancellation, regeneration, and frame-batched streaming — without imposi [...]

Changelog #

0.1.5 #

  • Turn-sequence guard: a late event from a cancelled stream can no longer mutate the conversation or leak onto the events stream after a new turn starts.
  • maxBranches (default 20) caps retained regenerations so a long chat can't grow without bound.
  • tokenBudget: stop the agent loop once cumulative usage exceeds the budget (a cost ceiling on top of maxSteps).

0.1.4 #

  • Thread management: ChatThread, a ChatThreadStore (list/delete on top of ChatStore), autoTitle(conversation), and an InMemoryChatThreadStore for demos/tests — enough to drive a multi-conversation sidebar.

0.1.3 #

  • totalUsage getter on UseChatController: summed AiUsage across the conversation (feed an AiContextMeter or estimate cost).

0.1.2 #

  • Agent loop: pass onToolCalls (and optional maxSteps, default 8) to UseChatController and it becomes an automatic agent — when a model turn ends with unanswered tool calls it runs the executor, feeds the results back, and re-prompts until there are no pending calls or maxSteps model calls have run. Without onToolCalls behavior is unchanged (the host drives tools manually via addToolResults). Cancellation/stop aborts the loop mid-flight.

0.1.1 #

  • editMessage(id, text) / editLastUserMessage(text): edit a sent user message (keeping attachments), discard everything after it, and re-run from that point — starting a fresh branch set. Closes the previously dead "edit" affordance in AiMessageActions.
  • Persistence seam: a ChatStore interface (load/save) plus an attachStore(controller, store, id) helper that debounce-auto-saves the conversation once each turn settles. History is still in memory by default; this makes saving/restoring a thread a few lines. AiConversation is already JSON-serializable, so a store is just encode/decode around your storage.

0.1.0 #

Initial release.

  • UseChatController — a ChangeNotifier wrapping any LlmProvider:
    • optimistic, synchronous user-message append
    • sendText / submit / stop / regenerate / clear
    • live model/provider switching (setProvider, setOptions, setTools)
    • coalesced, injectable notification scheduling (frame-batched streaming)
    • raw events stream escape hatch
  • ChatStatus (idle / submitted / streaming / error).
  • Exposes stackTrace alongside error so failures can be reported with full context.
  • A fatal (message-scoped) StreamErrorEvent tears down the active turn so a misbehaving provider can't keep mutating the conversation after a fatal error; tool-scoped errors remain non-fatal.
  • Re-exports flutter_ai_core.
0
likes
0
points
687
downloads

Publisher

unverified uploader

Weekly Downloads

Provider-agnostic chat controller for flutter_ai. Wraps any LlmProvider in a Listenable UseChatController with optimistic send, cancellation, regeneration, and frame-batched streaming — without imposing a state-management library.

Homepage
Repository (GitHub)
View/report issues

Topics

#ai #llm #chat #streaming #flutter

License

unknown (license)

Dependencies

flutter, flutter_ai_core

More

Packages that depend on flutter_ai_client