Validating the presence and correctness of links in generated content is crucial for ensuring quality, accessibility, and compliance with content requirements. Links should be correctly formatted, functional, and aligned with the intended content policies.

Failure to validate links can result in:

  • Broken links – Directing users to non-existent pages.
  • Security risks – Linking to malicious or unverified sources.
  • Non-compliance – Violating content guidelines or accessibility standards.

To maintain content integrity, key evaluations are used to ensure that the output text contain any valid hyperlinks.

These evaluations help enforce link validation policies, improve content quality, and maintain proper hyperlink standards.


Ensures that the output text does not contain any valid hyperlinks. It checks whether the text is free from URLs that match standard URL formatting rules.

Click here to read the eval definition of No Valid Links

a. Using Interface

Required Inputs

  • text: The content to be assessed for valid links.

Output

Returns objective output as 1.0 or 0.0, where 1.0 means the text does not contain any valid hyperlinks and 0.0 means the text contains one or more valid hyperlinks.

b. Using SDK

from fi.testcases import TestCase
from fi.evals.templates import NoValidLinks

test_case_no_links = TestCase(
    text="This is a text without any links"
)

template_no_links = NoValidLinks()
response_no_links = evaluator.evaluate(eval_templates=[template_no_links], inputs=[test_case_no_links])

print(f"Score: {response_no_links.eval_results[0].metrics[0].value}")
print(f"Reason: {response_no_links.eval_results[0].reason}")