Skip to main content

Namespace: ContentStore

ragCore.ContentStore

Interfaces

Type Aliases

DeleteEmbeddedContentArgs

Ƭ DeleteEmbeddedContentArgs: Object

Type declaration

NameTypeDescription
dataSources?string[]The names of the data sources for which to delete embedded content.
inverseDataSources?booleanIf true, delete pages that do NOT match the data sources in the query.
page?PageThe page for which to delete embedded content.

Defined in

mongodb-rag-core/build/contentStore/EmbeddedContent.d.ts:53


DeletePagesArgs

Ƭ DeletePagesArgs: Object

Type declaration

NameTypeDescription
dataSources?string[]The names of the sources to delete pages from.
inverse?booleanIf true, delete pages that do NOT match the query.
permanent?booleanPermanently remove pages from the data store, rather than marking them as "deleted".

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:75


EmbeddedContentStore

Ƭ EmbeddedContentStore: VectorStore<EmbeddedContent> & { close?: () => Promise<void> ; init?: () => Promise<void> ; metadata: { [k: string]: unknown; embeddingName: string } ; deleteEmbeddedContent: (args: DeleteEmbeddedContentArgs) => Promise<void> ; loadEmbeddedContent: (args: { page: Page }) => Promise<EmbeddedContent[]> ; updateEmbeddedContent: (args: { embeddedContent: EmbeddedContent[] ; page: Page }) => Promise<void> }

Data store of the embedded content.

Defined in

mongodb-rag-core/build/contentStore/EmbeddedContent.d.ts:70


LoadPagesArgs

Ƭ LoadPagesArgs<QueryShape>: Object

Type parameters

NameType
QueryShapeunknown

Type declaration

NameTypeDescription
query?QueryShapeA custom query to refine the pages to load.
sources?string[]The names of the sources to load pages from. If undefined, loads available pages from all sources.
updated?DateIf specified, refines the query to load pages with an updated date later or equal to the given date.
urls?string[]If specified, refines the query to only load pages where the url is included in the list.

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:54


MakeMongoDbEmbeddedContentStoreParams

Ƭ MakeMongoDbEmbeddedContentStoreParams: MakeMongoDbDatabaseConnectionParams & { collectionName?: string ; searchIndex: { embeddingName: string ; filters?: { path: string ; type: "filter" }[] ; name?: string ; numDimensions?: number } }

Defined in

mongodb-rag-core/build/contentStore/MongoDbEmbeddedContentStore.d.ts:4


MakeMongoDbPageStoreParams

Ƭ MakeMongoDbPageStoreParams: MakeMongoDbDatabaseConnectionParams & { collectionName?: string }

Defined in

mongodb-rag-core/build/contentStore/MongoDbPageStore.d.ts:14


MongoDbEmbeddedContentStore

Ƭ MongoDbEmbeddedContentStore: EmbeddedContentStore & DatabaseConnection & { metadata: { collectionName: string ; databaseName: string ; embeddingName: string ; embeddingPath: string } ; init: () => Promise<void> }

Defined in

mongodb-rag-core/build/contentStore/MongoDbEmbeddedContentStore.d.ts:40


MongoDbPageStore

Ƭ MongoDbPageStore: DatabaseConnection & Omit<PageStore, "loadPages"> & { metadata: { collectionName: string ; databaseName: string } ; queryType: "mongodb" ; init: () => Promise<void> ; loadPages: (args?: LoadPagesArgs<Filter<PersistedPage>>) => Promise<PersistedPage[]> }

Defined in

mongodb-rag-core/build/contentStore/MongoDbPageStore.d.ts:5


Page

Ƭ Page: Object

Represents a page from a data source.

Type declaration

NameTypeDescription
bodystringThe text of the page.
formatPageFormatThe file format of the page. This format determines how the page should be chunked and vector-embedded.
metadata?PageMetadataArbitrary metadata for page.
sourceNamestringData source name.
title?stringA human-readable title.
urlstring-

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:5


PageAction

Ƭ PageAction: "created" | "updated" | "deleted"

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:40


PageFormat

Ƭ PageFormat: typeof pageFormats[number]

A canonical page format.

Defined in

mongodb-rag-core/build/contentStore/PageFormat.d.ts:15


PageMetadata

Ƭ PageMetadata: Object

Index signature

▪ [k: string]: unknown

Type declaration

NameTypeDescription
page?Record<string, unknown>Page-level metadata. Should not be chunked.
tags?string[]Arbitrary tags.

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:29


PageStore

Ƭ PageStore: Object

Data store for Page objects.

Type declaration

NameTypeDescription
close?() => Promise<void>Close connection to data store.
init?() => Promise<void>Initialize the store.
metadata?{ [k: string]: unknown; }Additional implementation-specific metadata about the store. This metadata is not directly used by the store itself, but may be useful for testing, debugging, and logging.
queryType?"mongodb" | stringThe format that the store uses for custom queries. If not specified, the store does not allow custom queries.
deletePages(args?: DeletePagesArgs) => Promise<void>Deletes pages from the store.
loadPages(args?: LoadPagesArgs<unknown>) => Promise<PersistedPage[]>Loads pages from the Page store.
updatePages(pages: PersistedPage[]) => Promise<void>Updates or adds the given pages in the store.

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:93


