It would be beneficial if the embeddings could be exposed as a interface that is passed in... something like this.
interface Embedder {
async embedTexts(texts: string[]): Promise<number[][]>
}
This would keep vector storage complexity to a minimum by removing embedTexts, embedTextsFn and all associated logic, and put it behind an interface so its trivial to extend and add custom embedding APIs.
import { VectorStorage, OpenAIEmbeddings } from "vector-storage";
// create embeddings instance
const embedder = new OpenAIEmbeddings("your-openai-api-key");
// Create an instance of VectorStorage
const vectorStore = new VectorStorage(embedder);
// Add a text document to the store
await vectorStore.addText("The quick brown fox jumps over the lazy dog.", {
category: "example",
});
It would be beneficial if the embeddings could be exposed as a interface that is passed in... something like this.
This would keep vector storage complexity to a minimum by removing
embedTexts,embedTextsFnand all associated logic, and put it behind an interface so its trivial to extend and add custom embedding APIs.