Base Classes¶
- pydantic model ibm_watsonx_gov.entities.base_classes.BaseConfiguration¶
Bases:
BaseModel
Show JSON schema
{ "title": "BaseConfiguration", "type": "object", "properties": { "record_id_field": { "default": "record_id", "description": "The record identifier field name.", "examples": [ "record_id" ], "title": "Record id field", "type": "string" }, "record_timestamp_field": { "default": "record_timestamp", "description": "The record timestamp field name.", "examples": [ "record_timestamp" ], "title": "Record timestamp field", "type": "string" } } }
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- field record_id_field: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='record_id', title='Record id field', description='The record identifier field name.', examples=['record_id'])] = 'record_id'¶
The record identifier field name.
- field record_timestamp_field: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='record_timestamp', title='Record timestamp field', description='The record timestamp field name.', examples=['record_timestamp'])] = 'record_timestamp'¶
The record timestamp field name.
- pydantic model ibm_watsonx_gov.entities.base_classes.BaseMetric¶
Bases:
BaseModel
Show JSON schema
{ "title": "BaseMetric", "type": "object", "properties": { "name": { "description": "The name of the metric.", "examples": [ "answer_relevance", "context_relevance" ], "title": "Metric Name", "type": "string" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The display name of the metric.", "examples": [ "Answer Relevance", "Context Relevance" ], "title": "Metric display name" }, "type_": { "default": "ootb", "description": "The type of the metric. Indicates whether the metric is ootb or custom.", "examples": [ "ootb", "custom" ], "title": "Metric type", "type": "string" }, "value_type": { "default": "numeric", "description": "The type of the metric value. Indicates whether the metric value is numeric or categorical.", "examples": [ "numeric", "categorical" ], "title": "Metric value type", "type": "string" } }, "required": [ "name" ] }
- field display_name: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Metric display name', description='The display name of the metric.', examples=['Answer Relevance', 'Context Relevance'])] = None¶
The display name of the metric.
- field name: Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Metric Name', description='The name of the metric.', examples=['answer_relevance', 'context_relevance'], frozen=True)] [Required]¶
The name of the metric.
- field type_: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='ootb', alias_priority=2, serialization_alias='type', title='Metric type', description='The type of the metric. Indicates whether the metric is ootb or custom.', examples=['ootb', 'custom'], frozen=True)] = 'ootb'¶
The type of the metric. Indicates whether the metric is ootb or custom.
- field value_type: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='numeric', alias_priority=2, serialization_alias='type', title='Metric value type', description='The type of the metric value. Indicates whether the metric value is numeric or categorical.', examples=['numeric', 'categorical'])] = 'numeric'¶
The type of the metric value. Indicates whether the metric value is numeric or categorical.
- model_post_init(context: Any, /) None ¶
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 – The BaseModel instance.
context – The context.
- property id¶
- pydantic model ibm_watsonx_gov.entities.base_classes.BaseMetricGroup¶
Bases:
BaseModel
Show JSON schema
{ "title": "BaseMetricGroup", "type": "object", "properties": { "name": { "description": "The name of the metric group", "title": "Name", "type": "string" } }, "required": [ "name" ] }
- Fields:
- field name: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='The name of the metric group')] [Required]¶
The name of the metric group
- model_post_init(context: Any, /) None ¶
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 – The BaseModel instance.
context – The context.
- property metrics: list[BaseMetric]¶
- pydantic model ibm_watsonx_gov.entities.base_classes.BaseMetricResult¶
Bases:
BaseModel
Show JSON schema
{ "title": "BaseMetricResult", "type": "object", "properties": { "name": { "description": "The name of the metric.", "examples": [ "answer_relevance", "context_relevance" ], "title": "Metric Name", "type": "string" }, "display_name": { "description": "The display name of the metric.", "examples": [ "Answer Relevance", "Context Relevance" ], "title": "Metric display name", "type": "string" }, "value_type": { "default": "numeric", "description": "The type of the metric value. Indicates whether the metric value is numeric or categorical.", "examples": [ "numeric", "categorical" ], "title": "Metric value type", "type": "string" }, "method": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The method used to compute this metric result.", "examples": [ "token_recall" ], "title": "Method" }, "provider": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The provider used to compute this metric result.", "title": "Provider" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "boolean" }, { "additionalProperties": { "type": "integer" }, "type": "object" }, { "type": "null" } ], "description": "The metric value.", "title": "Value" }, "label": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The string equivalent of the metric value. This is used for metrics with categorical value type.", "title": "Label" }, "errors": { "anyOf": [ { "items": { "$ref": "#/$defs/Error" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The list of error messages", "title": "Errors" }, "additional_info": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "description": "The additional information about the metric result.", "title": "Additional Info" }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The explanation about the metric result.", "title": "Explanation" }, "group": { "anyOf": [ { "$ref": "#/$defs/MetricGroup" }, { "type": "null" } ], "default": null, "description": "The metric group", "title": "Group" }, "thresholds": { "default": [], "description": "The metric thresholds", "items": { "$ref": "#/$defs/MetricThreshold" }, "title": "Thresholds", "type": "array" } }, "$defs": { "Error": { "properties": { "code": { "description": "The error code", "title": "Code", "type": "string" }, "message_en": { "description": "The error message in English.", "title": "Message En", "type": "string" }, "parameters": { "default": [], "description": "The list of parameters to construct the message in a different locale.", "items": {}, "title": "Parameters", "type": "array" } }, "required": [ "code", "message_en" ], "title": "Error", "type": "object" }, "MetricGroup": { "enum": [ "retrieval_quality", "answer_quality", "content_safety", "performance", "usage", "message_completion", "tool_call_quality", "readability", "custom" ], "title": "MetricGroup", "type": "string" }, "MetricThreshold": { "description": "The class that defines the threshold for a metric.", "properties": { "type": { "description": "Threshold type. One of 'lower_limit', 'upper_limit'", "enum": [ "lower_limit", "upper_limit" ], "title": "Type", "type": "string" }, "value": { "default": 0, "description": "The value of metric threshold", "title": "Threshold value", "type": "number" } }, "required": [ "type" ], "title": "MetricThreshold", "type": "object" } }, "required": [ "name", "display_name", "value" ] }
- Config:
arbitrary_types_allowed: bool = True
use_enum_values: bool = True
- Fields:
- field additional_info: Annotated[dict | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Additional Info', description='The additional information about the metric result.')] = None¶
The additional information about the metric result.
- field display_name: Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Metric display name', description='The display name of the metric.', examples=['Answer Relevance', 'Context Relevance'], frozen=True)] [Required]¶
The display name of the metric.
- field errors: Annotated[list[Error] | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Errors', description='The list of error messages')] = None¶
The list of error messages
- field explanation: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Explanation', description='The explanation about the metric result.')] = None¶
The explanation about the metric result.
- field group: Annotated[MetricGroup | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Group', description='The metric group')] = None¶
The metric group
- field label: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Label', description='The string equivalent of the metric value. This is used for metrics with categorical value type.')] = None¶
The string equivalent of the metric value. This is used for metrics with categorical value type.
- field method: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Method', description='The method used to compute this metric result.', examples=['token_recall'])] = None¶
The method used to compute this metric result.
- field name: Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Metric Name', description='The name of the metric.', examples=['answer_relevance', 'context_relevance'], frozen=True)] [Required]¶
The name of the metric.
- field provider: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, title='Provider', description='The provider used to compute this metric result.')] = None¶
The provider used to compute this metric result.
- field thresholds: Annotated[list[MetricThreshold], FieldInfo(annotation=NoneType, required=False, default=[], title='Thresholds', description='The metric thresholds')] = []¶
The metric thresholds
- field value: Annotated[float | str | bool | dict[str, int] | None, FieldInfo(annotation=NoneType, required=True, title='Value', description='The metric value.')] [Required]¶
The metric value.
- field value_type: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='numeric', alias_priority=2, serialization_alias='type', title='Metric value type', description='The type of the metric value. Indicates whether the metric value is numeric or categorical.', examples=['numeric', 'categorical'])] = 'numeric'¶
The type of the metric value. Indicates whether the metric value is numeric or categorical.
- pydantic model ibm_watsonx_gov.entities.base_classes.Error¶
Bases:
BaseModel
Show JSON schema
{ "title": "Error", "type": "object", "properties": { "code": { "description": "The error code", "title": "Code", "type": "string" }, "message_en": { "description": "The error message in English.", "title": "Message En", "type": "string" }, "parameters": { "default": [], "description": "The list of parameters to construct the message in a different locale.", "items": {}, "title": "Parameters", "type": "array" } }, "required": [ "code", "message_en" ] }
- field code: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='The error code')] [Required]¶
The error code
- field message_en: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='The error message in English.')] [Required]¶
The error message in English.
- field parameters: Annotated[list[Any], FieldInfo(annotation=NoneType, required=False, default=[], description='The list of parameters to construct the message in a different locale.')] = []¶
The list of parameters to construct the message in a different locale.