UNPKG

jorel

Version:

A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.

52 lines (51 loc) 1.63 kB
import { CreateLlmDocument, LlmDocument } from "./document"; type DocumentToTextTemplate = "xml" | "json" | { template: string; separator: string; }; interface LlmDocumentCollectionConfig { documentToText?: DocumentToTextTemplate; } /** * A collection of LLM documents, like a binder or folder of documents * that can be used for grounding LLM generations (either directly or passed to agents). * * Also provides a system message representation of the documents */ export declare class LlmDocumentCollection { documentToTextTemplate: DocumentToTextTemplate; constructor(documents?: (LlmDocument | CreateLlmDocument)[], config?: LlmDocumentCollectionConfig); /** * The number of documents in the collection */ get length(): number; /** * Get all documents in the collection (as a copy) */ get all(): LlmDocument[]; /** * Get the definition of all documents in the collection (e.g. for serialization) */ get definition(): import("./document").LlmDocumentDefinition[]; /** * Get a system message representation of the documents */ get systemMessageRepresentation(): string; /** * Create a new collection from a JSON representation */ static fromJSON(documents?: (LlmDocument | CreateLlmDocument)[]): LlmDocumentCollection; /** * Add a document to the collection */ add(document: LlmDocument): void; /** * Remove a document from the collection */ remove(id: string): void; /** * Get a document by its ID */ get(id: string): LlmDocument | undefined; } export {};