nemoguardrails.library.crowdstrike_aidr.actions

View as Markdown

Module Contents

Classes

Functions

NameDescription
_crowdstrike_aidr_outcomeConvert a CrowdStrike result into a rail decision.
crowdstrike_aidr_guardEvaluate conversation content with CrowdStrike AI Guard.
get_crowdstrike_aidr_config-

Data

log

API

class nemoguardrails.library.crowdstrike_aidr.actions.GuardChatCompletionsResponse()

Bases: BaseModel

result
GuardChatCompletionsResult
class nemoguardrails.library.crowdstrike_aidr.actions.GuardChatCompletionsResult()

Bases: BaseModel

blocked
Optional[bool] = None

Whether or not the prompt triggered a block detection.

bot_message
Optional[str] = None
guard_output
Optional[GuardOutput] = None

Updated structured prompt, if applicable.

transformed
Optional[bool] = None

Whether or not the original input was transformed.

user_message
Optional[str] = None
class nemoguardrails.library.crowdstrike_aidr.actions.GuardOutput

Bases: typing.TypedDict

messages
list[Message]
class nemoguardrails.library.crowdstrike_aidr.actions.Message()

Bases: BaseModel

content
str
role
str
nemoguardrails.library.crowdstrike_aidr.actions._crowdstrike_aidr_outcome(
result: nemoguardrails.library.crowdstrike_aidr.actions.GuardChatCompletionsResult,
mode: typing_extensions.Literal['input', 'output']
) -> nemoguardrails.actions.rail_outcome.RailOutcome

Convert a CrowdStrike result into a rail decision.

Blocking takes precedence over transformation. A transformed input rewrites the user message, while a transformed output rewrites the bot message.

nemoguardrails.library.crowdstrike_aidr.actions.crowdstrike_aidr_guard(
mode: typing_extensions.Literal['input', 'output'],
config: nemoguardrails.rails.llm.config.RailsConfig,
context: collections.abc.Mapping[str, typing.Any] = {},
user_message: typing.Optional[str] = None,
bot_message: typing.Optional[str] = None,
http_client: typing.Optional[nemoguardrails.http.HTTPClient] = None
) -> nemoguardrails.actions.rail_outcome.RailOutcome
async

Evaluate conversation content with CrowdStrike AI Guard.

The action evaluates the user message for input rails and includes the bot message for output rails. A successful provider response can allow, block, or transform the active message.

Expected provider failures fail open: unsuccessful HTTP status responses, transport failures, malformed JSON, and response-schema validation errors are logged and return an allow outcome containing the original messages. Unexpected programming errors are not swallowed.

Parameters:

mode
Literal['input', 'output']

Whether the action is evaluating an input or output rail.

config
RailsConfig

Active rails configuration.

context
Mapping[str, Any]Defaults to {}

Conversation context used when explicit messages are omitted.

user_message
Optional[str]Defaults to None

Optional user message override.

bot_message
Optional[str]Defaults to None

Optional bot message override.

http_client
Optional[HTTPClient]Defaults to None

Optional caller-owned HTTP client. The action does not close an injected client.

Returns: RailOutcome

The provider-derived rail outcome, or an allow outcome for an expected

Raises:

  • ValueError: If the API token or required conversation content is missing.
nemoguardrails.library.crowdstrike_aidr.actions.get_crowdstrike_aidr_config(
config: nemoguardrails.rails.llm.config.RailsConfig
) -> nemoguardrails.rails.llm.config.CrowdStrikeAIDRRailConfig
nemoguardrails.library.crowdstrike_aidr.actions.log = logging.getLogger(__name__)