# RAGAS 0.4.4 in practice: faithfulness, tool call metrics and experiments, step by step

RAGAS 0.4.4, released on 14 November 2026, is the first release in ten months and fixes an import that broke 0.4.3 with current LangChain packages. This guide runs its faithfulness, tool call and experiment APIs offline and works through every score by hand.

RAGAS started as a toolkit for scoring retrieval-augmented generation: did the answer stick to the retrieved documents, did retrieval find the right documents? It has since grown metrics for agents, such as whether the right tools were called with the right arguments, and an experiment API for running those metrics over datasets.

On 14 November 2026, version 0.4.4 appeared on PyPI after a release candidate the day before. It was the first release since 0.4.3 on 13 January. We installed both side by side. In a clean environment, 0.4.3 fails at `import ragas` with `ModuleNotFoundError: No module named 'langchain_community.chat_models.vertexai'`, because current `langchain-community` no longer ships that module. Version 0.4.4 imports cleanly.

This article explains how the main RAGAS 0.4 metrics compute their scores and runs them offline with a scripted judge, so you can see each step. All code was run with `ragas==0.4.4` on Python 3.13.

## What happened

### RAGAS 0.4.4rc1 and 0.4.4 released (13 and 14 November 2026)

A release candidate went up on 13 November and the final 0.4.4 a few hours later, on 14 November. The package metadata adds `requests` and `tenacity` to the dependency list.

### The Vertex AI import is now guarded

In 0.4.3, `ragas/llms/base.py` imported `ChatVertexAI` directly from `langchain_community`. In 0.4.4 the code first tries the dedicated `langchain_google_vertexai` package and falls back to the old path, with a comment explaining that those classes "moved to the dedicated `langchain-google-vertexai` package". If your CI pinned `ragas==0.4.3` and floated `langchain-community`, this is why it broke.

### The collections API is unchanged in shape

The modern metrics live in `ragas.metrics.collections`. In 0.4.4 that module includes RAG metrics (`Faithfulness`, `ContextPrecision`, `ContextRecall`, `AnswerRelevancy`, `ResponseGroundedness`), agent metrics (`ToolCallAccuracy`, `ToolCallF1`, `AgentGoalAccuracyWithReference`, `TopicAdherence`) and non-LLM text metrics (`ExactMatch`, `StringPresence`, `BleuScore`, `RougeScore`, `NonLLMStringSimilarity`).

## How a RAGAS 0.4 metric works

Each collections metric is an object with an async `ascore(...)` method. Its keyword arguments are the fields that metric needs, for example `user_input`, `response` and `retrieved_contexts` for faithfulness. It returns a `MetricResult` whose `.value` is the score.

Metrics come in two families:

| Family | Needs a model? | Examples | Good for |
|---|---|---|---|
| LLM-based | Yes, an instructor-style LLM | `Faithfulness`, `ContextPrecision`, `AgentGoalAccuracyWithReference` | Judging meaning |
| Rule-based | No | `ToolCallAccuracy`, `ToolCallF1`, `StringPresence`, `ExactMatch` | Fast, repeatable CI checks |

LLM-based metrics take an `llm` argument. In production you build it with `llm_factory("model-name", client=...)`, which wraps a provider client with structured output. The metric then sends prompts and asks for a specific Pydantic response model at each step.

For learning and unit tests, you can subclass `InstructorBaseRagasLLM` and implement its two abstract methods, `generate` and `agenerate`. Our scripted version returns a canned object for each response model name. It plays the role of a stunt double: it stands in the same place as the real judge, so the rest of the scene runs unchanged.

```bash
pip install "ragas==0.4.4"
```

```python
from ragas.llms.base import InstructorBaseRagasLLM

class ScriptedLLM(InstructorBaseRagasLLM):
    """Offline stand-in: returns canned structured outputs keyed by response model name."""
    def __init__(self, replies):
        self.replies = replies
    def generate(self, prompt, response_model):
        return response_model(**self.replies[response_model.__name__])
    async def agenerate(self, prompt, response_model):
        return self.generate(prompt, response_model)
```

## Faithfulness, step by step

Faithfulness asks: can every claim in the answer be supported by the retrieved context? The 0.4.4 implementation has three steps, visible in its `ascore` method:

