Loading
Update the test embedding model service
What does this MR do and why?
We expect the embedding model testing to always be invoked by a user, so the TestEmbeddingModelService should require a user.
Additionally, we need a way to test the /v1/embeddings/code_embeddings/search endpoint, so TestEmbeddingModelService now accepts an optional boolean search parameter. This currently is not used in production, but rather used locally to test requests to the search endpoint coming from Rails.
References
- Related to https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/work_items/1985+ - the
TestEmbeddingModelServiceis used to test and verify the billing events emitted for requests coming from Rails with the right headers.
Screenshots or screen recordings
N/A
How to set up and validate locally
Test on the Rails console
Ai::ActiveContext::TestEmbeddingModelService.new(
collection_class: ::Ai::ActiveContext::Collections::Code,
model_ref: 'text_embedding_005_vertex',
model_type: 'gitlab_managed',
dimensions: 768,
user: User.first
).execute
# test with `search=true`
Ai::ActiveContext::TestEmbeddingModelService.new(
collection_class: ::Ai::ActiveContext::Collections::Code,
model_ref: 'text_embedding_005_vertex',
model_type: 'gitlab_managed',
dimensions: 768,
user: User.first,
search: true
).executeMR 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.
Edited by Pam Artiaga