ActiveContext: use search_embedding_version during search
What does this MR do and why?
Part 3 of 4 of #534318 (closed):
- !187724 (merged): add migration helper for updating collection metadata
-
!188535 (merged): use
indexing_embedding_versionsto generate embeddings during indexing -
This MR: use
search_embedding_versionduring searching - !188560 (merged): update docs to show how to use this workflow to manage embedding models
This MR:
- Allows using a
knnquery as either- Using the automatic embedding model and field by passing
contentonly:ActiveContext::Query.knn(content: "Your content here", limit: 5) - Passing
target,vectorto override:ActiveContext::Query.knn(target: "embeddings_1", vector: [0.1, 0.2, 0.3], limit: 5)
- Using the automatic embedding model and field by passing
- Pass
usertoProcessor- we need the user in order to track usage for embedding generation - Updates processors to prefer
targetandvectoror fallback tocontentand generating embeddings.
References
See https://gitlab.com/gitlab-org/gitlab/-/blob/144ec77cd48f682118dbb05417bf688a17d79017/gems/gitlab-active-context/doc/how_to.md for how the workflow will work.
How to set up and validate locally
- Run through steps in https://gitlab.com/gitlab-org/gitlab/-/blob/144ec77cd48f682118dbb05417bf688a17d79017/gems/gitlab-active-context/doc/how_to.md#set-embedding-model
- Enqueue and execute some docs and note that they use the embedding model specified (tail AIGW logs) and stores it on the correct field.
- Execute a search:
ActiveContext::Query.knn(content: "Your content here", limit: 5)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #534318 (closed)
Edited by Madelein van Niekerk