> ## Documentation Index
> Fetch the complete documentation index at: https://pype-db52d533.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Multimodal Contextual Precision

The MultimodalContextualPrecisionMetric is a multimodal metric designed to evaluate the precision of generated outputs in relation to the provided context. It assesses how accurately the generated output reflects the relevant context, serving as a proxy for evaluating the performance of models that generate text based on multimodal inputs.

### **Required Arguments**

* input: A list containing the prompt or question related to the image or context.
* actual\_output: A list containing the generated textual description or answer.
* expected\_output: A list containing the expected textual description or answer.
* retrieval\_context: A list containing the contextual information or description of the image.

### **Optional Arguments**

* threshold: A float representing the minimum passing threshold, defaulted to 0.5.
* model: A string specifying which of OpenAI's GPT models to use, or any custom LLM model of type DeepEvalBaseLLM. Defaulted to 'gpt-4o'.
* include\_reason: A boolean which, when set to True, includes a reason for its evaluation score. Defaulted to True.
* strict\_mode: A boolean which, when set to True, enforces a binary metric score: 1 for perfection, 0 otherwise. It also overrides the current threshold and sets it to 1. Defaulted to False.
* async\_mode: A boolean which, when set to True, enables concurrent execution within the measure() method. Defaulted to True.
* verbose\_mode: A boolean which, when set to True, prints the intermediate steps used to calculate the metric to the console. Defaulted to False.

### **Usage Example**

```python theme={null}
import sys
import os

from agensight.eval.metrics import MultimodalContextualPrecisionMetric
from agensight.eval.test_case import MLLMTestCase
from agensight.eval.test_case import MLLMImage

input_data = ["Describe the image."]
actual_output = ["A cat is sitting on a windowsill."]
expected_output = ["A cat is sitting on a windowsill, looking outside."]
retrieval_context = ["A photo of a cat on a windowsill.", "A dog in a park."]

metric = MultimodalContextualPrecisionMetric(model="gpt-4o", threshold=0.5)
test_case = MLLMTestCase(input=input_data, actual_output=actual_output, expected_output=expected_output, retrieval_context=retrieval_context)

metric.measure(test_case)
print(f"Score: {metric.score}")
print(f"Reason: {metric.reason}") 
```
