This type defines the configuration for a component to be exposed to the chat.
API
interface ExposedComponent<T extends ComponentType<any>> {children?: 'any' | 'text' | ExposedComponent<any>[] | false;component: T;description: string;name: string;props?: ComponentPropSchema<T>;}ExposedComponent
@typeTComponentType<any>children
'any' | 'text' | ExposedComponent<any>[] | falseThe children of the component.
component
TThe component to be exposed.
description
stringThe description of the component. This is also used by the LLM to understand when to use the component.
name
stringThe name of the component.
props
ComponentPropSchema<T>The schema describing the props for this component.
Examples
exposeComponent(CardComponent, {
name: 'CardComponent',
description: 'Show a card with children components to the user',
children: 'any',
props: {
title: s.string('The title of the card'),
description: s.streaming.string('The description of the card'),
},
});