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

# Numeric Similarity

> Extracts numeric values from generated output and compute absolute or normalised difference between numeric value in reference

<CodeGroup>
  ```python Python theme={null}
  result = evaluator.evaluate(
      eval_templates="numeric_similarity",
      inputs={
          "expected": "The Eiffel Tower is a famous landmark in Paris, built in 1889 for the World's Fair. It stands 324 meters tall.",
          "output": "The Eiffel Tower, located in Paris, was built in 1889 and is 324 meters high."
      },
      model_name="turing_flash"
  )

  print(result.eval_results[0].output)
  print(result.eval_results[0].reason)
  ```

  ```typescript JS/TS theme={null}
  import { Evaluator, Templates } from "@future-agi/ai-evaluation";

  const evaluator = new Evaluator();

  const result = await evaluator.evaluate(
    "numeric_similarity",
    {
      expected: "The Eiffel Tower is a famous landmark in Paris, built in 1889 for the World's Fair. It stands 324 meters tall.",
      output: "The Eiffel Tower, located in Paris, was built in 1889 and is 324 meters high."
    },
    {
      modelName: "turing_flash",
    }
  );

  console.log(result);
  ```
</CodeGroup>

| **Input** |                    |          |                                                            |
| --------- | ------------------ | -------- | ---------------------------------------------------------- |
|           | **Required Input** | **Type** | **Description**                                            |
|           | `expected`         | `string` | Reference content with the expected numeric value.         |
|           | `output`           | `string` | Model-generated content containing the numeric prediction. |

| **Output** |            |                                                                                    |
| ---------- | ---------- | ---------------------------------------------------------------------------------- |
|            | **Field**  | **Description**                                                                    |
|            | **Result** | Returns a score representing the normalized difference between the numeric values. |
|            | **Reason** | Provides a detailed explanation of the numeric similarity assessment.              |

### Purpose of Numeric Similarity Eval

* It evaluate the **accuracy of numerical values** in model-generated outputs.
* Unlike semantic or lexical metrics which can overlook numeric discrepancies, `Numeric Similarity` ensures that numeric correctness is measured explicitly.

***
