EmbeddingToolReductionStrategy Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A tool reduction strategy that ranks tools by embedding similarity to the current conversation context.
public ref class EmbeddingToolReductionStrategy sealed : Microsoft::Extensions::AI::IToolReductionStrategy
[System.Diagnostics.CodeAnalysis.Experimental("MEAI001")]
public sealed class EmbeddingToolReductionStrategy : Microsoft.Extensions.AI.IToolReductionStrategy
public sealed class EmbeddingToolReductionStrategy : Microsoft.Extensions.AI.IToolReductionStrategy
[<System.Diagnostics.CodeAnalysis.Experimental("MEAI001")>]
type EmbeddingToolReductionStrategy = class
interface IToolReductionStrategy
type EmbeddingToolReductionStrategy = class
interface IToolReductionStrategy
Public NotInheritable Class EmbeddingToolReductionStrategy
Implements IToolReductionStrategy
- Inheritance
-
EmbeddingToolReductionStrategy
- Attributes
- Implements
Remarks
The strategy embeds each tool (name + description by default) once (cached) and embeds the current conversation content each request. It then selects the top toolLimit tools by similarity.
Constructors
| Name | Description |
|---|---|
| EmbeddingToolReductionStrategy(IEmbeddingGenerator<String,Embedding<Single>>, Int32) |
Initializes a new instance of the EmbeddingToolReductionStrategy class. |
Properties
| Name | Description |
|---|---|
| IsRequiredTool |
Gets or sets a function that determines whether a tool is required (always included). |
| MessagesEmbeddingTextSelector |
Gets or sets the selector used to generate a single text string from a collection of chat messages for embedding purposes. |
| PreserveOriginalOrdering |
Gets or sets a value indicating whether to preserve original ordering of selected tools.
If |
| Similarity |
Gets or sets a similarity function applied to (query, tool) embedding vectors. |
| ToolEmbeddingTextSelector |
Gets or sets the selector used to generate a single text string from a tool. |
Methods
| Name | Description |
|---|---|
| SelectToolsForRequestAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) |
Selects the tools that should be included for a specific request. |