Skip to content

Class: Prediction

Output of a DSPy module. Subclass of Example adding score, completions and per-call LM usage.

URI: dspy:Prediction

 classDiagram
    class Prediction
    click Prediction href "../Prediction/"
      Example <|-- Prediction
        click Example href "../Example/"


      Prediction <|-- EvaluationResult
        click EvaluationResult href "../EvaluationResult/"


      Prediction : completions





        Prediction --> "0..1" Completions : completions
        click Completions href "../Completions/"



      Prediction : description

      Prediction : fields





        Prediction --> "*" ExampleField : fields
        click ExampleField href "../ExampleField/"



      Prediction : id

      Prediction : input_keys

      Prediction : lm_usage





        Prediction --> "0..1" LMUsage : lm_usage
        click LMUsage href "../LMUsage/"



      Prediction : name

      Prediction : score

Inheritance

Class Properties

Property Value
Class URI dspy:Prediction

Slots

Name Cardinality and Range Description Inheritance
score 0..1
Float
Numeric score attached to a Prediction (used for arithmetic / comparison) direct
completions 0..1
Completions
Optional list of alternate completion candidates direct
lm_usage 0..1
LMUsage
Token usage attributed to the prediction direct
fields *
ExampleField
Named scalar fields carried by an Example / Prediction Example
input_keys *
String
Subset of fields flagged as inputs via ``with_inputs( Example
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
EvaluationRow prediction range Prediction

In Subsets

Identifier and Mapping Information

Annotations

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

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:Prediction
native dspy:Prediction
related uco_core:UcoObject

LinkML Source

Direct

name: Prediction
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/primitives/prediction.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/primitives/prediction.py
description: Output of a DSPy module. Subclass of ``Example`` adding score, completions
  and per-call LM usage.
in_subset:
- core
from_schema: https://w3id.org/lmodel/dspy
related_mappings:
- uco_core:UcoObject
is_a: Example
slots:
- score
- completions
- lm_usage
class_uri: dspy:Prediction

Induced

name: Prediction
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/primitives/prediction.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/primitives/prediction.py
description: Output of a DSPy module. Subclass of ``Example`` adding score, completions
  and per-call LM usage.
in_subset:
- core
from_schema: https://w3id.org/lmodel/dspy
related_mappings:
- uco_core:UcoObject
is_a: Example
attributes:
  score:
    name: score
    description: Numeric score attached to a Prediction (used for arithmetic / comparison).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Prediction
    domain_of:
    - Prediction
    - EvaluationRow
    range: float
  completions:
    name: completions
    description: Optional list of alternate completion candidates.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Prediction
    domain_of:
    - Prediction
    range: Completions
    inlined: true
  lm_usage:
    name: lm_usage
    description: Token usage attributed to the prediction.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Prediction
    domain_of:
    - Prediction
    range: LMUsage
    inlined: true
  fields:
    name: fields
    description: Named scalar fields carried by an ``Example`` / ``Prediction``.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Prediction
    domain_of:
    - Example
    range: ExampleField
    multivalued: true
    inlined: true
    inlined_as_list: true
  input_keys:
    name: input_keys
    description: Subset of ``fields`` flagged as inputs via ``with_inputs(...)``.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Prediction
    domain_of:
    - Example
    range: string
    multivalued: 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: Prediction
    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: Prediction
    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: Prediction
    domain_of:
    - NamedThing
    - LMToolSpec
    range: string
class_uri: dspy:Prediction