diff --git a/.evergreen-functions.yml b/.evergreen-functions.yml index daac22d9a5..d5b6f3eb40 100644 --- a/.evergreen-functions.yml +++ b/.evergreen-functions.yml @@ -50,6 +50,8 @@ variables: - VERSION_UPGRADE_HOOK_VERSION - BUILD_SCENARIO - MDB_BASH_DEBUG + - AI_MONGODB_EMBEDDING_INDEXING_KEY + - AI_MONGODB_EMBEDDING_QUERY_KEY functions: @@ -743,6 +745,8 @@ functions: - code_snippets_reset - task_name - MDB_BASH_DEBUG + - AI_MONGODB_EMBEDDING_INDEXING_KEY + - AI_MONGODB_EMBEDDING_QUERY_KEY add_to_path: - ${workdir}/bin script: | diff --git a/docs/search/01-search-community-deploy/code_snippets/01_0322_create_auto_embed_mongodb_search_resource.sh b/docs/search/01-search-community-deploy/code_snippets/01_0322_create_auto_embed_mongodb_search_resource.sh new file mode 100755 index 0000000000..7456d62037 --- /dev/null +++ b/docs/search/01-search-community-deploy/code_snippets/01_0322_create_auto_embed_mongodb_search_resource.sh @@ -0,0 +1,28 @@ +# create a Kubernetes secret that would have embedding model's API Keys +kubectl create secret generic "${AUTO_EMBEDDING_API_KEY_SECRET_NAME}" \ + --from-literal=query-key="${AUTO_EMBEDDING_API_QUERY_KEY}" \ + --from-literal=indexing-key="${AUTO_EMBEDDING_API_INDEXING_KEY}" --context "${K8S_CTX}" -n "${MDB_NS}" + +# create MongoDBSearch resource, enabling the auto embedding using the API Keys provided above +kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - < /tmp/mdb_script.js +mongosh --quiet "${MDB_CONNECTION_STRING}" < /tmp/mdb_script.js +EOF +)" diff --git a/docs/search/03-search-query-usage/test.sh b/docs/search/03-search-query-usage/test.sh index 28e430eb01..d65b27b82d 100755 --- a/docs/search/03-search-query-usage/test.sh +++ b/docs/search/03-search-query-usage/test.sh @@ -15,10 +15,23 @@ run 03_0410_run_mongodb_tools_pod.sh run_for_output 03_0420_import_movies_mflix_database.sh run 03_0430_create_search_index.sh run 03_0435_create_vector_search_index.sh +# don't create auto embedding vector search if it's not community deployment. +# since we set EMBEDDING_MODEL env var just in community, we can check that env var. +if [ -n "${EMBEDDING_MODEL:-}" ]; then + run 03_0437_create_auto_embed_vector_search_index.sh +else + echo "Skipping creation of autoEmbed vector search index for non community deployments." +fi run_for_output 03_0440_wait_for_search_index_ready.sh run_for_output 03_0444_list_search_indexes.sh run_for_output 03_0445_list_vector_search_indexes.sh +run_for_output 03_0447_list_auto_embed_vector_search_indexes.sh run_for_output 03_0450_execute_search_query.sh run_for_output 03_0455_execute_vector_search_query.sh +if [ -n "${EMBEDDING_MODEL:-}" ]; then + run_for_output 03_0456_execute_auto_embed_vector_search_query.sh +else + echo "Skipping running autoEmbed vector search query for non community deployments." +fi cd -