Configure particular Runnable fields at runtime.
The name of the Runnable. Used for debugging and tracing.
Input type.
Output Type.
The type of input this Runnable accepts specified as a Pydantic model.
Output schema.
List configurable fields for this Runnable.
Get the name of the Runnable.
Get a Pydantic model that can be used to validate input to the Runnable.
Get a JSON schema that represents the input to the Runnable.
Get a Pydantic model that can be used to validate output to the Runnable.
Answer typed questions about text, messages, or structured state.
A decision model evaluates shared state against one or more questions and returns
typed answers: a probability for a Noul, a selected label for a Choice, an
expected level for a Score, and a location for a Box. Answers keep their
probability distributions and confidence so applications can choose their own
thresholds.
Subclasses implement _classify, and optionally _aclassify, to call a provider.
This class handles callbacks, tracing metadata, and
token-usage reporting.
from langchain_core.decisions import BaseDecisionModel, ClassifierResponse
class MyDecisionModel(BaseDecisionModel):
model: str = "my-model"
@property
def _provider(self) -> str:
return "my_provider"
def _classify(self, state, questions):
body = my_client.classify(state=state, questions=questions)
return ClassifierResponse.model_validate(body)Get a JSON schema that represents the output of the Runnable.