FewShotExampleSelectorBase<T>
Base Classes · AiDotNet.PromptEngineering.FewShot
Base class for few-shot example selector implementations.
Implements: IFewShotExampleSelector<T>
Known derived types: ClusterBasedExampleSelector<T>, DiversityExampleSelector<T>, FixedExampleSelector<T>, MMRExampleSelector<T>, RandomExampleSelector<T>, SemanticSimilarityExampleSelector<T>
For Beginners
This is the foundation for all example selectors.
It handles:
- Storing examples
- Adding/removing examples
- Basic validation
Derived classes just need to implement how to SELECT examples!
How It Works
This base class provides common functionality for example selectors including example storage and basic validation. Derived classes implement the selection strategy.
Properties
| Property | Summary |
|---|---|
int ExampleCount { get; } |
Gets the total number of examples in the pool. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<FewShotExample> GetAllExamples() |
Gets all examples currently in the selector’s pool. |
IReadOnlyList<FewShotExample> SelectExamples(string query, int count) |
Selects the most appropriate examples for the given query. |
bool RemoveExample(FewShotExample example) |
Removes an example from the selector’s pool. |
void AddExample(FewShotExample example) |
Adds an example to the selector’s pool. |