HelmetH
Convex Community3y ago
8 replies
Helmet

How do vectorstores work on Convex with Langchain?

I am making a chatbot of sorts with retrieval QA on langchain using Convex's vectorstore. I'm storing documents embedded in Convex, but wondering how I can access multiple vectorstores by name? Currently in schema.ts, I have a basic schema example for a simple vector db.

export default defineSchema({
  documents: defineTable({
    embedding: v.array(v.number()),
    text: v.string(),
    metadata: v.any(),
  }).vectorIndex("byEmbedding", {
    vectorField: "embedding",
    dimensions: 1536,
  })
},
{
    strictTableNameTypes: false,
});


I'm wondering how I can make more vector dbs than just one named "documents", ie, for multiple users where each user might have their own vectdb with their name. Currently accessing the vector db in langchain through new ConvexVectorStore(new OpenAIEmbeddings({ openAIApiKey: secretKey }), { ctx });, and I don't see anywhere to pass in string names of the vector db to use or if I wanted to create a new vector db with a specific name. Curious how I might be able to achieve this?
Was this page helpful?