hashbrown

Hashbrown

Represents a Hashbrown chat instance, providing methods to send and observe messages, track state, and handle errors.

API

Hashbrown
@typeOutput
@typeTools
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

Resend messages and update state. Often used manually after an error.

sendMessage
(message: Chat.Message<Output, Tools>) => void

Send a new message to the LLM and update state.

setMessages
(messages: Chat.Message<Output, Tools>[]) => void

Replace the current set of messages in the chat state.

sizzle
() => () => void

Start the Hashbrown effect loop.

stop
(clearStreamingMessage?: boolean) => void

Stop the current LLM interaction.

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

Update the chat options after initialization