Django ORM
All models for the Guardrail app.
- class smarter.apps.guardrail.models.Guardrail(*args, **kwargs)[source]
Bases:
MetaDataWithOwnershipModelImplements the Guardrail API model.
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
name (Unknown) – Name. Name in camelCase, e.g., ‘apiKey’, no special characters.
description (Unknown) – Description. A brief description of this resource. Be verbose, but not too verbose.
version (Unknown) – Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.
annotations (Unknown) – Annotations. Key-value pairs for annotating this resource.
guardrail_type (Unknown) – Guardrail type
category (Unknown) – Category
match_strategy (Unknown) – Match strategy
pattern (Unknown) – Pattern. Regex, keyword list (newline/comma), or judge prompt template depending on match_strategy.
config (Unknown) – Config. Strategy-specific params: similarity_threshold, model_id, temperature, few-shot examples, etc.
action (Unknown) – Action
severity (Unknown) – Severity. 1=low … 5=critical; drives alerting/escalation thresholds.
confidence_threshold (Unknown) – Confidence threshold. Minimum confidence score to trigger action, for model/semantic strategies.
is_active (Unknown) – Is active
is_blocking (Unknown) – Is blocking. If False, action runs in shadow/log-only mode regardless of action.
priority (Unknown) – Priority. Execution order when multiple guardrails match; lower runs first.
fallback_message (Unknown) – Fallback message. User-facing message returned when action=BLOCK.
Relationship fields:
- Parameters:
user_profile (Unknown) – User profile (related name:
guardrail)tags (Unknown) – Tags. Tags for categorizing and organizing this resource. (related name:
guardrail)tagged_items (Unknown) – Tagged items (related name:
+)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- category
-
Category
Choices:
piijailbreaktoxicityhallucinationoff_topiccompliancecustom
- Type:
Type
- confidence_threshold
-
Confidence threshold. Minimum confidence score to trigger action, for model/semantic strategies.
- Type:
Type
- config
-
Config. Strategy-specific params: similarity_threshold, model_id, temperature, few-shot examples, etc.
- Type:
Type
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- description
-
Description. A brief description of this resource. Be verbose, but not too verbose.
- Type:
Type
- fallback_message
-
Fallback message. User-facing message returned when action=BLOCK.
- Type:
Type
- get_action_display(*, field=<django.db.models.CharField: action>)
Shows the label of the
action. Seeget_FOO_display()for more information.
- get_category_display(*, field=<django.db.models.CharField: category>)
Shows the label of the
category. Seeget_FOO_display()for more information.
- get_guardrail_type_display(*, field=<django.db.models.CharField: guardrail_type>)
Shows the label of the
guardrail_type. Seeget_FOO_display()for more information.
- get_match_strategy_display(*, field=<django.db.models.CharField: match_strategy>)
Shows the label of the
match_strategy. Seeget_FOO_display()for more information.
- id
-
Primary key: ID
- Type:
Type
- is_active
-
Is active
- Type:
Type
- is_blocking
-
Is blocking. If False, action runs in shadow/log-only mode regardless of action.
- Type:
Type
- pattern
-
Pattern. Regex, keyword list (newline/comma), or judge prompt template depending on match_strategy.
- Type:
Type
- priority
-
Priority. Execution order when multiple guardrails match; lower runs first.
- Type:
Type
- severity
-
Severity. 1=low … 5=critical; drives alerting/escalation thresholds.
- Type:
Type
- tagged_items
Reverse
GenericRelationfromGuardrailAll + of this tagged item (related name of
tagged_items)- Type:
Type
- tags = <taggit.managers._TaggableManager object>
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- user_profile
-
User profile (related name:
guardrail)- Type:
Type
- user_profile_id
Internal field, use
user_profileinstead.