our friendly logo that looks like a hashbrown character from an animated tv showhashbrown

@hashbrownai/reactuseStructuredCompletion

This React hook creates a completion instance that predicts structured data based on input context. The result object contains the predicted structured output and state for monitoring the completion.

The useStructuredCompletion hook provides functionality for predicting structured data based on input context. This is particularly useful for: - Smart form field suggestions - Context-aware recommendations - Predictive UI generation - Intelligent defaults

useStructuredCompletion: <Schema extends s.HashbrownType, Tools extends Chat.AnyTool>(options: UseStructuredCompletionOptions<Schema, Tools>) => UseStructuredCompletionResult<s.Infer<Schema>>
@paramoptions
UseStructuredCompletionOptions<Schema, Tools>
@typeSchema
s.HashbrownType
@typeTools
Chat.AnyTool
@returns
{UseStructuredCompletionResult} An object containing the predicted structured output and completion state.
UseStructuredCompletionResult<s.Infer<Schema>>

Examples

In this example, the LLM will predict a color palette based on a given theme or mood.

const { output } = useStructuredCompletion({
  model: 'gpt-4o',
  system: `Predict a color palette based on the given mood or theme. For example,
  if the theme is "Calm Ocean", suggest appropriate colors.`,
  input: theme,
  schema: s.object('Color Palette', {
    colors: s.array(
      'The colors in the palette',
      s.string('Hex color code')
    )
  })
});

LiveLoveApp provides secure, compliant, and reliable long-term support to enterprises. We are a group of engineers who are passionate about open source.

Enterprise Support

AI Engineering Sprint

Get your team up-to-speed on AI engineering with a one week AI engineering sprint. Includes a workshop on AI engineering with hashbrown and a few days with the hashbrown developer team to bring your AI ideas to life.

Long Term Support

Keep your hashbrown deployments running at peak performance with our Long Term Support. Includes an ongoing support retainer for direct access to the hashbrown developer team, SLA-backed issue resolution, and guided upgrades.

Consulting

LiveLoveApp provides hands-on engagement with our AI engineers for architecture reviews, custom integrations, proof-of-concept builds, performance tuning, and expert guidance on best practices.