Skip to content

Class: LMConfig

Common generation controls for an LM request (dspy.LMConfig).

URI: dspy:LMConfig

 classDiagram
    class LMConfig
    click LMConfig href "../LMConfig/"
      LMConfig : cache_config





        LMConfig --> "0..1" LMCacheConfig : cache_config
        click LMCacheConfig href "../LMCacheConfig/"



      LMConfig : extensions





        LMConfig --> "0..1" Any : extensions
        click Any href "../Any/"



      LMConfig : logprobs_flag

      LMConfig : max_tokens

      LMConfig : n_outputs

      LMConfig : prompt_cache_config





        LMConfig --> "0..1" LMPromptCacheConfig : prompt_cache_config
        click LMPromptCacheConfig href "../LMPromptCacheConfig/"



      LMConfig : reasoning_config





        LMConfig --> "0..1" LMReasoningConfig : reasoning_config
        click LMReasoningConfig href "../LMReasoningConfig/"



      LMConfig : response_format





        LMConfig --> "0..1" Any : response_format
        click Any href "../Any/"



      LMConfig : stop

      LMConfig : temperature

      LMConfig : tool_choice





        LMConfig --> "0..1" LMToolChoice : tool_choice
        click LMToolChoice href "../LMToolChoice/"



      LMConfig : top_p

Slots

Name Cardinality and Range Description Inheritance
temperature 0..1
Float
direct
max_tokens 0..1
Integer
direct
top_p 0..1
Float
direct
stop *
String
Stop sequences direct
n_outputs 0..1
Integer
Number of LM completions to request (n field on LMConfig) direct
logprobs_flag 0..1
Boolean
Whether to return token log-probabilities direct
response_format 0..1
Any
direct
reasoning_config 0..1
LMReasoningConfig
direct
tool_choice 0..1
LMToolChoice
direct
cache_config 0..1
LMCacheConfig
direct
prompt_cache_config 0..1
LMPromptCacheConfig
direct
extensions 0..1
Any
Provider-specific extra request kwargs direct

Usages

used by used in type used
LMRequest config range LMConfig

In Subsets

Identifier and Mapping Information

Annotations

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

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:LMConfig
native dspy:LMConfig

LinkML Source

Direct

name: LMConfig
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/core/types.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/core/types.py
description: Common generation controls for an LM request (``dspy.LMConfig``).
in_subset:
- lm_contract
from_schema: https://w3id.org/lmodel/dspy
slots:
- temperature
- max_tokens
- top_p
- stop
- n_outputs
- logprobs_flag
- response_format
- reasoning_config
- tool_choice
- cache_config
- prompt_cache_config
- extensions

Induced

name: LMConfig
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/core/types.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/core/types.py
description: Common generation controls for an LM request (``dspy.LMConfig``).
in_subset:
- lm_contract
from_schema: https://w3id.org/lmodel/dspy
attributes:
  temperature:
    name: temperature
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    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: LMConfig
    domain_of:
    - LMReasoningConfig
    - LMConfig
    - BaseLM
    range: integer
    minimum_value: 0
  top_p:
    name: top_p
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: float
    minimum_value: 0.0
    maximum_value: 1.0
  stop:
    name: stop
    description: Stop sequences.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: string
    multivalued: true
  n_outputs:
    name: n_outputs
    description: Number of LM completions to request (``n`` field on LMConfig).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: integer
    minimum_value: 1
  logprobs_flag:
    name: logprobs_flag
    description: Whether to return token log-probabilities.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: boolean
  response_format:
    name: response_format
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: Any
  reasoning_config:
    name: reasoning_config
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: LMReasoningConfig
    inlined: true
  tool_choice:
    name: tool_choice
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: LMToolChoice
    inlined: true
  cache_config:
    name: cache_config
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: LMCacheConfig
    inlined: true
  prompt_cache_config:
    name: prompt_cache_config
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: LMPromptCacheConfig
    inlined: true
  extensions:
    name: extensions
    description: Provider-specific extra request kwargs.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: LMConfig
    domain_of:
    - LMConfig
    range: Any