Files
template-app/modules/knowledge/contract/constants.ts
T

37 lines
1.6 KiB
TypeScript

// The constants of the knowledge module: its feature flag, jobs, events, audit actions and the
// indexable content types.
/** The module flag: knowledge retrieval and indexing, off until an administrator enables it. */
export const KNOWLEDGE_FLAG = "knowledge.enabled"
export const KNOWLEDGE_FLAG_DEFAULTS = {
[KNOWLEDGE_FLAG]: false,
} as const
/** The worker job that indexes one document's chunks into the vector store. */
export const INDEX_JOB = "knowledge.index"
/** The worker job that removes one document's chunks from the vector store. */
export const REMOVE_JOB = "knowledge.remove"
export const COLLECTION_CREATED = "knowledge.collection.created"
export const DOCUMENT_INDEX_REQUESTED = "knowledge.document.index_requested"
export const DOCUMENT_REMOVE_REQUESTED = "knowledge.document.remove_requested"
export const DOCUMENT_AI_ENABLED = "knowledge.settings.document_ai_enabled"
export const DOCUMENT_AI_DISABLED = "knowledge.settings.document_ai_disabled"
/**
* What the indexer reads as text. PDFs and scans are the documents module's worked example; this
* module indexes text-shaped files, and refuses anything else at the door with a named field.
*/
export const INDEXABLE_CONTENT_TYPES = ["text/plain", "text/markdown", "application/json", "text/csv"] as const
/** A search query's ceiling; a retrieval question is a sentence, not a document. */
export const MAX_QUERY_LENGTH = 500
/** What one search returns at most, however much the caller asks (the retrieval limit contract). */
export const MAX_SEARCH_RESULTS = 25
/** An indexed file's ceiling: one megabyte of text is already far past useful chunking. */
export const MAX_INDEX_BYTES = 1_048_576