Class: Refine
Iterative refinement loop (dspy.Refine).
URI: dspy:Refine
classDiagram
class Refine
click Refine href "../Refine/"
Module <|-- Refine
click Module href "../Module/"
Refine : callbacks
Refine : compiled
Refine : description
Refine : history
Refine --> "*" LMHistoryEntry : history
click LMHistoryEntry href "../LMHistoryEntry/"
Refine : id
Refine : max_retries
Refine : metric_threshold
Refine : module_under_test
Refine --> "0..1" Module : module_under_test
click Module href "../Module/"
Refine : n
Refine : name
Refine : predictors
Refine --> "*" Predictor : predictors
click Predictor href "../Predictor/"
Refine : reward_fn
Refine : sub_modules
Refine --> "*" Module : sub_modules
click Module href "../Module/"
Inheritance
- NamedThing
- Module
- Refine
- Module
Slots
| Name | Cardinality and Range | Description | Inheritance |
|---|---|---|---|
| n | 0..1 Integer |
Number of candidate generations (BestOfN, MultiChainComparison | direct |
| reward_fn | 0..1 String |
Dotted import path of a reward function (Refine, BestOfN) | direct |
| metric_threshold | 0..1 Float |
direct | |
| max_retries | 0..1 Integer |
Maximum retry attempts (Refine, retry decorator) | direct |
| module_under_test | 0..1 Module |
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/refine.py'] |
| dspy_source_urls | ['https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/refine.py'] |
Schema Source
- from schema: https://w3id.org/lmodel/dspy
Mappings
| Mapping Type | Mapped Value |
|---|---|
| self | dspy:Refine |
| native | dspy:Refine |
| related | nexus:RiskControl |
| close | mellea:SamplingStrategySpec |
LinkML Source
Direct
name: Refine
annotations:
dspy_source_paths:
tag: dspy_source_paths
value:
- dspy/predict/refine.py
dspy_source_urls:
tag: dspy_source_urls
value:
- https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/refine.py
description: Iterative refinement loop (``dspy.Refine``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
close_mappings:
- mellea:SamplingStrategySpec
related_mappings:
- nexus:RiskControl
is_a: Module
slots:
- n
- reward_fn
- metric_threshold
- max_retries
attributes:
module_under_test:
name: module_under_test
from_schema: https://w3id.org/lmodel/dspy
domain_of:
- BestOfN
- Refine
range: Module
inlined: true
Induced
name: Refine
annotations:
dspy_source_paths:
tag: dspy_source_paths
value:
- dspy/predict/refine.py
dspy_source_urls:
tag: dspy_source_urls
value:
- https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/refine.py
description: Iterative refinement loop (``dspy.Refine``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
close_mappings:
- mellea:SamplingStrategySpec
related_mappings:
- nexus:RiskControl
is_a: Module
attributes:
module_under_test:
name: module_under_test
from_schema: https://w3id.org/lmodel/dspy
owner: Refine
domain_of:
- BestOfN
- Refine
range: Module
inlined: true
n:
name: n
description: Number of candidate generations (BestOfN, MultiChainComparison...).
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Refine
domain_of:
- MultiChainComparison
- BestOfN
- Refine
range: integer
minimum_value: 1
reward_fn:
name: reward_fn
description: Dotted import path of a reward function (Refine, BestOfN).
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Refine
domain_of:
- BestOfN
- Refine
range: string
metric_threshold:
name: metric_threshold
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Refine
domain_of:
- BestOfN
- Refine
- BootstrapFewShot
- COPRO
- MIPROv2
range: float
max_retries:
name: max_retries
description: Maximum retry attempts (Refine, retry decorator).
from_schema: https://w3id.org/lmodel/dspy
rank: 1000
owner: Refine
domain_of:
- Refine
range: integer
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: Refine
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: Refine
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: Refine
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: Refine
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: Refine
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: Refine
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: Refine
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: Refine
domain_of:
- NamedThing
- LMToolSpec
range: string