LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_client_modelsDiscriminatorDetails
Class●Since v0.8

DiscriminatorDetails

Copy
DiscriminatorDetails(
  self,
  *,
  mapping: dict[str, type],
  discriminator_field: str,
  

Constructors

Attributes

View source on GitHub
discriminator_alias
:
str
|
None
)
constructor
__init__
NameType
mappingdict[str, type]
discriminator_fieldstr
discriminator_aliasstr | None
attribute
field_name: str
attribute
field_alias_from: str | None
attribute
mapping: dict[str, type]

Mapping of discriminator value to variant type, e.g.

{'foo': FooVariant, 'bar': BarVariant}

The name of the discriminator field in the variant class, e.g.

class Foo(BaseModel):
    type: Literal['foo']

Will result in field_name='type'

The name of the discriminator field in the API response, e.g.

class Foo(BaseModel):
    type: Literal['foo'] = Field(alias='type_from_api')

Will result in field_alias_from='type_from_api'