Python API Reference#
This reference is auto-generated from source code docstrings.
Core Classes#
The primary entry points for the NeMo Guardrails library.
Rails based on a given configuration. |
|
Configuration object for the models and the rails. |
Generation Options and Responses#
Control generation behavior and inspect results.
A set of options that should be applied during a generation. |
|
Options for what rails should be used during the generation. |
|
Options for what should be included in the generation log. |
|
Contains additional logging information associated with a generation call. |
|
General stats about the generation. |
|
A rail that was activated during the generation. |
|
Information about an action that was executed. |
Actions#
Register custom Python functions as actions for use in guardrails flows.
Decorator to mark a function or class as an action. |
Enumerations#
An enumeration. |
|
An enumeration. |
|
Extensibility — LLM types and protocols#
Public types used by the Custom LLM Model and Custom LLM Framework extension paths.
Protocol that all LLM backends must implement. |
|
Protocol for pluggable LLM framework backends. |
|
ChatMessage(role: nemoguardrails.types.Role, content: Union[str, List[Dict[str, Any]], NoneType] = None, tool_calls: Optional[List[nemoguardrails.types.ToolCall]] = None, tool_call_id: Optional[str] = None, name: Optional[str] = None, provider_metadata: Dict[str, Any] = <factory>) |
|
LLMResponse(content: str, reasoning: Optional[str] = None, tool_calls: Optional[List[nemoguardrails.types.ToolCall]] = None, model: Optional[str] = None, finish_reason: Optional[Literal['stop', 'length', 'tool_calls', 'content_filter', 'error', 'other']] = None, stop_sequence: Optional[str] = None, request_id: Optional[str] = None, usage: Optional[nemoguardrails.types.UsageInfo] = None, provider_metadata: Optional[Dict[str, Any]] = None) |
|
LLMResponseChunk(delta_content: Optional[str] = None, delta_reasoning: Optional[str] = None, delta_tool_calls: Optional[List[nemoguardrails.types.ToolCall]] = None, model: Optional[str] = None, finish_reason: Optional[Literal['stop', 'length', 'tool_calls', 'content_filter', 'error', 'other']] = None, request_id: Optional[str] = None, usage: Optional[nemoguardrails.types.UsageInfo] = None, provider_metadata: Optional[Dict[str, Any]] = None) |
|
ToolCall(id: str, type: str = 'function', function: nemoguardrails.types.ToolCallFunction = <factory>) |
|
ToolCallFunction(name: str, arguments: Dict[str, Any]) |
|
UsageInfo(input_tokens: int = 0, output_tokens: int = 0, total_tokens: int = 0, reasoning_tokens: Optional[int] = None, cached_tokens: Optional[int] = None) |