chat: align NoSQL query-generation prompt with language service and remove legacy language reference injection#3072
Open
bk201- wants to merge 5 commits into
Open
Conversation
Sync QUERY_GENERATION_SYSTEM_PROMPT with the syntax rules and function catalogue from packages/nosql-language-service: - ORDER BY: forbid ASC/DESC with ORDER BY RANK, disallow mixing RANK with regular sort keys, note that SELECT aliases cannot be reused in ORDER BY, and list FullTextScore / VectorDistance / RRF as the only valid RANK operands. - DateTime: add the *Static variants (GetCurrentDateTimeStatic, GetCurrentTimestampStatic, GetCurrentTicksStatic) with a note that they evaluate once per query and are safe inside indexed predicates. - Full-text / vector search: clarify that FullTextScore is only valid inside ORDER BY RANK, VectorDistance can appear in SELECT or ORDER BY RANK, and RRF combines scores for hybrid search. - Output rule: any non-query text (notes, caveats, assumptions, TODOs) must be wrapped in -- ... or /* ... */ comments so the entire response parses as a valid Cosmos DB NoSQL query. - Add full-text and hybrid-search examples to the Examples section.
Contributor
🎉 Build Summary🔗 Source
📦 Package Information
🧪 Test Results
✅ Build StatusAll checks completed successfully! |
Sync QUERY_GENERATION_SYSTEM_PROMPT with the syntax rules and function catalogue from packages/nosql-language-service: - ORDER BY: forbid ASC/DESC with ORDER BY RANK, disallow mixing RANK with regular sort keys, note that SELECT aliases cannot be reused in ORDER BY, and list FullTextScore / VectorDistance / RRF as the only valid RANK operands. - DateTime: add the *Static variants (GetCurrentDateTimeStatic, GetCurrentTimestampStatic, GetCurrentTicksStatic) with a note that they evaluate once per query and are safe inside indexed predicates. - Full-text / vector search: clarify that FullTextScore is only valid inside ORDER BY RANK, VectorDistance can appear in SELECT or ORDER BY RANK, and RRF combines scores for hybrid search. - Output rule: any non-query text (notes, caveats, assumptions, TODOs) must be wrapped in -- ... or /* ... */ comments so the entire response parses as a valid Cosmos DB NoSQL query. - Add full-text and hybrid-search examples to the Examples section.
# Conflicts: # src/chat/systemPrompt.ts
…m CosmosDbOperationsService refactor: update comments to reference new query generation rules in queryOneShotExamples refactor: simplify user payload by removing language reference property refactor: clean up extension activation by removing unnecessary CosmosDbOperationsService initialization
Contributor
|
@copilot Rework PR description with latest changes. |
Contributor
Updated description draft (reflecting latest commits): SummaryThis PR now does two things:
In practice, query guidance now comes from What changed
Why
Validation
|
Copilot
AI
changed the title
chat: align NoSQL query-generation prompt with language service
chat: align NoSQL query-generation prompt with language service and remove legacy language reference injection
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns the AI chat participant’s NoSQL query-generation guidance with the language-service-backed syntax/function rules in
src/chat/systemPrompt.tsand removes the separate markdown language-reference injection path.The prompt is now the single in-repo source of truth for query-generation rules, reducing drift and cutting prompt token usage.
What changed
Prompt/rules updates
QUERY_GENERATION_RULESinsrc/chat/systemPrompt.tswith tighter syntax/function guidance, including:ORDER BYandORDER BY RANKconstraintsSELECT VALUEalias restrictionsRemoved legacy language-reference plumbing
resources/azurecosmosdb-nosql-query-language.md.src/chat/CosmosDbOperationsService.ts.languageReferencefrom query-generation payload construction and types (src/chat/userPayload.ts).src/extension.ts.src/chat/queryOneShotExamples.tsto referenceQUERY_GENERATION_RULES.Why this matters
Validation
Files changed
src/chat/systemPrompt.tssrc/chat/CosmosDbOperationsService.tssrc/chat/userPayload.tssrc/chat/queryOneShotExamples.tssrc/extension.tsresources/azurecosmosdb-nosql-query-language.md(deleted)