GuardRailChatResponse

class openapi_client.models.guard_rail_chat_response.GuardRailChatResponse(**data)[source]

Bases: BaseModel

Response from guard rail chat endpoint.

guard_rail_intervention: StrictBool
guard_rail_intervention_reason: StrictStr
model_response: StrictStr
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str()[source]

Returns the string representation of the model using alias

Return type:

str

to_json()[source]

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str)[source]

Create an instance of GuardRailChatResponse from a JSON string

Return type:

Optional[Self]

to_dict()[source]

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj)[source]

Create an instance of GuardRailChatResponse from a dict

Return type:

Optional[Self]

model_fields: ClassVar[dict[str, FieldInfo]] = {'guard_rail_intervention': FieldInfo(annotation=bool, required=True, alias='GuardRailIntervention', alias_priority=2, description='Whether guard rail intervention occurred (true) or not (false).', metadata=[Strict(strict=True)]), 'guard_rail_intervention_reason': FieldInfo(annotation=str, required=True, alias='GuardRailInterventionReason', alias_priority=2, description='Reason for guard rail intervention if intervention occurred, empty string otherwise.', metadata=[Strict(strict=True)]), 'model_response': FieldInfo(annotation=str, required=True, alias='ModelResponse', alias_priority=2, description="The model's response text. Empty if guard rail intervention occurred.", metadata=[Strict(strict=True)])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • __context (Any) – The context.

Return type:

None