nemoguardrails.types.LLMFramework#
- class nemoguardrails.types.LLMFramework[source]#
Bases:
ProtocolProtocol for pluggable LLM framework backends.
Each framework (LangChain, LiteLLM, etc.) implements this protocol to provide a factory for creating
LLMModelinstances and managing its own set of providers.model_kwargscarries all provider-specific configuration. Framework implementations extract what they need (e.g. LangChain popsmodeto choose between chat and text completion models).- create_model(
- model_name,
- provider_name,
- model_kwargs=None,
- Return type:
- Parameters:
model_name (str)
provider_name (str)
model_kwargs (Dict[str, Any] | None)
- register_provider(name, provider_cls)[source]#
- Return type:
None- Parameters:
name (str)
provider_cls (Any)
- async reset()[source]#
Release all framework-owned resources and clear all registered state.
Implementations should close any pooled connections, clear registered providers, and return the framework to its initial state. Callers can continue using the instance after reset; new resources will be created on demand.
- Return type:
None
- __init__(*args, **kwargs)#