(provider, kwargs) and import their langchain provider package lazily inside the build;
the registry accessors return the running event loop’s singletons that pool
checkpoint/store connection resources. Importing this package pulls
langchain_core / langgraph — that is the opt-in boundary (the
tai42_kit top level stays vendor-free).
MonitoringCallbackHandler
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler
writer under trace_context.
grouping_nodes names the framework nodes (langgraph_node) that hold steps rather
than being one; their chain records carry StepRole.GROUPING. chain_payloads
selects how chain runs record their input/output (see the module docstring).
Attributes
Members
on_chain_start
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_chain_start
on_chain_end
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_chain_end
on_chain_error
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_chain_error
on_chat_model_start
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_chat_model_start
on_llm_start
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_llm_start
on_llm_end
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_llm_end
on_llm_error
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_llm_error
on_tool_start
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_tool_start
on_tool_end
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_tool_end
on_tool_error
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_tool_error
on_retriever_start
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_retriever_start
on_retriever_end
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_retriever_end
on_retriever_error
tai42_kit.llm.monitoring_callbacks.MonitoringCallbackHandler.on_retriever_error
ToolNameTooLongError
tai42_kit.llm.models.ToolNameTooLongError
bind_run_trace
tai42_kit.llm.run_trace.bind_run_trace
config copied by value, with the monitoring callbacks for context appended after the caller’s own.
The copy is a fresh top-level mapping, a fresh configurable and a fresh callbacks list, so one base
config can feed many parallel invocations without colliding. A MonitoringCallbackHandler bound to
context is appended only when context is not None and the active writer records (is_recording()).
grouping_nodes names the framework nodes that hold steps rather than being one.
chain_payloads='references' (default) — each chain run records a manifest that
references the record where each value first appeared, by identity; 'producer' —
the producer records chain-run inputs/outputs itself. A run declared through
declared_chain_payload records the producer’s build result in either mode. Model
and tool runs are recorded in full either way.
Parameters
check_tool_name
tai42_kit.llm.models.check_tool_name
TOOL_NAME_MAX_LEN.
The bound is the strictest among the providers a bound tool is sent to; a longer name is
refused, never truncated (a truncated name would name a different tool).
Parameters
checkpoint_registry
tai42_kit.llm.checkpoint.checkpoint_registry.checkpoint_registry
close_all(), builds a fresh registry.
declared_chain_payload
tai42_kit.llm.monitoring_callbacks.declared_chain_payload
build(inputs) / build(outputs) as the payloads of LangChain run run_id started in the block.
The producer passes config["run_id"] = run_id to the run it starts (LangChain names
exactly that one run with it). build is called while the run’s span is current, so
it may read writer.current_span_id().
Parameters
get_classifier
tai42_kit.llm.classifier.get_classifier
provider with the given kwargs.
Parameters
get_classifier_async
tai42_kit.llm.classifier.get_classifier_async
provider, off the event loop.
Parameters
get_embedding
tai42_kit.llm.embedding.get_embedding
Embeddings client for provider with the given kwargs.
Parameters
get_embedding_async
tai42_kit.llm.embedding.get_embedding_async
Embeddings client for provider, off the event loop.
Parameters
get_llm
tai42_kit.llm.models.get_llm
provider with the given kwargs.
A set reasoning_effort is validated against the built model’s declared
capability after construction: the generic effort lever reaches the provider
constructor as a kwarg, and a level the model does not declare is refused loudly
here (see _validate_reasoning_effort) rather than failing opaquely on the
wire.
Parameters
get_llm_async
tai42_kit.llm.models.get_llm_async
provider in a worker thread, off the event loop.
Parameters
store_registry
tai42_kit.llm.store.store_registry.store_registry
close_all(), builds a fresh registry.
system_prompt_cache_mark
tai42_kit.llm.models.system_prompt_cache_mark
provider’s system prompt for caching, or None.
A provider that takes an explicit system-prompt cache breakpoint returns the
system_content_kwargs that carry it (the block build_system_message merges onto
the system message); a provider that caches its prefixes with no mark, or does not cache,
returns None. The match mirrors _build_llm’s so a provider name never leaves
this module and an unknown provider is refused loudly rather than silently un-marked.
Parameters
Classifier model factory and its provider-agnostic contract.
A classifier judges JSON-compatible state against typed questions and returns
typed answers — JSON in, JSON out. Three question kinds cover the common
judgments: a binary
noul (the probability that the answer is yes), a
categorical choice (one label from a fixed set, with a probability for every
label), and an ordinal score (an expected value over an ordered rubric). A
request pairs the state with a named mapping of questions; the response carries
one answer per question, token usage, and the provider’s request id.
These pydantic models ARE the platform’s classifier contract.
get_classifier and get_classifier_async build a cached,
provider-keyed runnable that accepts a ClassifyRequest and returns a
ClassifyResponse; each provider adapts this contract to its own wire
shape behind the factory. The models take no vendor import, so the contract can
be read and constructed without any provider package installed.
Every set a request declares is enforced by the factory’s runnable on every
call, whatever the provider: one answer per question name, of the question’s
kind; a choice label from the keys of its criteria; a score over
its levels. A response outside any of them raises ClassifierAnswerError,
so a caller never receives an answer it did not declare.
QuestionContent
tai42_kit.llm.classifier.QuestionContent
NoulCriteria
tai42_kit.llm.classifier.NoulCriteria
NoulQuestion
tai42_kit.llm.classifier.NoulQuestion
ChoiceQuestion
tai42_kit.llm.classifier.ChoiceQuestion
criteria, keyed by label to its description.
Attributes
ScoreQuestion
tai42_kit.llm.classifier.ScoreQuestion
criteria, an ordered rubric of two or more levels.
Attributes
ClassifyQuestion
tai42_kit.llm.classifier.ClassifyQuestion
type.
ClassifyRequest
tai42_kit.llm.classifier.ClassifyRequest
NoulAnswer
tai42_kit.llm.classifier.NoulAnswer
ChoiceAnswer
tai42_kit.llm.classifier.ChoiceAnswer
ScoreAnswer
tai42_kit.llm.classifier.ScoreAnswer
ClassifyAnswer
tai42_kit.llm.classifier.ClassifyAnswer
type.
ClassifierAnswerError
tai42_kit.llm.classifier.ClassifierAnswerError
choice question
declares its labels (the keys of its criteria) and a score question its levels
(0 to len(criteria) - 1). A response that answers other questions, answers one
with another kind, picks a label outside the labels, scores outside the levels, or keys
its probabilities or legend by anything but exactly those labels or levels breaks the
classifier contract. The request was valid, so the failure is the provider’s, and the
message names the question, what the provider gave, and what was declared.
ClassifyUsage
tai42_kit.llm.classifier.ClassifyUsage
ClassifyResponse
tai42_kit.llm.classifier.ClassifyResponse

