NEWCKEditor AI on your premises: Hook your LLM and register MCP tools. Webinar coming soon!
Sign up (with export icon)

AIContextResource

Api-typedef icontypedef

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'
	}
}
Copy code

Properties

  • Chevron-right icon

    data : string | File | AIContextTextResource | undefined

    The 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 optional getData callback from the parent AIContextProvider when the resource is selected by the user.

    Note: For the 'text' resource type, data should be in the AIContextTextResource format.

  • Chevron-right icon

    id : string

    The unique identifier of the resource.

  • Chevron-right icon

    label : string

    The human-readable name of the resource.

  • Chevron-right icon

    type : AIContextItemType

    The type of the resource.

Value

object