nemoguardrails.types.LLMModel#
- class nemoguardrails.types.LLMModel[source]#
Bases:
ProtocolProtocol that all LLM backends must implement.
Adapters wrap provider-specific SDKs (LangChain, LiteLLM, OpenAI, etc.) behind this interface so the core pipeline remains framework-agnostic.
promptaccepts either a plain string or a list ofChatMessageobjects. Adapters convertChatMessageto whatever their SDK expects.**kwargsare forwarded to the underlying SDK (e.g. temperature, max_tokens).- async generate_async(prompt, *, stop=None, **kwargs)[source]#
- Return type:
- Parameters:
prompt (str | List[ChatMessage])
stop (List[str] | None)
- stream_async(prompt, *, stop=None, **kwargs)[source]#
Implementations must be async generator functions (use
yield).- Return type:
AsyncIterator[LLMResponseChunk]- Parameters:
prompt (str | List[ChatMessage])
stop (List[str] | None)
- property model_name: str#
- property provider_name: str | None#
- property provider_url: str | None#
- __init__(*args, **kwargs)#