text of each record into a numeric vector so that semantically similar content sits close together in vector space. @talosjs/rag generates embeddings through OpenRouter. You pick the model in your vector database, and embedding then happens automatically on add() and search().
Choosing a model
Declare the model ingetEmbeddingModel():
Configuration
Embeddings are generated through OpenRouter, so set your API key in the environment:add() or search(), not at construction time.
How embedding works
You never compute or pass vectors yourself. When a table is created, the schema wires the embedding model into two roles:text is the source field (the column that gets embedded), and vector is where the generated embedding is stored and indexed.
From there:
- On
add(), thetextof each record is sent to the embedding model and the resulting vector is stored on the row. - On
search(), your query string is embedded with the same model and compared against stored vectors.
The embedding model is part of a table’s schema. Changing
getEmbeddingModel() after a table already exists does not re-embed existing rows. Embed new data into a fresh table instead, then switch over.Where embeddings fit
Embeddings power the vector half of retrieval. At query time they are combined with a full-text search over the sametext and merged with an RRF reranker. See Search for how the two halves come together.