AIContextResource
An individual resource item within a AIContextProvider.
Represents a single selectable item in the resources list displayed when a user clicks on a custom context menu option. The label is displayed to the user as the resource name, and the type indicates what kind of context item this represents (file, document, or URL).
When selected, the resource will be attached to the AI prompt to provide additional context for generating responses. If the data property is provided, it contains the content of the resource. If data is undefined, the content will be retrieved using the getData callback from the parent AIContextProvider when the resource is selected by the user.
{
id: 'user-guide-intro',
type: 'text',
label: 'User Guide - Introduction',
data: {
content: '<p>Lorem ipsum dolor sit amet...</p>',
type: 'html'
}
}
Properties
data : string | File | AIContextTextResource | undefinedmodule:ai/aichat/model/aichatcontext~AIContextResource#dataThe content of the resource.
Note: When
undefined, for instance, because the resource content is large and obtaining it should be done on demand, the content will be retrieved using the optionalgetDatacallback from the parentAIContextProviderwhen the resource is selected by the user.Note: For the
'text'resource type,datashould be in theAIContextTextResourceformat.id : stringmodule:ai/aichat/model/aichatcontext~AIContextResource#idThe unique identifier of the resource.
label : stringmodule:ai/aichat/model/aichatcontext~AIContextResource#labelThe human-readable name of the resource.
type : AIContextItemTypemodule:ai/aichat/model/aichatcontext~AIContextResource#typeThe type of the resource.
Value
object