Represents a Hashbrown chat instance, providing methods to send and observe messages, track state, and handle errors.
@template Output - The type of messages received from the LLM, either a string or structured output defined by HashbrownType. @template Tools - The set of tools available to the chat instance.
API
interface Hashbrown<Output, Tools extends Chat.AnyTool> {
error: StateSignal <
Error | undefined
>;
exhaustedRetries: StateSignal <boolean>;
isLoading: StateSignal <boolean>;
isReceiving: StateSignal <boolean>;
isRunningToolCalls: StateSignal <boolean>;
isSending: StateSignal <boolean>;
lastAssistantMessage: StateSignal <
Chat.AssistantMessage <Output, Tools> | undefined
>;
messages: StateSignal <
Chat.Message <Output, Tools>[]
>;
resendMessages: () => void;
sendMessage: (message: Chat.Message<Output, Tools>) => void;
setMessages: (messages: Chat.Message<Output, Tools>[]) => void;
sizzle: () => () => void;
stop: (clearStreamingMessage?: boolean) => void;
updateOptions: (options: Partial<{
debugName?: string;
apiUrl: string;
model: KnownModelIds;
system: string;
tools: Tools[];
responseSchema: s.HashbrownType;
middleware: Chat.Middleware[];
emulateStructuredOutput: boolean;
debounce: number;
retries: number;
}>) => void;
}
Hashbrown
@type
Output
@type
Tools
Chat.AnyTool