fix: mock Vertex AI search when AIGW_MOCK_MODEL_RESPONSES used
What does this merge request do and why?
!778 (merged) added support for the Vertex AI Search engine, but it did not mock the client when AIGW_MOCK_MODEL_RESPONSES were defined in tests. This caused QA tests to fail since Application Default Credentials were not available for this service.
Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/462439
How to set up and validate locally
- In
.env
, setAIGW_MOCK_MODEL_RESPONSES=True
. - Make a query:
curl -v -X 'POST' \
'http://0.0.0.0:5052/v1/search/gitlab-docs' \
-H 'accept: application/json' \
-H 'x-gitlab-unit-primitive: duo_chat' \
-H 'Content-Type: application/json' \
--data-raw '{
"type": "string",
"metadata": {
"source": "string",
"version": "17.0.0-pre"
},
"payload": {
"query": "how to create an issue?"
}
}'
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Edited by Stan Hu