DocuTray

Knowledge Base Types

TypeScript types for knowledge bases in the Docutray Node.js SDK — KnowledgeBase, documents, and semantic-search result models with fields and enums.

These are the TypeScript models returned and accepted by the knowledge-base methods of the Docutray Node.js SDK. A knowledge base stores documents with vector embeddings so you can run semantic search over them — see the Knowledge Bases operation guide for the end-to-end workflow and runnable examples. Every type below is exported from the package, so you can import it directly for fully typed request and response handling:

import type { KnowledgeBase, SearchResult } from 'docutray';

All list endpoints return the PaginatedResponse wrapper described in the shared types, and every method can throw the typed errors documented in Errors.

KnowledgeBase

A knowledge base definition as returned by the API — its id, name, description, schema and indexing settings. _count.documents carries the document count on list() and get(); create() and update() do not send it.

Prop

Type

KnowledgeBaseDocument

A single document stored inside a knowledge base, with its content, metadata and embedding status. You address it by its documentId, the identifier you choose when creating it, not by its internal id.

Prop

Type

EmbeddingStatus

Embedding generation status of a knowledge base document.

type EmbeddingStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'ERROR';

SearchResultItem

One match from a semantic-search query, pairing the matched document chunk with a similarity score. Higher scores indicate a closer semantic match to the query.

Prop

Type

SearchResult

The full response from a knowledge-base query — the ordered list of SearchResultItem matches plus query metadata. Returned by client.knowledgeBases.search().

Prop

Type

SyncResult

The outcome of a knowledge-base sync operation, reporting how many documents were processed and how many embeddings were generated. Use it to confirm a re-index completed before relying on fresh search results.

Prop

Type

Parameters

Request parameters of the knowledge-base methods.

KnowledgeBaseListParams

Parameters of list().

Prop

Type

KnowledgeBaseCreateParams

Parameters of create(). name, description and schema are required.

Prop

Type

KnowledgeBaseUpdateParams

Parameters of update(). isActive: true restores a deleted knowledge base.

Prop

Type

KnowledgeBaseSearchParams

Parameters of search().

Prop

Type

KnowledgeBaseSyncParams

Parameters of sync().

Prop

Type

KBDocumentListParams

Parameters of documents(kbId).list().

Prop

Type

KBDocumentCreateParams

Parameters of documents(kbId).create(). documentId is required.

Prop

Type

KBDocumentUpdateParams

Parameters of documents(kbId).update().

Prop

Type

On this page