hashbrown

useCompletion

This React hook creates a change instance used to interact with the LLM. The result object contains functions and state enabling you to send and recieve messages and monitor the state of the chat.

API

export declare function useCompletion<Input>(
  options:  UseCompletionOptions <Input>,
):  UseCompletionResult; 
useCompletion
UseCompletionResult
@paramoptions:
UseCompletionOptions<Input>
@typeInput
@returns
UseCompletionResult

Examples

const { output } = useCompletion({
  model: 'gpt-4o-mini',
  input: firstName,
  system: `Help the user generate a last name for the given first name.`,
});