Files
langchainjs/docs/docs/modules/indexes/vectorstore.md
T
Nuno Campos 8035633874 Add CI job (and make it green) (#42)
* Add CI job

* Add ci script

* Run format in examples package

* Format docs

* Fix eslint config in langchain

* Add ci command

* Separate unit and integration tests

* Fix ci command

* Make path relative, adjust node version

* Add os matrix

* Set eol to lf

* Do not cache CI command

* Try to fix loadFromHub on windows

* Update CONTRIBUTING for unit/int tests
2023-02-18 16:03:29 -08:00

554 B

Vectorstores

A vectorstore is a particular type of database optimized for storing documents, embeddings, and then allowing for fetching of the most relevant documents for a particular query.

import { HNSWLib } from "langchain/vectorstores";
import { OpenAIEmbeddings } from "langchain/embeddings";

const vectorStore = await HNSWLib.fromTexts(
  ["Hello world", "Bye bye", "hello nice world"],
  [{ id: 2 }, { id: 1 }, { id: 3 }],
  new OpenAIEmbeddings()
);

const resultOne = await vectorStore.similaritySearch("hello world", 1);