Intro
Over the past months, we at Neum AI, have been working on a Retrieval Augmented Generation platform to help developers bring up-to-date context into AI applications. Recently we open sourced our framework (https://github.com/NeumTry/NeumAI) and released our first python sdk.
Retrieval Augmented Generation, or RAG, helps finding data quickly by performing search in a “natural way” and use that information/knowledge to power a more accurate AI application that needs such information! It is a recent methodology employed by lots of people when building accurate and up-to-date AI applications!
In this blog post we will dive deep on how Neum offers integration with Supabase for both Postgres and Storage connectors, as well as real-time synchronization of vector embeddings to power your RAG pipelines and AI applications.
Supabase storage
Supabase Storage is one of the connectors that Neum offers out of the box. By simply specifying the connection configuration, we can create a pipeline that will read data from Supabase Storage, embed it with OpenAI embeddings and finally store it in a vector database, in this case we will showcase the integration with Supabase as our sink (a Postgres table leveraging pgvector). More details in our docs
Make sure to substitute the empty strings for your configurations!
When running this locally you will be able to check data that was stored in Supabase Storage (blob) and search it semantically.
If you want to deploy this pipeline after you’ve tested it just simply run:
This will deploy the pipeline to our cloud and you will be able to log in to https://dashboard.neum.ai and take a look at the status and search!
Supabase postgres
In addition to connecting to Supabase Storage, you can also connect to a hosted Postgres table (in this case we will leverage one we have in Supabase) and create a Pipeline configuration similar to the one we had above.
Because this scenario involves structured data most likely, you can also specify the types of columns that are particular useful to embed and those that are important to store as metadata as part of the vectors.
Similar to above, you can run and search the pipeline either locally or deploy it to our cloud offering.
All of this is great, and the framework is easy-to-use for everyone to jump right in and try it. But, as you move into production-like applications, chances are that you will need to embed and index real-time data. Supabase allows you to listen for events of a particular table and with Neum you can enable real-time in your pipeline seamlessly! Without this, you would need to re embed and rerun pipelines every time new data is added to a table.
Real-time support
Real-time vector synchronization is essential to have up-to-date context in your AI applications. With Supabase’s Real-time Postgres events, you can listen to insertions, deletions and updates in a given table. Having this data constantly flowing, being vectorized, and stored in your vector database is crucial to ensure effective Retrieval Augmented Generation as it is a great guarantee that recent data will be available to the prompt at all times.
💡 Real-time support is only available through our cloud offering, and so for this, we will show how to enable it for a Postgres table hosted via Supabase.
Enabling real-time vector syncing with Postgres on Supabase is as easy as three steps
- Enable your desired table in Supabase for real-time support (link)
- Create a Neum pipeline (either through SDK or Dashboard) - Serves also as a way to validate connections and make sure you can see some data flowing first
- Enable Realtime in Neum dashboard - This will tell Neum to listen for events coming from Supabase for the desired table and have new data embedded and stored in your vector database chosen in #2
Conclusion
As we can see, the process of loading, vectorizing and indexing data for Retrieval Augmented Generation is trivial to do with Neum. Integrations with Supabase Storage and Postgres on Supabase make a delightful experience for anyone building production-grade applications that depend on real-time events.
At Neum, we focus on ensuring your data is always indexed and in the correct way to let you focus on your end user’s needs!
As always, reach out to founders@tryneum.com if interested in chatting more about this topic or if you’d like to give this a try!
Take a look at our other blog posts here