Class: KNNFewShot
KNN-selected few-shot optimizer (dspy.KNNFewShot).
URI: dspy:KNNFewShot
classDiagram
class KNNFewShot
click KNNFewShot href "../KNNFewShot/"
BootstrapFewShot <|-- KNNFewShot
click BootstrapFewShot href "../BootstrapFewShot/"
KNNFewShot : description
KNNFewShot : embedder
KNNFewShot --> "0..1" Embedder : embedder
click Embedder href "../Embedder/"
KNNFewShot : id
KNNFewShot : k_nearest
KNNFewShot : max_bootstrapped_demos
KNNFewShot : max_errors
KNNFewShot : max_labeled_demos
KNNFewShot : max_rounds
KNNFewShot : metric
KNNFewShot : metric_threshold
KNNFewShot : name
KNNFewShot : teacher_settings
KNNFewShot --> "0..1" Any : teacher_settings
click Any href "../Any/"
Inheritance
- NamedThing
- Teleprompter
- BootstrapFewShot
- KNNFewShot
- BootstrapFewShot
- Teleprompter
Slots
| Name | Cardinality and Range | Description | Inheritance |
|---|---|---|---|
| k_nearest | 0..1 Integer |
direct | |
| embedder | 0..1 Embedder |
direct | |
| metric_threshold | 0..1 Float |
BootstrapFewShot | |
| teacher_settings | 0..1 Any |
BootstrapFewShot | |
| max_bootstrapped_demos | 0..1 Integer |
BootstrapFewShot | |
| max_labeled_demos | 0..1 Integer |
BootstrapFewShot | |
| max_rounds | 0..1 Integer |
BootstrapFewShot | |
| max_errors | 0..1 Integer |
BootstrapFewShot | |
| metric | 0..1 String |
Dotted import path of the metric callable (or its name) | Teleprompter |
| id | 1 Identifier |
Stable opaque identifier for an instance | NamedThing |
| name | 0..1 String |
Short human-readable name | NamedThing |
| description | 0..1 String |
Free-form description | NamedThing |
In Subsets
Identifier and Mapping Information
Annotations
| property | value |
|---|---|
| dspy_source_paths | ['dspy/teleprompt/knn_fewshot.py'] |
| dspy_source_urls | ['https://github.com/stanfordnlp/dspy/blob/main/dspy/teleprompt/knn_fewshot.py'] |
Schema Source
- from schema: https://w3id.org/lmodel/dspy
Mappings
| Mapping Type | Mapped Value |
|---|---|
| self | dspy:KNNFewShot |
| native | dspy:KNNFewShot |
LinkML Source
Direct
name: KNNFewShot
annotations:
dspy_source_paths:
tag: dspy_source_paths
value:
- dspy/teleprompt/knn_fewshot.py
dspy_source_urls:
tag: dspy_source_urls
value:
- https://github.com/stanfordnlp/dspy/blob/main/dspy/teleprompt/knn_fewshot.py
description: KNN-selected few-shot optimizer (``dspy.KNNFewShot``).
in_subset:
- teleprompt
from_schema: https://w3id.org/lmodel/dspy
is_a: BootstrapFewShot
slots:
- k_nearest
- embedder
Induced
name: KNNFewShot
annotations:
dspy_source_paths:
tag: dspy_source_paths
value:
- dspy/teleprompt/knn_fewshot.py
dspy_source_urls:
tag: dspy_source_urls
value:
- https://github.com/stanfordnlp/dspy/blob/main/dspy/teleprompt/knn_fewshot.py
description: KNN-selected few-shot optimizer (``dspy.KNNFewShot``).
in_subset:
- teleprompt
from_schema: https://w3id.org/lmodel/dspy
is_a: BootstrapFewShot
attributes:
k_nearest:
name: k_nearest
from_schema: https://w3id.org/lmodel/dspy
aliases:
- k
rank: 1000
owner: KNNFewShot
domain_of:
- KNN
- KNNFewShot
range: integer
minimum_value: 1
embedder:
name: embedder
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNNFewShot
domain_of:
- KNN
- KNNFewShot
- Embeddings
range: Embedder
inlined: true
metric_threshold:
name: metric_threshold
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNNFewShot
domain_of:
- BestOfN
- Refine
- BootstrapFewShot
- COPRO
- MIPROv2
range: float
teacher_settings:
name: teacher_settings
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNNFewShot
domain_of:
- BootstrapFewShot
- MIPROv2
- BootstrapFinetune
range: Any
max_bootstrapped_demos:
name: max_bootstrapped_demos
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
ifabsent: int(4)
owner: KNNFewShot
domain_of:
- BootstrapFewShot
- MIPROv2
- SIMBA
- GEPA
range: integer
minimum_value: 0
max_labeled_demos:
name: max_labeled_demos
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
ifabsent: int(16)
owner: KNNFewShot
domain_of:
- LabeledFewShot
- BootstrapFewShot
- MIPROv2
- SIMBA
- GEPA
range: integer
minimum_value: 0
max_rounds:
name: max_rounds
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
ifabsent: int(1)
owner: KNNFewShot
domain_of:
- BootstrapFewShot
range: integer
minimum_value: 1
max_errors:
name: max_errors
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNNFewShot
domain_of:
- Parallel
- BootstrapFewShot
- Evaluate
- Settings
range: integer
minimum_value: 0
metric:
name: metric
description: Dotted import path of the metric callable (or its name).
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNNFewShot
domain_of:
- Teleprompter
- Evaluate
range: string
id:
name: id
description: Stable opaque identifier for an instance.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
slot_uri: schema:identifier
identifier: true
owner: KNNFewShot
domain_of:
- NamedThing
range: Identifier
required: true
name:
name: name
description: Short human-readable name.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
slot_uri: rdfs:label
owner: KNNFewShot
domain_of:
- NamedThing
- LMToolCallPart
- LMMessage
- LMToolSpec
range: string
description:
name: description
description: Free-form description.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
slot_uri: dct:description
owner: KNNFewShot
domain_of:
- NamedThing
- LMToolSpec
range: string