Knowledge Base
A knowledge base is a batteries included RAG system that you can create and insert data into, as well as query as if it was a table.
Internally, it uses a vector store and an embedding model, by default it uses chroma and it will pick a suitable embedding model for the task, however, you can specify each of these if you want.
Here is a general syntax for creating a knowledge base:
Step by step guide
Here is how you build a KNOWLEDGE BASE and specifying the embedding model and the vector store you want:
Create the embedding model
Connect the vector store
In this example, there is a table called world_news_with_ids that contains columns (id, content)
Now, we can create an index in the vector store, and insert one example point:
Let’s see what we have in the vector store:
Glue it all together
Now, we can connect the embedding model and the vector index into one knowledge base:
This is how we add content into the vector store every few seconds if there is new data:
Note: the query has a id > LAST. This allows the job, to only select new data every time it runs.