W
Wasp•8mo ago
Zuck

Anyone got RAG working with WASP?

My current approach is to use langchains build in vector storage but i want the vector data to be stored in Postgre database that WASP makes. - crappy coder that uses AI to code religiously
6 Replies
kapa.ai
kapa.ai•8mo ago
Hi @Jacob Ferrari. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, there isn't a specific example of using RAG (Retrieval-Augmented Generation) with Wasp. However, there is a discussion on using Wasp with ChatGPT embeddings (pgvector) which might be similar to what you're trying to achieve. In this Github issue (https://github.com/wasp-lang/wasp/issues/1215), a user mentioned using pgvector (https://github.com/pgvector/pgvector) to add vector embeddings to a Postgres database. Since Wasp's Prisma won't be able to interact with the vector field created by pgvector, you'll need to use Prisma's queryRaw for all your CRUD operations for that field. Here are some code snippets provided by the user: - Function to get an embedding from OpenAI API: link (https://github.com/maksim36ua/feedback_hub/blob/main/src/server/services/apiService.ts#LL34C23-L34C23) - How to save your vector into the database: link (https://github.com/maksim36ua/feedback_hub/blob/main/src/server/actions/saveReducedFeedback.ts#L9) - How to perform SQL queries with the vectors in the database: link (https://github.com/maksim36ua/feedback_hub/blob/main/src/server/actions/getFeedbackSimilarities.ts#L17) Please note that vector data types are not currently supported by Prisma, so you'll have to use raw Prisma Queries with prismaClient.$queryRaw instead of Prisma's built-in methods. For more information on how Wasp interacts with databases, you can check out the official documentation (https://wasp-lang.dev/docs/data-model/backends). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Jacob Ferrari, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Zuck
ZuckOP•8mo ago
Prisma | 🦜️🔗 Langchain
For augmenting existing models in PostgreSQL database with vector search, Langchain supports using Prisma together with PostgreSQL and pgvector Postgres extension.
miho
miho•8mo ago
Here's an example app with PG Vector 🙂 https://github.com/wasp-lang/ask-the-documents
GitHub
GitHub - wasp-lang/ask-the-documents: Ask The Documents (Embeddings...
Ask The Documents (Embeddings / ChatGPT) with Wasp & PG Vector - wasp-lang/ask-the-documents
Zuck
ZuckOP•8mo ago
yaaaaayy thank you!
howcaniexplain
howcaniexplain•6mo ago
How has your experience so far using PG Vector with WASP been? I'm working on something similar and wondering if PG Vector is the best move, or if you've had success with something else.
Zuck
ZuckOP•6mo ago
I ended up useing Pinecone for my vector database needs. It felt like a pain (for me atleast) to muck around with the Postgres database. I rely heavily on AI to help write my code and found Claude 3.5 had a ton of knowledge on Pinecone, and I used Pinecone a looong time ago (lol like a year ago) and so thought it was the best choice and it’s flexible. If I could I would have just used open ai Assistant API though
Want results from more Discord servers?
Add your server