Groundedness
Groundedness metric.
This metric is used to evaluate the groundedness of the model's output.
References
None
GroundednessMetric(model=DefaultValues.MODEL, model_credentials=None, model_config=None, prompt_builder=None, response_schema=None, batch_status_check_interval=DefaultValues.BATCH_STATUS_CHECK_INTERVAL, batch_max_iterations=DefaultValues.BATCH_MAX_ITERATIONS)
Bases: LMBasedMetric
Groundedness metric.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the metric. |
response_schema |
ResponseSchema
|
The response schema to use for the metric. |
prompt_builder |
PromptBuilder
|
The prompt builder to use for the metric. |
model |
Union[str, ModelId, BaseLMInvoker]
|
The model to use for the metric. |
model_credentials |
str
|
The model credentials to use for the metric. |
model_config |
dict[str, Any] | None
|
The model config to use for the metric. Defaults to an empty dictionary. |
Initialize the GroundednessMetric class.
Default expected input: - query (str): The query to evaluate the groundedness of the model's output. - retrieved_context (str): The retrieved context to evaluate the groundedness of the model's output. - generated_response (str): The generated response to evaluate the groundedness of the model's output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Union[str, ModelId, BaseLMInvoker]
|
The model to use for the metric. |
MODEL
|
model_config
|
dict[str, Any] | None
|
The model config to use for the metric. Defaults to an empty dictionary. |
None
|
model_credentials
|
str | None
|
The model credentials to use for the metric. Defaults to None. |
None
|
prompt_builder
|
PromptBuilder | None
|
The prompt builder to use for the metric. Defaults to default prompt builder. |
None
|
response_schema
|
ResponseSchema | None
|
The response schema to use for the metric. Defaults to GroundednessResponseSchema. |
None
|
batch_status_check_interval
|
float
|
Time between batch status checks in seconds. Defaults to 30.0. |
BATCH_STATUS_CHECK_INTERVAL
|
batch_max_iterations
|
int
|
Maximum number of status check iterations before timeout. Defaults to 120. |
BATCH_MAX_ITERATIONS
|
GroundednessResponseSchema
Bases: BaseModel
Response schema for the groundedness metric.
Attributes:
| Name | Type | Description |
|---|---|---|
generated_response |
list[str]
|
The generated response. |
analysis |
list[str]
|
The analysis of the generated response. |
score |
int
|
The score of the generated response. |
explanation |
str
|
The explanation of the generated response. |