Skip to content

Class: Module

Base class for DSPy programs (dspy.Module).

URI: dspy:Module

 classDiagram
    class Module
    click Module href "../Module/"
      NamedThing <|-- Module
        click NamedThing href "../NamedThing/"


      Module <|-- Predictor
        click Predictor href "../Predictor/"
      Module <|-- BestOfN
        click BestOfN href "../BestOfN/"
      Module <|-- Refine
        click Refine href "../Refine/"
      Module <|-- KNN
        click KNN href "../KNN/"
      Module <|-- Parallel
        click Parallel href "../Parallel/"
      Module <|-- RLM
        click RLM href "../RLM/"
      Module <|-- Aggregator
        click Aggregator href "../Aggregator/"
      Module <|-- Retriever
        click Retriever href "../Retriever/"


      Module : callbacks

      Module : compiled

      Module : description

      Module : history





        Module --> "*" LMHistoryEntry : history
        click LMHistoryEntry href "../LMHistoryEntry/"



      Module : id

      Module : name

      Module : predictors





        Module --> "*" Predictor : predictors
        click Predictor href "../Predictor/"



      Module : sub_modules





        Module --> "*" Module : sub_modules
        click Module href "../Module/"



Inheritance

Class Properties

Property Value
Class URI dspy:Module

Slots

Name Cardinality and Range Description Inheritance
compiled 0..1
Boolean
Whether the module has been compiled by a teleprompter direct
callbacks *
String
Dotted import paths of callbacks registered on the module direct
history *
LMHistoryEntry
Per-module call history of LM requests / responses direct
predictors *
Predictor
Predictor children of a composite Module (named_predictors()) direct
sub_modules *
Module
Nested Module children of a composite Module direct
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 sub_modules range Module
Predictor sub_modules range Module
Predict sub_modules range Module
ChainOfThought sub_modules range Module
MultiChainComparison sub_modules range Module
BestOfN module_under_test range Module
BestOfN sub_modules range Module
Refine module_under_test range Module
Refine sub_modules range Module
ReAct sub_modules range Module
ReActV2 sub_modules range Module
ProgramOfThought sub_modules range Module
CodeAct sub_modules range Module
KNN sub_modules range Module
Parallel sub_modules range Module
RLM sub_modules range Module
Aggregator sub_modules range Module
Retriever sub_modules range Module
Retrieve sub_modules range Module
Embeddings sub_modules range Module
EmbeddingsWithScores sub_modules range Module
ColBERTv2 sub_modules range Module

In Subsets

Aliases

  • program
  • dspy_program

Identifier and Mapping Information

Annotations

property value
dspy_source_paths ['dspy/primitives/module.py']
dspy_source_urls ['https://github.com/stanfordnlp/dspy/blob/main/dspy/primitives/module.py']

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:Module
native dspy:Module
related nexus:AiAgent, nexus:LLMIntrinsic, iso42001:MLApproach, mcp:Implementation, uco_tool:ConfiguredTool
close ai:AIAgent, legal_eu_aiact:AISystem, nexus:AiSystem, iso22989:AISystem, mellea:ComponentSpec, nist_ai_100_1:AiSystem, ucs_core:Software

LinkML Source

Direct

name: Module
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/primitives/module.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/primitives/module.py
description: Base class for DSPy programs (``dspy.Module``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
aliases:
- program
- dspy_program
close_mappings:
- ai:AIAgent
- legal_eu_aiact:AISystem
- nexus:AiSystem
- iso22989:AISystem
- mellea:ComponentSpec
- nist_ai_100_1:AiSystem
- ucs_core:Software
related_mappings:
- nexus:AiAgent
- nexus:LLMIntrinsic
- iso42001:MLApproach
- mcp:Implementation
- uco_tool:ConfiguredTool
is_a: NamedThing
slots:
- compiled
- callbacks
- history
- predictors
- sub_modules
class_uri: dspy:Module

Induced

name: Module
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/primitives/module.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/primitives/module.py
description: Base class for DSPy programs (``dspy.Module``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
aliases:
- program
- dspy_program
close_mappings:
- ai:AIAgent
- legal_eu_aiact:AISystem
- nexus:AiSystem
- iso22989:AISystem
- mellea:ComponentSpec
- nist_ai_100_1:AiSystem
- ucs_core:Software
related_mappings:
- nexus:AiAgent
- nexus:LLMIntrinsic
- iso42001:MLApproach
- mcp:Implementation
- uco_tool:ConfiguredTool
is_a: NamedThing
attributes:
  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: Module
    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: Module
    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: Module
    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: Module
    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: Module
    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: Module
    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: Module
    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: Module
    domain_of:
    - NamedThing
    - LMToolSpec
    range: string
class_uri: dspy:Module