Skip to content

Class: Adapter

Base class for prompt-format adapters (dspy.Adapter).

  • NOTE: this is an abstract class and should not be instantiated directly

URI: dspy:Adapter

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


      Adapter <|-- ChatAdapter
        click ChatAdapter href "../ChatAdapter/"
      Adapter <|-- JSONAdapter
        click JSONAdapter href "../JSONAdapter/"
      Adapter <|-- XMLAdapter
        click XMLAdapter href "../XMLAdapter/"
      Adapter <|-- BAMLAdapter
        click BAMLAdapter href "../BAMLAdapter/"
      Adapter <|-- TwoStepAdapter
        click TwoStepAdapter href "../TwoStepAdapter/"


      Adapter : adapter_kind

      Adapter : callbacks

      Adapter : description

      Adapter : id

      Adapter : name

      Adapter : native_response_types

      Adapter : parallel_tool_calls

      Adapter : use_native_function_calling

Inheritance

Slots

Name Cardinality and Range Description Inheritance
adapter_kind 1
String
Concrete adapter implementation (matches an AdapterKind value) direct
callbacks *
String
Dotted import paths of callbacks registered on the module direct
use_native_function_calling 0..1
Boolean
direct
parallel_tool_calls 0..1
Boolean
direct
native_response_types *
String
Output field types handled by native LM features rather than adapter parsing 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
Settings adapter range Adapter

In Subsets

Identifier and Mapping Information

Annotations

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

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:Adapter
native dspy:Adapter
exact nexus:Adapter
related iso22989:EngineeringApproach, uco_tool:ConfiguredTool
close mellea:FormatterSpec

LinkML Source

Direct

name: Adapter
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/adapters/base.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/adapters/base.py
description: Base class for prompt-format adapters (``dspy.Adapter``).
in_subset:
- adapters
from_schema: https://w3id.org/lmodel/dspy
exact_mappings:
- nexus:Adapter
close_mappings:
- mellea:FormatterSpec
related_mappings:
- iso22989:EngineeringApproach
- uco_tool:ConfiguredTool
is_a: NamedThing
abstract: true
slots:
- adapter_kind
- callbacks
attributes:
  use_native_function_calling:
    name: use_native_function_calling
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: boolean(False)
    domain_of:
    - Adapter
    range: boolean
  parallel_tool_calls:
    name: parallel_tool_calls
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    domain_of:
    - Adapter
    range: boolean
  native_response_types:
    name: native_response_types
    description: Output field types handled by native LM features rather than adapter
      parsing.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    domain_of:
    - Adapter
    range: string
    multivalued: true

Induced

name: Adapter
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/adapters/base.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/adapters/base.py
description: Base class for prompt-format adapters (``dspy.Adapter``).
in_subset:
- adapters
from_schema: https://w3id.org/lmodel/dspy
exact_mappings:
- nexus:Adapter
close_mappings:
- mellea:FormatterSpec
related_mappings:
- iso22989:EngineeringApproach
- uco_tool:ConfiguredTool
is_a: NamedThing
abstract: true
attributes:
  use_native_function_calling:
    name: use_native_function_calling
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: boolean(False)
    owner: Adapter
    domain_of:
    - Adapter
    range: boolean
  parallel_tool_calls:
    name: parallel_tool_calls
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Adapter
    domain_of:
    - Adapter
    range: boolean
  native_response_types:
    name: native_response_types
    description: Output field types handled by native LM features rather than adapter
      parsing.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Adapter
    domain_of:
    - Adapter
    range: string
    multivalued: true
  adapter_kind:
    name: adapter_kind
    description: Concrete adapter implementation (matches an ``AdapterKind`` value).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Adapter
    domain_of:
    - Adapter
    range: string
    required: true
  callbacks:
    name: callbacks
    description: Dotted import paths of callbacks registered on the module.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: Adapter
    domain_of:
    - BaseLM
    - Adapter
    - Module
    - Settings
    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: Adapter
    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: Adapter
    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: Adapter
    domain_of:
    - NamedThing
    - LMToolSpec
    range: string