Skip to content

Conversation

@xingfan-git
Copy link
Contributor

No description provided.

@xingfan-git xingfan-git requested a review from a team as a code owner October 28, 2025 09:19
Copilot AI review requested due to automatic review settings October 28, 2025 09:19
@xingfan-git xingfan-git linked an issue Oct 28, 2025 that may be closed by this pull request
4 tasks
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 integrates LLM-enhanced query generation functionality into the DocumentDB extension, enabling AI-powered MongoDB query creation from natural language prompts. The implementation leverages GitHub Copilot's language models to generate queries based on collection schemas and user requests.

Key Changes:

  • Replaced mock AI query generation with real LLM integration using GitHub Copilot
  • Added comprehensive infrastructure for schema inference and prompt template management
  • Implemented MongoDB client APIs for gathering collection metadata to support LLM context

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/webviews/documentdb/collectionView/collectionViewRouter.ts Replaces mock AI logic with actual LLM query generation using telemetry and error handling
src/utils/schemaInference.ts Implements schema inference from MongoDB documents including type detection and vector array support
src/services/promptTemplateService.ts Provides template loading service with caching and custom template file support
src/services/copilotService.ts Wraps VS Code's language model API for GitHub Copilot interaction
src/documentdb/LlmEnhancedFeatureApis.ts Implements MongoDB APIs for explain plans, index operations, and sample document retrieval
src/documentdb/ClustersClient.ts Exposes LLM-enhanced feature APIs through the cluster client and adds metadata caching
src/commands/llmEnhancedCommands/queryGenerationCommands.ts Orchestrates query generation from natural language using schema inference and LLM calls
src/commands/llmEnhancedCommands/promptTemplates.ts Contains prompt templates for different query types and model configuration
package.json Adds configuration settings for custom prompt templates and caching
l10n/bundle.l10n.json Adds localized strings for new error messages and user-facing text

@xingfan-git xingfan-git requested a review from tnaum-ms October 28, 2025 09:35
Copy link
Collaborator

@tnaum-ms tnaum-ms left a comment

Choose a reason for hiding this comment

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

  • lets pretty-print our queries when there are > 1 fields in use.
  • llm config: I wonder why for this prompt "find the top 10 stores, look at store features" it added a long list of project fields instead of just leaving it empty.
  • we need to add cancel support
  • we need to add more trace messages to the output channel

  • let's address the metadata topic before merging it, otherwise we'll forget.

the other items can be scheduled for 0.6.1 and 0.6.2

package.json Outdated
"description": "The batch size to be used when querying working with the shell.",
"default": 50
},
"documentDB.llm.findQueryPromptPath": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's find a better name for this category "LLM", @khelanmodi this is about the settings the user can configure. How about "DocumentDB Copilot", "DocumentDB AI Assistant", "AI Assistant"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@xingfan-git FYI: I changed it to AiAssistant. Your test env can break.

Copy link
Contributor

Copilot AI commented Oct 29, 2025

@tnaum-ms I've opened a new pull request, #319, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Collaborator

@tnaum-ms tnaum-ms left a comment

Choose a reason for hiding this comment

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

Requested changes were implemented.
Follow-up tickets/issues were created.

@tnaum-ms tnaum-ms merged commit f5065fd into next Oct 31, 2025
8 checks passed
@tnaum-ms tnaum-ms deleted the dev/xingfan/querygenerationintegration branch October 31, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connect "Query Generation from NL" with the available UI

5 participants