PersistedPage

Ƭ PersistedPage: Page & { action: PageAction ; updated: Date }

Represents a Page stored in the database.

Defined in

mongodb-rag-core/build/contentStore/Page.d.ts:44

Variables

pageFormats

Const pageFormats: ("txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript")[]

The list of canonical file formats that we support for pages.

Defined in

mongodb-rag-core/build/contentStore/PageFormat.d.ts:4

Functions

asPageFormat

asPageFormat(str): undefined | "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"

Maps a string to the canonical page format it represents.

Parameters

NameType
strstring

Returns

undefined | "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"

The canonical page format, or undefined if the string is not a recognized page format.

Defined in

mongodb-rag-core/build/contentStore/PageFormat.d.ts:11


getChangedPages

getChangedPages(«destructured»): Promise<{ created: PersistedPage[] ; deleted: PersistedPage[] ; updated: PersistedPage[] }>

Given sets of old and new pages, returns the pages that need to be created, updated, or deleted.

Parameters

NameType
«destructured»Object
› newPagesPage[]
› oldPagesOmit<PersistedPage, "updated">[]
› sourceName?string

Returns

Promise<{ created: PersistedPage[] ; deleted: PersistedPage[] ; updated: PersistedPage[] }>

Defined in

mongodb-rag-core/build/contentStore/getChangedPages.d.ts:6


isPageFormat

isPageFormat(str): str is "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"

Type guard to check if a string is a canonical page format.

Parameters

NameType
strstring

Returns

str is "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"

Defined in

mongodb-rag-core/build/contentStore/PageFormat.d.ts:19


makeMongoDbEmbeddedContentStore

makeMongoDbEmbeddedContentStore(«destructured»): MongoDbEmbeddedContentStore

Parameters

NameType
«destructured»MakeMongoDbEmbeddedContentStoreParams

Returns

MongoDbEmbeddedContentStore

Defined in

mongodb-rag-core/build/contentStore/MongoDbEmbeddedContentStore.d.ts:49


makeMongoDbPageStore

makeMongoDbPageStore(«destructured»): MongoDbPageStore

Data store for Page objects using MongoDB.

Parameters

NameType
«destructured»MakeMongoDbPageStoreParams

Returns

MongoDbPageStore

Defined in

mongodb-rag-core/build/contentStore/MongoDbPageStore.d.ts:24


pageFormat

pageFormat(str, defaultPageFormat?): PageFormat

Converts a string to a canonical page format. If the string is not a recognized page format or a synonym for one, this returns a default page format.

Parameters

NameType
strstring
defaultPageFormat?"txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"

Returns

PageFormat

Defined in

mongodb-rag-core/build/contentStore/PageFormat.d.ts:25


pageIdentity

pageIdentity(«destructured»): Object

Returns a query filter that represents a unique page in the system.

Parameters

NameType
«destructured»Page

Returns

Object

NameType
sourceNamestring
urlstring

Defined in

mongodb-rag-core/build/contentStore/pageIdentity.d.ts:5


persistPages

persistPages(«destructured»): Promise<void>

Persists pages that have changed.

Parameters

NameType
«destructured»Object
› pagesPage[]
› sourceNamestring
› storePageStore

Returns

Promise<void>

Defined in

mongodb-rag-core/build/contentStore/updatePages.d.ts:21


updateEmbeddedContent

updateEmbeddedContent(«destructured»): Promise<void>

(Re-)embeddedContent the pages in the page store that have changed since the given date and stores the embeddedContent in the embeddedContent store.

Parameters

NameType
«destructured»Object
› chunkOptions?Partial<ChunkOptions>
› concurrencyOptions?EmbedConcurrencyOptions
› embeddedContentStoreEmbeddedContentStore
› embedderEmbedder
› pageStorePageStore
› sinceDate
› sourceNames?string[]

Returns

Promise<void>

Defined in

mongodb-rag-core/build/contentStore/updateEmbeddedContent.d.ts:20


updateEmbeddedContentForPage

updateEmbeddedContentForPage(«destructured»): Promise<void>

Parameters

NameType
«destructured»Object
› chunkOptions?Partial<ChunkOptions>
› concurrencyOptions?EmbedConcurrencyOptions
› embedderEmbedder
› pagePersistedPage
› storeEmbeddedContentStore

Returns

Promise<void>

Defined in

mongodb-rag-core/build/contentStore/updateEmbeddedContent.d.ts:29


updatePages

updatePages(«destructured»): Promise<void>

Fetches pages from data sources and stores those that have changed in the data store.

Parameters

NameType
«destructured»Object
› concurrencyOptions?PageConcurrencyOptions
› pageStorePageStore
› sourcesDataSource[]

Returns

Promise<void>

Defined in

mongodb-rag-core/build/contentStore/updatePages.d.ts:13