Method
storeFunction
({
directory,
splitDocs,
}: {
directory?: string;
splitDocs: Document[];
})
Source from the content-addressed store, hash-verified
| 183 | |
| 184 | @measure |
| 185 | private static async storeFunction({ |
| 186 | directory, |
| 187 | splitDocs, |
| 188 | }: { |
| 189 | directory?: string; |
| 190 | splitDocs: Document[]; |
| 191 | }) { |
| 192 | const vectorStore = await FaissStore.fromDocuments( |
| 193 | splitDocs, |
| 194 | embeddingsModel |
| 195 | ); |
| 196 | if (!!directory && fs.existsSync(directory)) { |
| 197 | const loadedVectorStore = await FaissStore.load( |
| 198 | directory, |
| 199 | embeddingsModel |
| 200 | ); |
| 201 | await vectorStore.mergeFrom(loadedVectorStore); |
| 202 | } |
| 203 | return vectorStore; |
| 204 | } |
| 205 | |
| 206 | @measure |
| 207 | private static async splitDocuments( |
Tested by
no test coverage detected