# Length

**Objective**: The test is intended to check the number of words in the model response, It can be used to put a constraint on the model response length

**Required Parameters**: Response

**Interpretation**: A higher score indicates larger model response

```python
pos_response = "DNA replication is the process by which a cell makes an identical copy of its DNA. It occurs during the cell cycle's S phase and involves the unwinding of the DNA double helix, the synthesis of new complementary strands using DNA polymerase, and the proofreading and repair of errors."
neg_response =  "RNA is a type of nucleic acid that plays a crucial role in protein synthesis."

pos_response = "Climate change has significant impacts on biodiversity, leading to habitat loss, shifts in species distributions, changes in flowering and migration patterns, and increased extinction rates. These changes can have far-reaching consequences on ecosystems and the services they provide."
neg_response = "The Industrial Revolution was a period of significant technological, economic, and social change that began in Britain in the late 18th century."
# Add tests with custom data
evaluator.add_test(
    test_names=["length_test"],
    data={
        # "prompt": prompt,
        "response" : pos_response,
    },
    arguments={"model": "gpt-4", "threshold": 0.5},
).add_test(
    test_names=["length_test"],
    data={
        # "prompt": prompt,
        "response" : neg_response,
    },
    arguments={"model": "gpt-4", "threshold": 0.5},
).run()

evaluator.print_results()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/additional-metrics/evaluation/length.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
