ai_chat library

Classes

AiChat
instructions and _summaryInstructions are evaluated pre every request
AiChatItem
id is always an uuid chatId may be any string
AiChatRepo
AiChatState
AiChatStub
AiChatTool
Pairs a tool definition with its implementation.
AiConversationItem
InMemoryAiChat
InMemoryAiChatRepo

Extensions

AiChatItemPatterns on AiChatItem
Adds pattern-matching-related methods to AiChatItem.
AiChatStatePatterns on AiChatState
Adds pattern-matching-related methods to AiChatState.
AiChatStateX on AiChatState
AiConversationItemPatterns on AiConversationItem
Adds pattern-matching-related methods to AiConversationItem.
ChatItemX on AiChatItem

Properties

aiChatItemAssistantSeed → AssistantItem
final
aiChatItemContextSeed → ContextItem
final
aiChatItemHistorySummarySeed → HistorySummaryItem
final
aiChatItemUserSeed → UserItem
final
aiChatStateSeed AiChatState
final
aiConversationItemAssistantSeed AiConversationItem
final
aiConversationItemUserSeed AiConversationItem
final

Typedefs

CompactionSetup = ({int compactionTargetChars, int minCharsToCompact, int recentCharsToKeep})

Exceptions / Errors

ToolFailure
Thrown by AiChatTool.run to hand the model a specific reason for failing.
ToolRoundLimitException
The model kept calling tools past AiChat.maxToolRounds. Every round is a billed completion, so the loop is cut rather than left to run away.