> ## 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.

# Valid Links

> Ensures that generated content contains valid hyperlinks. This evaluation helps maintain a high standard of quality by validating the presence and validity of links in generated content.

Validating the presence and validity of links in generated content is essential for ensuring that the content meets specific requirements and maintains a high standard of quality. The following evaluations help ensure that text adheres to link validation criteria:

* [Contains Valid Link](/future-agi/get-started/evaluation/builtin-evals/valid-links#1-contains-valid-link)
* [No Valid Links](/future-agi/get-started/evaluation/builtin-evals/valid-links#2-no-valid-links)

***

### **1. Contains Valid Link**

**Definition**: Evaluates whether the output text contains at least one valid hyperlink. It checks if the text includes a URL that adheres to standard URL formatting and is accessible.

***

**Evaluation using Interface**

**input**:

* **text**: The content column to check.

- **output**:
  * **result**: Passed or Failed

***

**Evaluation Using SDK**

> Click [here](https://docs.futureagi.com/future-agi/get-started/evaluation/running-your-first-eval#using-python-sdk-sync) to learn how to setup evaluation using SDK.

| Input Type      | Parameter | Type     | Description                                      |
| --------------- | --------- | -------- | ------------------------------------------------ |
| Required Inputs | `text`    | `string` | The content to be assessed for valid hyperlinks. |

| Output  | Type   | Description                                                                   |
| ------- | ------ | ----------------------------------------------------------------------------- |
| `Score` | `bool` | Returns 1.0 if the text contains at least one valid hyperlink, 0.0 otherwise. |

<CodeGroup>
  ```python Python theme={null}
  result = evaluator.evaluate(
      eval_templates="contains_valid_link",
      inputs={
          "text": "Check out our documentation at <https://www.example.com>"
      },
      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(
    "contains_valid_link",
    {
      text: "Check out our documentation at <https://www.example.com>"
    },
    {
      modelName: "turing_flash",
    }
  );

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

**What to Do When Contains Valid Link Evaluation Fails**:

If the evaluation fails, review the output text to identify the absence of valid links. Consider revising the content to include appropriate hyperlinks that meet the required standards. Providing clearer instructions or constraints in the input can help prevent this issue in future evaluations.

***

### **2. No Valid Links**

**Definition**: Evaluates whether the output text does not contain any valid hyperlinks. It checks if the text is free from URLs that adhere to standard URL formatting.

**Evaluation using Interface**

**input**:

* **text**: The content column to check.

- **output**:
  * **result**: Passed or Failed

***

**Evaluation Using SDK**

> Click [here](https://docs.futureagi.com/future-agi/get-started/evaluation/running-your-first-eval#using-python-sdk-sync) to learn how to setup evaluation using SDK.

| Input Type      | Parameter | Type     | Description                                 |
| --------------- | --------- | -------- | ------------------------------------------- |
| Required Inputs | `text`    | `string` | The content to be assessed for valid links. |

| Output  | Type   | Description                                                                                                |
| ------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| `Score` | `bool` | Returns 1.0 if the text does not contain any valid hyperlinks, 0.0 if it contains one or more valid links. |

<CodeGroup>
  ```python Python theme={null}
  result = evaluator.evaluate(
      eval_templates="no_valid_links",
      inputs={
          "text": "This is a text without any links"
      },
      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(
    "no_valid_links",
    {
      text: "This is a text without any links"
    },
    {
      modelName: "turing_flash",
    }
  );

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

***

**What to Do When No Valid Links Evaluation Fails**:

If the evaluation fails, review the output text to identify the presence of valid links. If the text contains URLs that meet the criteria for valid links, consider revising it to ensure compliance with the requirement of having no valid links. Providing clearer constraints in the input can help ensure adherence in future evaluations.
