-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ungroup tools based on embedding rankings #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… into dev/vrbhardw/embeddings
cc @connor4312 |
There was a problem hiding this 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 adds embeddings-based tool ranking and caching to the virtual tool grouper to predict which tools are most relevant to user queries, improving the tool selection experience. The feature is currently behind an experiment flag (chat.advanced.virtualTools.embeddingRanking
) and includes infrastructure for computing tool embeddings and expanding virtual tool groups based on similarity rankings.
Key changes include:
- Implementing an embeddings-based prediction system for virtual tools
- Adding caching for tool embeddings with both pre-computed and runtime computation
- Integrating the ranking system into the tool grouping workflow
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/platform/embeddings/common/embeddingsIndex.ts |
Adds new Tools remote cache type for storing tool embeddings |
src/platform/configuration/common/configurationService.ts |
Adds experiment flag for virtual tool embedding ranking feature |
src/extension/tools/test/node/virtualTools/virtualToolGrouping.spec.ts |
Updates test calls to include query parameter in grouping methods |
src/extension/tools/test/node/virtualTools/virtualToolGrouper.spec.ts |
Updates test calls and adds comprehensive tests for the new embedding-based expansion feature |
src/extension/tools/common/virtualTools/virtualToolTypes.ts |
Updates interface methods to accept query string parameter for context |
src/extension/tools/common/virtualTools/virtualToolGrouper.ts |
Core implementation of embedding-based tool prediction and virtual tool expansion logic |
src/extension/tools/common/virtualTools/toolGrouping.ts |
Updates method signatures to pass through query string for embedding computation |
src/extension/tools/common/virtualTools/toolEmbeddingsCache.ts |
New file implementing tool embeddings computation and caching infrastructure |
src/extension/tools/common/test/toolEmbeddingsCache.spec.ts |
Comprehensive unit tests for the tool embeddings computation system |
src/extension/test/node/services.ts |
Registers embeddings computer service for testing |
src/extension/prompt/node/defaultIntentRequestHandler.ts |
Updates method calls to pass query text for embedding-based tool ranking |
src/extension/intents/node/toolCallingLoop.ts |
Updates abstract method signature to include query parameter |
src/extension/intents/node/agentIntent.ts |
Updates method call to include query parameter |
I get an error when we try to compare here
as expected |
src/extension/tools/test/node/virtualTools/virtualToolGrouper.spec.ts
Outdated
Show resolved
Hide resolved
if (virtualToolEmbeddingRankingEnabled) { | ||
const predictedTools = await this._getPredictedTools(query, tools, token); | ||
|
||
this._expandGroupsWithPredictedTools(root, predictedTools); | ||
} | ||
|
||
this._reExpandToolsToHitBudget(root); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we refactor this so _reExpandToolsToHitBudget
is generic and takes a ranker or comparator argument. By default it would be something like this._reExpandToolsToHitBudget(root, g => g.tools.length)
but for embeddings it would be like this._reExpandToolsToHitBudget(root, g => this._getGroupPredictedRelevancy(g, predictedTools))
Add embeddings-based tool ranking and caching for virtual tool grouper to predict which tools are most relevant to user queries, improving the tool selection experience.
The feature is currently behind an experiment flag (
chat.virtualTools.embeddingRanking
)