ObjectStackObjectStack

Knowledge Source

Knowledge Source protocol schemas

Knowledge Source — declarative metadata describing what to index and

which adapter to use.

A KnowledgeSource is the metadata-level equivalent of an

IDataEngine driver binding: it pairs a logical source description

(object/file/http) with the id of an IKnowledgeAdapter plugin

that will actually do the work. The adapter resolves the id at

runtime via IKnowledgeService.registerAdapter.

See content/docs/protocol/knowledge.mdx for the full design.

Source: packages/spec/src/ai/knowledge-source.zod.ts

TypeScript Usage

import { FileKnowledgeSource, HttpKnowledgeSource, KnowledgeRefreshPolicy, KnowledgeSource, KnowledgeSourceKind, ObjectKnowledgeSource } from '@objectstack/spec/ai';
import type { FileKnowledgeSource, HttpKnowledgeSource, KnowledgeRefreshPolicy, KnowledgeSource, KnowledgeSourceKind, ObjectKnowledgeSource } from '@objectstack/spec/ai';

// Validate data
const result = FileKnowledgeSource.parse(data);

FileKnowledgeSource

Properties

PropertyTypeRequiredDescription
kindstring
prefixstringStorage prefix
mimeTypesstring[]optional

HttpKnowledgeSource

Properties

PropertyTypeRequiredDescription
kindstring
urlsstring[]
userAgentstringoptional

KnowledgeRefreshPolicy

Properties

PropertyTypeRequiredDescription
onRecordChangebooleanoptional
cronstringoptional

KnowledgeSource

Properties

PropertyTypeRequiredDescription
idstringSnake_case source id
labelstring
descriptionstringoptional
adapterstringAdapter id
adapterConfigRecord<string, any>optional
sourceObject | Object | Object
embeddingObjectoptional
vectorStoreObjectoptional
refreshObjectoptional
aiExposedbooleanoptional

KnowledgeSourceKind

Union Options

This schema accepts one of the following structures:

Option 1

Properties

PropertyTypeRequiredDescription
kindstring
objectstringShort object name to index
contentFieldsstring[]Fields contributing to document content
metadataFieldsstring[]optional
whereRecord<string, any>optional

Option 2

Properties

PropertyTypeRequiredDescription
kindstring
prefixstringStorage prefix
mimeTypesstring[]optional

Option 3

Properties

PropertyTypeRequiredDescription
kindstring
urlsstring[]
userAgentstringoptional


ObjectKnowledgeSource

Properties

PropertyTypeRequiredDescription
kindstring
objectstringShort object name to index
contentFieldsstring[]Fields contributing to document content
metadataFieldsstring[]optional
whereRecord<string, any>optional

On this page