1. **Split the answer into atomic statements.** The LLM is asked for a `StatementGeneratorOutput`.
2. **Check each statement against the joined contexts.** The LLM returns an `NLIStatementOutput` with a verdict of 1 (supported) or 0 (not supported) per statement. NLI stands for natural language inference.
3. **Compute the ratio** of supported statements to all statements.

Our test: a refund bot answers "You can get a refund within 30 days of delivery, paid to your original payment method, including the shipping fee." The retrieved context says shipping fees are not refunded.

```python
import asyncio
from ragas.metrics.collections import Faithfulness

llm = ScriptedLLM({
    "StatementGeneratorOutput": {"statements": [
        "Refunds are accepted within 30 days of delivery.",
        "Refunds are paid to the original payment method.",
        "Refunds include the original shipping fee."]},
    "NLIStatementOutput": {"statements": [
        {"statement": "Refunds are accepted within 30 days of delivery.", "reason": "Stated in context 1.", "verdict": 1},
        {"statement": "Refunds are paid to the original payment method.", "reason": "Stated in context 2.", "verdict": 1},
        {"statement": "Refunds include the original shipping fee.", "reason": "Context says shipping is not refunded.", "verdict": 0}]},
})

async def main():
    r = await Faithfulness(llm=llm).ascore(
        user_input="What is your refund policy?",
        response="You can get a refund within 30 days of delivery, paid to your original "
                 "payment method, including the shipping fee.",
        retrieved_contexts=["Returns are accepted within 30 days of delivery.",
                            "Refunds go to the original payment method. Shipping fees are not refunded."])
    print("faithfulness:", round(r.value, 3))

asyncio.run(main())
```

```text
faithfulness: 0.667
```

Two of three statements are supported, so the score is 2 divided by 3. With a real judge, the interesting failure modes are in step 1: a judge that merges two claims into one statement, or skips a hedge such as "usually", changes the denominator. That is why faithfulness scores from different judge models are not directly comparable. If the judge produces no statements at all, the 0.4.4 code returns `NaN` rather than a number, so filter `NaN` values before averaging.

A worked cost number helps when planning. Faithfulness makes two judge calls per sample in 0.4.4: one to extract statements and one to judge them. A 500-question evaluation set therefore costs 1,000 judge calls per run. If each call averages 1,500 input tokens and 300 output tokens, one run is 1.5 million input and 0.3 million output tokens. Run it three times to smooth out judge variation and you triple that. Rule-based metrics, by contrast, cost nothing beyond your own CPU, which is why they belong in every pull request while judge metrics often run nightly.

The [RAGAS evaluation simulation](/ai-simulations/ragas-rag-evaluation) lets you change statements and verdicts and watch the score move, and the [RAG evaluation with RAGAS simulation](/ai-simulations/rag-evaluation-ragas) covers the retrieval-side metrics.

## Tool call metrics for agents

Agents add a second question: did the agent do the right things? RAGAS 0.4.4 has two rule-based metrics for this, both fed with a conversation of `HumanMessage`, `AIMessage` (with `tool_calls`) and `ToolMessage` objects, plus a list of reference tool calls.

```python
from ragas.messages import HumanMessage, AIMessage, ToolMessage, ToolCall
from ragas.metrics.collections import ToolCallAccuracy, ToolCallF1

conversation = [
    HumanMessage(content="Refund order A-42 and tell the customer."),
    AIMessage(content="Looking it up.", tool_calls=[ToolCall(name="lookup_order", args={"order_id": "A-42"})]),
    ToolMessage(content="A-42: delivered 2026-11-10, 120 EUR"),
    AIMessage(content="Refunding.", tool_calls=[ToolCall(name="issue_refund", args={"order_id": "A-42", "amount": 100})]),
    ToolMessage(content="refund ok"),
    AIMessage(content="Done."),
]
reference = [ToolCall(name="lookup_order", args={"order_id": "A-42"}),
             ToolCall(name="issue_refund", args={"order_id": "A-42", "amount": 120}),
             ToolCall(name="send_email", args={"order_id": "A-42"})]

acc = await ToolCallAccuracy().ascore(user_input=conversation, reference_tool_calls=reference)
f1 = await ToolCallF1().ascore(user_input=conversation, reference_tool_calls=reference)
```

