nemoguardrails.types.LLMFramework#

class nemoguardrails.types.LLMFramework[source]#

Bases: Protocol

Protocol for pluggable LLM framework backends.

Each framework (LangChain, LiteLLM, etc.) implements this protocol to provide a factory for creating LLMModel instances and managing its own set of providers.

model_kwargs carries all provider-specific configuration. Framework implementations extract what they need (e.g. LangChain pops mode to choose between chat and text completion models).

create_model(
model_name,
provider_name,
model_kwargs=None,
)[source]#
Return type:

LLMModel

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)

get_provider_names()[source]#
Return type:

List[str]

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)#