ClusterBasedExampleSelector<T>
Models & Types ยท AiDotNet.PromptEngineering.FewShot
Selects examples using a clustering approach to ensure broad coverage.
Inheritance: FewShotExampleSelectorBase<T> โ ClusterBasedExampleSelector<T>
For Beginners
Groups similar examples and picks one from each group.
Think of organizing photos:
- Group 1: Beach photos
- Group 2: Mountain photos
- Group 3: City photos
Instead of showing all beach photos, you show one from each group.
Example:
Use this when:
- Examples naturally fall into categories
- You want guaranteed coverage of all categories
- Building a general-purpose system
How It Works
This selector groups similar examples into clusters and selects representative examples from each cluster. This ensures broad coverage across different types of examples.
Constructors
| Constructor | Summary |
|---|---|
ClusterBasedExampleSelector(Func<string, Vector<T>> embeddingFunction, int clusterCount, int? seed) |
Initializes a new instance of the ClusterBasedExampleSelector class. |
ClusterBasedExampleSelector(IEmbeddingModel<T> embeddingModel, int clusterCount, int? seed) |
Initializes a new instance of the ClusterBasedExampleSelector class. |
Properties
| Property | Summary |
|---|---|
int ClusterCount { get; } |
Gets the number of clusters used for selection. |