AiChat class

instructions and _summaryInstructions are evaluated pre every request

Implementers

Constructors

AiChat({required String chatId, required String userId, required AiCompletions aiCompletions, required AiCompletions summaryCompletions, required ExtendedLogger logger, required String instructions(), String summaryInstructions()?, CompactionSetup compactionSetup = defaultCompactionSetup, required AiChatRepo repo, required StateStore store, bool isTimeAware = true, Duration contextGroupGap = const Duration(minutes: 5)})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startedStream Stream<AiChatState>
no setter
state AiChatState
no setter
stream Stream<AiChatState>
no setter

Methods

addContext({required String text}) → void
Added to conversation as a <context> -tagged user message.
addTurnManually({required String? prompt, required String? answer}) Future<void>
clear() Future<void>
createAiRequest({required String prompt, Map<String, dynamic>? responseFormat, AiToolChoice toolChoice = const AiToolChoice.auto(), bool verbatim = false}) → AiRequest
dispose() → void
disposeAndClearLocalStorage() → void
getResponse({required String prompt, Map<String, dynamic>? responseFormat, bool recordTurn = true, AiToolChoice toolChoice = const AiToolChoice.auto(), bool verbatim = false}) Future<String>
recordTurn false answers from history without extending it: the prompt still shapes this response, but neither it nor the answer is stored.
getStructuredResponse<T>({required String prompt, required Map<String, dynamic> responseFormat, required T fromJson(Map<String, dynamic> json), bool recordTurn = true, AiToolChoice toolChoice = const AiToolChoice.auto()}) Future<T>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
streamResponse({required String prompt, bool recordTurn = true, AiToolChoice toolChoice = const AiToolChoice.auto(), bool verbatim = false}) Stream<String>
recordTurn false answers from history without extending it: the prompt still shapes this response, but neither it nor the answer is stored.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited