import { Chat, type ModelInput, SystemPrompt, type TransportOrFactory } from '@hashbrownai/core'; import { Dispatch, ReactElement, SetStateAction } from 'react'; import { ExposedComponent } from '../expose-component.fn'; import { UiAssistantMessage, UiChatSchema } from './use-ui-chat'; import { type UiKitInput } from './use-ui-kit'; import { type UseStructuredCompletionResult } from './use-structured-completion'; /** * Options for the `useUiCompletion` hook. * * @public */ export interface UiCompletionOptions { /** * The input for the completion. */ input: Input | null | undefined; /** * The model to use for the completion. */ model: ModelInput; /** * The system prompt to use for the completion. */ system: string | SystemPrompt; /** * The components that can be rendered by the completion. */ components: UiKitInput>[]; /** * Optional prompt-based UI examples to include in the wrapper schema description. */ examples?: SystemPrompt; /** * The tools to make available to the completion. */ tools?: Tools[]; /** * The debounce time between requests. */ debounceTime?: number; /** * The name of the hook, useful for debugging. */ debugName?: string; /** * Number of retries if an error is received. */ retries?: number; /** * Optional transport override for this hook. */ transport?: TransportOrFactory; /** * Controls how the provider is asked to produce structured output. */ structuredOutput?: Chat.Api.StructuredOutputOptions; /** * Optional thread identifier used to load or continue an existing conversation. */ threadId?: string; } /** * The result of the `useUiCompletion` hook. * * @public */ export interface UseUiCompletionResult extends Omit, 'output'> { /** * The assistant message that contains the rendered UI elements. */ output: UiAssistantMessage | null; /** * The rendered React elements produced by the completion. */ ui: ReactElement[] | null; /** * The raw structured output returned by the model before rendering components. */ rawOutput: UiChatSchema | null; /** * Updates the available components for future completions. */ setComponents: Dispatch>[]>>; } /** * A React hook that generates UI completions using the provided component set. * * @public */ export declare const useUiCompletion: (options: UiCompletionOptions) => UseUiCompletionResult; //# sourceMappingURL=use-ui-completion.d.ts.map