We ran two scenarios. In **scenario A** (above) the agent refunded 100 instead of 120 and never sent the email. In **scenario B** it made all three calls, still with the wrong amount.

| Metric | Scenario A | Scenario B |
|---|---|---|
| `ToolCallAccuracy` (strict order) | 0.0 | 0.833 |
| `ToolCallF1` | 0.4 | 0.667 |

### How ToolCallAccuracy got 0.0 and 0.833

From the 0.4.4 source:

1. Take the names of predicted and reference calls as two sequences and check whether they are **aligned**. With `strict_order=True` (the default) they must match in order. Scenario A has two names against three, so alignment is 0.
2. For each position where the names match, score the arguments: the fraction of reference arguments whose string value matches exactly. `lookup_order` scores 1; `issue_refund` scores 0.5 because `order_id` matches and `amount` does not; `send_email` scores 1.
3. Divide by the number of reference calls, apply a coverage penalty if fewer calls were compared, and multiply by the alignment flag.

Scenario B: (1 + 0.5 + 1) / 3 = 0.833, times alignment 1. Scenario A: the alignment flag of 0 wipes out everything, even though two of the calls were partly right. That is strict by design: the order of a refund and a lookup matters.

### How ToolCallF1 got 0.4 and 0.667

`ToolCallF1` treats calls as a set and counts a call as correct only if the name and all arguments match exactly.

- Scenario A: one true positive (`lookup_order`), one false positive (the refund with 100), two false negatives (the correct refund and the email). Precision 1/2, recall 1/3, F1 = 2 × (0.5 × 0.333) / (0.5 + 0.333) = 0.4.
- Scenario B: two true positives, one false positive, one false negative. Precision and recall are both 2/3, so F1 is 0.667.

Use F1 when order does not matter, such as parallel lookups, and accuracy when it does. Report both, because they fail in different ways.

## Running metrics as an experiment

Scoring single examples is useful while building. For regression testing you want a dataset and a repeatable run. RAGAS 0.4 has a `Dataset` class with pluggable backends (the 0.4.4 registry lists `inmemory`, `local/csv`, `local/jsonl` and `gdrive`) and an `@experiment` decorator that turns an async function into something you can run over a dataset.

```python
from ragas import Dataset, experiment
from ragas.metrics.collections import StringPresence

ds = Dataset(name="refund_questions", backend="inmemory")
for q, ref in [("How long do I have to return an item?", "30 days"),
               ("Is shipping refunded?", "not refunded"),
               ("Where does the money go?", "original payment method")]:
    ds.append({"question": q, "must_mention": ref})

def toy_rag_answer(question: str) -> str:          # stand-in for your RAG pipeline
    answers = {"return": "You have 30 days from delivery.",
               "shipping": "Yes, shipping is refunded.",
               "money": "Refunds go to the original payment method."}
    return next(a for k, a in answers.items() if k in question.lower())

presence = StringPresence()

@experiment()
async def refund_experiment(row):
    answer = toy_rag_answer(row["question"])
    hit = await presence.ascore(response=answer, reference=row["must_mention"])
    return {**row, "answer": answer, "mentions_required_fact": hit.value}

results = await refund_experiment.arun(ds)
```

```text
Is shipping refunded?                  0.0
Where does the money go?               1.0
How long do I have to return an item?  1.0
```

Rows run concurrently, so the output order can differ from the input order. The shipping answer is wrong and the cheap `StringPresence` check catches it without any model. In a real suite you would add faithfulness and tool metrics to the same experiment function and store results with a file backend so you can compare runs over time.

## What it means in practice

The 0.4.3 import failure is a reminder that evaluation libraries are dependencies like any other. If your evaluation job breaks, you lose your safety net exactly when you change things. Pin RAGAS together with its LangChain dependencies and run the evaluation suite in CI on every dependency bump.

The metrics themselves reward reading the formula. Strict tool accuracy can drop to zero on one missing call. F1 ignores order. Faithfulness depends on how the judge splits statements. None of this is a flaw; it is a design choice you need to match to your product. For how RAG pipelines differ and which metrics suit each, see [RAG types explained](/articles/rag-types-explained-naive-hybrid-rerank-hyde-corrective-agentic-graphrag) and the [agentic RAG](/tools/agentic-rag) page. For a second opinion from another framework, compare with [DeepEval](/tools/deepeval), and see the [RAGAS](/tools/ragas) tool page.

## What to do now

1. **Upgrade from 0.4.3.** Move to `ragas==0.4.4`, especially if `import ragas` fails with the Vertex AI error.
2. **Pin the LangChain packages too.** Record `langchain-community`, `langchain-core` and `langchain-openai` versions alongside RAGAS.
3. **Use collections metrics.** Import from `ragas.metrics.collections` and call `ascore` with named fields.
4. **Add rule-based tool metrics.** Score `ToolCallAccuracy` and `ToolCallF1` for every agent test case that has reference calls.
5. **Write a scripted judge for unit tests.** Subclass `InstructorBaseRagasLLM` so your evaluation code is tested without network calls.
6. **Handle NaN.** Drop or flag `NaN` faithfulness results before computing averages.
7. **Run experiments with a file backend.** Store results per run so you can compare versions, not just view one score.
8. **Calibrate the judge.** Hand-label 50 answers and check judge verdicts before you set faithfulness thresholds.

## Risks and open questions

**Long gaps between releases.** Ten months separated 0.4.3 and 0.4.4. Plan for the possibility that fixes for new dependency changes take time, and keep a known-good lock file.

**Judge dependence.** Faithfulness, context precision and goal accuracy all depend on the judge model. Changing the judge changes the score even when the system under test is the same.

**Exact argument matching is brittle.** `"120"` and `120.0` compare as different strings in tool accuracy. Normalise arguments before scoring if formats vary.

**Strict order can hide progress.** An agent that fixes four of five problems may still score 0 if one call is missing. Track F1 alongside it.

**Watch next:** whether a 0.5 line arrives with further API changes, and how RAGAS documents migration from the legacy metric classes to collections.

## Frequently asked questions

### Why does import ragas fail on 0.4.3?

In our clean install, 0.4.3 imports `ChatVertexAI` from `langchain_community.chat_models.vertexai`, which current `langchain-community` no longer provides. Version 0.4.4 tries the dedicated Vertex AI package first and falls back, so the import succeeds.

### Do I need an API key to use RAGAS?

Not for rule-based metrics such as `ToolCallAccuracy`, `ToolCallF1`, `StringPresence` and `ExactMatch`. LLM-based metrics need a model, which can be a provider model or your own subclass of `InstructorBaseRagasLLM`.

### What is the difference between ToolCallAccuracy and ToolCallF1?

Accuracy checks that the sequence of tool names lines up and then scores arguments position by position, with a strict order by default. F1 treats calls as a set and counts only exact matches of name and all arguments.

### How is faithfulness calculated?

The judge splits the answer into statements, then marks each as supported or not by the retrieved context. The score is supported statements divided by all statements.

### Can RAGAS evaluate multi-turn agent conversations?

Yes. Agent metrics take a list of human, AI and tool messages as `user_input`. Goal accuracy and topic adherence use a judge over that conversation; tool metrics read the tool calls in it.

## Summary

RAGAS 0.4.4, released on 14 November 2026, mainly restores a working import with current LangChain packages and keeps the 0.4 collections API. Running its metrics offline shows how each score is built: faithfulness is supported statements over all statements (0.667 in our refund example), `ToolCallAccuracy` multiplies argument accuracy by a strict order check (0.0 with a missing call, 0.833 with all calls but a wrong amount), and `ToolCallF1` counts exact matches as a set (0.4 and 0.667). Pin your versions, combine rule-based and judge metrics, and read each formula before trusting a number.

## Sources

- [PyPI: ragas 0.4.4](https://pypi.org/project/ragas/0.4.4/)
- [PyPI: ragas 0.4.4rc1](https://pypi.org/project/ragas/0.4.4rc1/)
- [PyPI: ragas 0.4.3, used for comparison](https://pypi.org/project/ragas/0.4.3/)
- [PyPI: langchain-community 0.4.2](https://pypi.org/project/langchain-community/0.4.2/)
- [PyPI: langchain-google-vertexai](https://pypi.org/project/langchain-google-vertexai/)
- [PyPI: instructor](https://pypi.org/project/instructor/)
