Class: Predictor
Module that wraps a Signature + LM and produces a Prediction.
- NOTE: this is an abstract class and should not be instantiated directly
URI: dspy:Predictor
classDiagram
class Predictor
click Predictor href "../Predictor/"
Module <|-- Predictor
click Module href "../Module/"
Predictor <|-- Predict
click Predict href "../Predict/"
Predictor <|-- MultiChainComparison
click MultiChainComparison href "../MultiChainComparison/"
Predictor <|-- ReAct
click ReAct href "../ReAct/"
Predictor <|-- ReActV2
click ReActV2 href "../ReActV2/"
Predictor <|-- ProgramOfThought
click ProgramOfThought href "../ProgramOfThought/"
Predictor <|-- CodeAct
click CodeAct href "../CodeAct/"
Predictor : callbacks
Predictor : compiled
Predictor : config
Predictor --> "0..1" Any : config
click Any href "../Any/"
Predictor : demos
Predictor --> "*" Example : demos
click Example href "../Example/"
Predictor : description
Predictor : history
Predictor --> "*" LMHistoryEntry : history
click LMHistoryEntry href "../LMHistoryEntry/"
Predictor : id
Predictor : lm
Predictor --> "0..1" BaseLM : lm
click BaseLM href "../BaseLM/"
Predictor : name
Predictor : predictors
Predictor --> "*" Predictor : predictors
click Predictor href "../Predictor/"
Predictor : signature
Predictor --> "0..1" Signature : signature
click Signature href "../Signature/"
Predictor : stage
Predictor : sub_modules
Predictor --> "*" Module : sub_modules
click Module href "../Module/"
Predictor : traces
Predictor --> "*" Any : traces
click Any href "../Any/"
Predictor : train
Predictor --> "*" Example : train
click Example href "../Example/"
Inheritance
Slots
| Name | Cardinality and Range | Description | Inheritance |
|---|---|---|---|
| signature | 0..1 Signature |
Signature attached to a predictor | direct |
| lm | 0..1 BaseLM |
Language model bound to this predictor / program | direct |
| config | 0..1 Any |
Default keyword arguments forwarded to the underlying LM | direct |
| stage | 0..1 Identifier |
Random per-predictor stage id used to bucket traces | direct |
| demos | * Example |
Few-shot demonstrations attached to a predictor | direct |
| traces | * Any |
Bootstrapped traces gathered by teleprompters | direct |
| train | * Example |
Training examples attached to a predictor (used by some optimizers) | 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 |
Usages
| used by | used in | type | used |
|---|---|---|---|
| Module | predictors | range | Predictor |
| Predictor | predictors | range | Predictor |
| Predict | predictors | range | Predictor |
| ChainOfThought | predictors | range | Predictor |
| MultiChainComparison | predictors | range | Predictor |
| BestOfN | predictors | range | Predictor |
| Refine | predictors | range | Predictor |
| ReAct | predictors | range | Predictor |
| ReActV2 | predictors | range | Predictor |
| ProgramOfThought | predictors | range | Predictor |
| CodeAct | predictors | range | Predictor |
| KNN | predictors | range | Predictor |
| Parallel | predictors | range | Predictor |
| RLM | predictors | range | Predictor |
| Aggregator | predictors | range | Predictor |
| Retriever | predictors | range | Predictor |
| Retrieve | predictors | range | Predictor |
| Embeddings | predictors | range | Predictor |
| EmbeddingsWithScores | predictors | range | Predictor |
| ColBERTv2 | predictors | range | Predictor |
In Subsets
Aliases
- prompt_program
Identifier and Mapping Information
Schema Source
- from schema: https://w3id.org/lmodel/dspy
Mappings
| Mapping Type | Mapped Value |
|---|---|
| self | dspy:Predictor |
| native | dspy:Predictor |
| related | ucs_core:Agent |
LinkML Source
Direct
name: Predictor
description: Module that wraps a Signature + LM and produces a Prediction.
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
aliases:
- prompt_program
related_mappings:
- ucs_core:Agent
is_a: Module
abstract: true
slots:
- signature
- lm
- config
- stage
- demos
- traces
- train
Induced
name: Predictor
description: Module that wraps a Signature + LM and produces a Prediction.
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
aliases:
- prompt_program
related_mappings:
- ucs_core:Agent
is_a: Module
abstract: true
attributes:
signature:
name: signature
description: Signature attached to a predictor.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- Completions
- Predictor
range: Signature
inlined: true
lm:
name: lm
description: Language model bound to this predictor / program.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- Predictor
- RLM
- Settings
range: BaseLM
inlined: true
config:
name: config
description: Default keyword arguments forwarded to the underlying LM.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- LMRequest
- Predictor
range: Any
stage:
name: stage
description: Random per-predictor stage id used to bucket traces.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- Predictor
range: Identifier
demos:
name: demos
description: Few-shot demonstrations attached to a predictor.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- Predictor
range: Example
multivalued: true
inlined: true
inlined_as_list: true
traces:
name: traces
description: Bootstrapped traces gathered by teleprompters.
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- Predictor
range: Any
multivalued: true
train:
name: train
description: Training examples attached to a predictor (used by some optimizers).
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Predictor
domain_of:
- Predictor
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: Predictor
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: Predictor
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: Predictor
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: Predictor
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: Predictor
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: Predictor
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: Predictor
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: Predictor
domain_of:
- NamedThing
- LMToolSpec
range: string