Class: KNN
K-nearest-neighbor demo selector (dspy.KNN).
URI: dspy:KNN
classDiagram
class KNN
click KNN href "../KNN/"
Module <|-- KNN
click Module href "../Module/"
KNN : callbacks
KNN : compiled
KNN : description
KNN : embedder
KNN --> "0..1" Embedder : embedder
click Embedder href "../Embedder/"
KNN : history
KNN --> "*" LMHistoryEntry : history
click LMHistoryEntry href "../LMHistoryEntry/"
KNN : id
KNN : k_nearest
KNN : name
KNN : predictors
KNN --> "*" Predictor : predictors
click Predictor href "../Predictor/"
KNN : sub_modules
KNN --> "*" Module : sub_modules
click Module href "../Module/"
KNN : trainset
KNN --> "*" Example : trainset
click Example href "../Example/"
Inheritance
- NamedThing
- Module
- KNN
- Module
Slots
| Name | Cardinality and Range | Description | Inheritance |
|---|---|---|---|
| k_nearest | 0..1 Integer |
direct | |
| embedder | 0..1 Embedder |
direct | |
| trainset | * Example |
Training split used by an optimizer | direct |
| compiled | 0..1 Boolean |
Whether the module has been compiled by a teleprompter | Module |
| callbacks | * String |
Dotted import paths of callbacks registered on the module | Module |
| history | * LMHistoryEntry |
Per-module call history of LM requests / responses | Module |
| predictors | * Predictor |
Predictor children of a composite Module (named_predictors()) | Module |
| sub_modules | * Module |
Nested Module children of a composite Module | Module |
| 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/predict/knn.py'] |
| dspy_source_urls | ['https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/knn.py'] |
Schema Source
- from schema: https://w3id.org/lmodel/dspy
Mappings
| Mapping Type | Mapped Value |
|---|---|
| self | dspy:KNN |
| native | dspy:KNN |
LinkML Source
Direct
name: KNN
annotations:
dspy_source_paths:
tag: dspy_source_paths
value:
- dspy/predict/knn.py
dspy_source_urls:
tag: dspy_source_urls
value:
- https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/knn.py
description: K-nearest-neighbor demo selector (``dspy.KNN``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
is_a: Module
slots:
- k_nearest
- embedder
- trainset
Induced
name: KNN
annotations:
dspy_source_paths:
tag: dspy_source_paths
value:
- dspy/predict/knn.py
dspy_source_urls:
tag: dspy_source_urls
value:
- https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/knn.py
description: K-nearest-neighbor demo selector (``dspy.KNN``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
is_a: Module
attributes:
k_nearest:
name: k_nearest
from_schema: https://w3id.org/lmodel/dspy
aliases:
- k
rank: 1000
owner: KNN
domain_of:
- KNN
- KNNFewShot
range: integer
minimum_value: 1
embedder:
name: embedder
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNN
domain_of:
- KNN
- KNNFewShot
- Embeddings
range: Embedder
inlined: true
trainset:
name: trainset
description: Training split used by an optimizer.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNN
domain_of:
- KNN
- Dataset
range: Example
multivalued: true
inlined: true
inlined_as_list: true
compiled:
name: compiled
description: Whether the module has been compiled by a teleprompter.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
ifabsent: boolean(False)
owner: KNN
domain_of:
- Module
range: boolean
callbacks:
name: callbacks
description: Dotted import paths of callbacks registered on the module.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNN
domain_of:
- BaseLM
- Adapter
- Module
- Settings
range: string
multivalued: true
history:
name: history
description: Per-module call history of LM requests / responses.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNN
domain_of:
- BaseLM
- Module
range: LMHistoryEntry
multivalued: true
inlined: true
inlined_as_list: true
predictors:
name: predictors
description: Predictor children of a composite Module (named_predictors()).
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNN
domain_of:
- Module
range: Predictor
multivalued: true
inlined: true
inlined_as_list: true
sub_modules:
name: sub_modules
description: Nested Module children of a composite Module.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: KNN
domain_of:
- Module
range: Module
multivalued: true
inlined: true
inlined_as_list: true
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: KNN
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: KNN
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: KNN
domain_of:
- NamedThing
- LMToolSpec
range: string