Skip to content

Class: LM

Concrete LiteLLM-backed language model (dspy.LM).

URI: dspy:LM

 classDiagram
    class LM
    click LM href "../LM/"
      BaseLM <|-- LM
        click BaseLM href "../BaseLM/"

      LM : cache

      LM : callbacks

      LM : description

      LM : finetuning_model

      LM : forward_contract





        LM --> "0..1" ForwardContract : forward_contract
        click ForwardContract href "../ForwardContract/"



      LM : history





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



      LM : id

      LM : launch_kwargs





        LM --> "0..1" Any : launch_kwargs
        click Any href "../Any/"



      LM : max_tokens

      LM : model

      LM : model_type





        LM --> "0..1" ModelType : model_type
        click ModelType href "../ModelType/"



      LM : name

      LM : num_retries

      LM : provider





        LM --> "0..1" Provider : provider
        click Provider href "../Provider/"



      LM : temperature

      LM : train_kwargs





        LM --> "0..1" Any : train_kwargs
        click Any href "../Any/"



      LM : use_developer_role

Inheritance

Slots

Name Cardinality and Range Description Inheritance
provider 0..1
Provider
direct
finetuning_model 0..1
ModelName
direct
launch_kwargs 0..1
Any
direct
train_kwargs 0..1
Any
direct
model 0..1
ModelName
LiteLLM-style provider/model identifier BaseLM
model_type 0..1
ModelType
Which LiteLLM API contract to use (chat / text / responses) BaseLM
temperature 0..1
Float
BaseLM
max_tokens 0..1
Integer
BaseLM
cache 0..1
Boolean
Whether responses for this LM should be cached BaseLM
num_retries 0..1
Integer
BaseLM
callbacks *
String
Dotted import paths of callbacks registered on the module BaseLM
use_developer_role 0..1
Boolean
BaseLM
forward_contract 0..1
ForwardContract
BaseLM
history *
LMHistoryEntry
Per-module call history of LM requests / responses BaseLM
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

Aliases

  • language_model
  • llm

Identifier and Mapping Information

Annotations

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

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:LM
native dspy:LM
exact nexus:LargeLanguageModel
broad ai:AISystem
related ai:FineTunedModel, nist_ai_100_1:AiSpecificRisk
close ai:LLM, legal_eu_aiact:AISystem, iso22989:AISystem, mellea:BackendSpec, nist_ai_100_1:AiSystem, ucs_core:Software

LinkML Source

Direct

name: LM
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/clients/lm.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/clients/lm.py
description: Concrete LiteLLM-backed language model (``dspy.LM``).
in_subset:
- clients
from_schema: https://w3id.org/lmodel/dspy
aliases:
- language_model
- llm
exact_mappings:
- nexus:LargeLanguageModel
close_mappings:
- ai:LLM
- legal_eu_aiact:AISystem
- iso22989:AISystem
- mellea:BackendSpec
- nist_ai_100_1:AiSystem
- ucs_core:Software
related_mappings:
- ai:FineTunedModel
- nist_ai_100_1:AiSpecificRisk
broad_mappings:
- ai:AISystem
is_a: BaseLM
slots:
- provider
- finetuning_model
- launch_kwargs
- train_kwargs

Induced

name: LM
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/clients/lm.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/clients/lm.py
description: Concrete LiteLLM-backed language model (``dspy.LM``).
in_subset:
- clients
from_schema: https://w3id.org/lmodel/dspy
aliases:
- language_model
- llm
exact_mappings:
- nexus:LargeLanguageModel
close_mappings:
- ai:LLM
- legal_eu_aiact:AISystem
- iso22989:AISystem
- mellea:BackendSpec
- nist_ai_100_1:AiSystem
- ucs_core:Software
related_mappings:
- ai:FineTunedModel
- nist_ai_100_1:AiSpecificRisk
broad_mappings:
- ai:AISystem
is_a: BaseLM
attributes:
  provider:
    name: provider
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LM
    range: Provider
    inlined: true
  finetuning_model:
    name: finetuning_model
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LM
    range: ModelName
  launch_kwargs:
    name: launch_kwargs
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LM
    range: Any
  train_kwargs:
    name: train_kwargs
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LM
    - TrainingJob
    - ReinforceJob
    - BootstrapFinetune
    range: Any
  model:
    name: model
    description: LiteLLM-style ``provider/model`` identifier.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LMRequest
    - LMResponse
    - BaseLM
    - TrainingJob
    range: ModelName
  model_type:
    name: model_type
    description: Which LiteLLM API contract to use (chat / text / responses).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - BaseLM
    range: ModelType
  temperature:
    name: temperature
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LMConfig
    - BaseLM
    range: float
    minimum_value: 0.0
    maximum_value: 2.0
  max_tokens:
    name: max_tokens
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - LMReasoningConfig
    - LMConfig
    - BaseLM
    range: integer
    minimum_value: 0
  cache:
    name: cache
    description: Whether responses for this LM should be cached.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: boolean(True)
    owner: LM
    domain_of:
    - BaseLM
    range: boolean
  num_retries:
    name: num_retries
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: int(3)
    owner: LM
    domain_of:
    - BaseLM
    range: integer
    minimum_value: 0
  callbacks:
    name: callbacks
    description: Dotted import paths of callbacks registered on the module.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - BaseLM
    - Adapter
    - Module
    - Settings
    range: string
    multivalued: true
  use_developer_role:
    name: use_developer_role
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: boolean(False)
    owner: LM
    domain_of:
    - BaseLM
    range: boolean
  forward_contract:
    name: forward_contract
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: string(legacy)
    owner: LM
    domain_of:
    - BaseLM
    range: ForwardContract
  history:
    name: history
    description: Per-module call history of LM requests / responses.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LM
    domain_of:
    - BaseLM
    - Module
    range: LMHistoryEntry
    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: LM
    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: LM
    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: LM
    domain_of:
    - NamedThing
    - LMToolSpec
    range: string