Class: LoadableLangchainCorpus<DocumentMetadata, ChunkMetadata>
batteries/docs.LoadableLangchainCorpus
A LoadableCorpus backed by a LangChain VectorStore.
Type parameters
Name | Type |
---|---|
DocumentMetadata | extends Jsonifiable = Jsonifiable |
ChunkMetadata | extends Jsonifiable & Record <string , any > = Record <string , any > |
Hierarchy
BaseLoadableCorpus
<DocumentMetadata
,ChunkMetadata
>↳
LoadableLangchainCorpus
Constructors
constructor
• new LoadableLangchainCorpus<DocumentMetadata
, ChunkMetadata
>(vectorstore
, loader
, chunker
)
Type parameters
Name | Type |
---|---|
DocumentMetadata | extends Jsonifiable = Jsonifiable |
ChunkMetadata | extends Object = Record <string , any > |
Parameters
Name | Type |
---|---|
vectorstore | VectorStore |
loader | Loader <DocumentMetadata > |
chunker | Chunker <DocumentMetadata , ChunkMetadata > |
Overrides
BaseLoadableCorpus<DocumentMetadata, ChunkMetadata\>.constructor
Defined in
ai-jsx/src/batteries/docs.tsx:715
Properties
chunkConsumer
• Readonly
chunkConsumer: (chunks
: EmbeddedChunk
<ChunkMetadata
>[]) => Promise
<void
>
Type declaration
▸ (chunks
): Promise
<void
>
Parameters
Name | Type |
---|---|
chunks | EmbeddedChunk <ChunkMetadata >[] |
Returns
Promise
<void
>
Inherited from
BaseLoadableCorpus.chunkConsumer
Defined in
ai-jsx/src/batteries/docs.tsx:469
chunker
• Readonly
chunker: Chunker
<DocumentMetadata
, ChunkMetadata
>
Defined in
ai-jsx/src/batteries/docs.tsx:718
loader
• Readonly
loader: Loader
<DocumentMetadata
>
Inherited from
BaseLoadableCorpus.loader
Defined in
ai-jsx/src/batteries/docs.tsx:717
vectorizer
• Readonly
vectorizer: Vectorizer
<DocumentMetadata
, ChunkMetadata
>
Inherited from
BaseLoadableCorpus.vectorizer
Defined in
ai-jsx/src/batteries/docs.tsx:468
vectorstore
• Readonly
vectorstore: VectorStore
Defined in
ai-jsx/src/batteries/docs.tsx:716
Methods
getStats
▸ getStats(): CorpusStats
Reveals statistics about this corpus, including its LoadingState.
Returns
Inherited from
BaseLoadableCorpus.getStats
Defined in
ai-jsx/src/batteries/docs.tsx:500
load
▸ load(): Promise
<CorpusStats
>
Loads documents into the corpus using a Loader, Chunker, and Embedding. If the returned promise resolves succesfully, the corpus will be in COMPLETED state. If it rejects, the corpus may be in FAILED state.
Note: Corpus loading may be quite time consuming. It's best to ensure loading is done prior to exposing this corpus to your users.
Note: This method is idempotent. Calling it multiple times will not result in multiple loads.
Returns
Promise
<CorpusStats
>
Inherited from
BaseLoadableCorpus.load
Defined in
ai-jsx/src/batteries/docs.tsx:482
search
▸ search(query
, params?
): Promise
<ScoredChunk
<ChunkMetadata
>[]>
Parameters
Name | Type |
---|---|
query | string |
params? | Object |
params.limit? | number |
params.score_threshold? | number |
Returns
Promise
<ScoredChunk
<ChunkMetadata
>[]>
Overrides
BaseLoadableCorpus.search
Defined in
ai-jsx/src/batteries/docs.tsx:732
checkReady
▸ Protected
checkReady(): void
Returns
void
Inherited from
BaseLoadableCorpus.checkReady