Skip to content

Conversation

@himanshusinghs
Copy link
Collaborator

@himanshusinghs himanshusinghs commented Nov 7, 2025

Proposed changes

Proposes the following:

  1. Modifies the description of createIndex tool's index definition object. We will mention vectorSearch only when the feature is enabled. Additionally adds additional tests for the metadata - 198b36e
  2. Adds validation for document field embeddings when the index quantization is set to none - 5cd2e51
  3. Adds a warning when vector search is not correctly configured - fbb3d0f

Checklist

@coveralls
Copy link
Collaborator

coveralls commented Nov 7, 2025

Pull Request Test Coverage Report for Build 19226901281

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 49 of 55 (89.09%) changed or added relevant lines in 7 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 80.11%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/common/config.ts 11 17 64.71%
Files with Coverage Reduction New Missed Lines %
src/common/search/vectorSearchEmbeddingsManager.ts 1 83.61%
Totals Coverage Status
Change from base Build 19133495784: -0.04%
Covered Lines: 6507
Relevant Lines: 8008

💛 - Coveralls

@himanshusinghs himanshusinghs marked this pull request as ready for review November 7, 2025 14:26
@himanshusinghs himanshusinghs requested a review from a team as a code owner November 7, 2025 14:26
Copilot AI review requested due to automatic review settings November 7, 2025 14:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances vector search configuration validation and improves tool metadata clarity. The main purpose is to ensure proper vector search setup and provide better user feedback when configurations are incorrect.

Key changes:

  • Adds validation for embeddings when quantization is set to "none"
  • Introduces warnings when vector search feature and embeddings provider configurations are mismatched
  • Updates warning message formatting for better readability

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/common/search/vectorSearchEmbeddingsManager.ts Implements validation logic for "none" quantization to ensure embeddings are proper numeric arrays with correct dimensions
src/common/config.ts Adds configuration validation warnings for vector search/embeddings provider mismatches and updates warning message formatting
src/tools/mongodb/create/createIndex.ts Makes vectorSearch reference conditional in tool description based on feature availability
tests/unit/common/search/vectorSearchEmbeddingsManager.test.ts Extends test coverage to validate "none" quantization handling across multiple scenarios
tests/unit/common/config.test.ts Updates test expectations to match new warning message format
tests/integration/tools/mongodb/create/createIndex.test.ts Adds metadata validation and updates expected description text
tests/integration/tools/mongodb/create/insertMany.test.ts Adds metadata validation test for insert-many tool

({
pipeline: z
.array(vectorSearchEnabled ? z.union([AnyAggregateStage, VectorSearchStage]) : AnyAggregateStage)
.describe(pipelineDescription),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pipeline description here is static and includes references to vector search - should we modify it so that we don't include them if the feature is disabled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's certainly an option but I think that the description applies in a generic sense to the pipeline and I don't think it would be confusing for the LLMs. Or do you feel otherwise?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, most of the description is usage rules for the $vectorSearch and when vector search is disabled, we take in any ejson for the stages - I don't know if it'll be confusing to the LLM but generally, the way the description is worded, it does imply one could run a $vectorSearch query (which admittedly, they can, as long as they provide the embeddings).

const vectorSearchEnabled = config.previewFeatures.includes("vectorSearch");
const embeddingsProviderConfigured = !!config.voyageApiKey;
if (vectorSearchEnabled && !embeddingsProviderConfigured) {
console.warn(`\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use warn in other places but console.warn here, is it intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh - that's because the place where we use warn is where the console.warn is being provided through the function arguments. Likely for some tests. I had the tests covered differently so it should be fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no, the new warning is not covered. I will write a test quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants