Skip to content

Is there any way to get the reason for the ragas score?Β #2296

@divyamuralidharan-ai

Description

@divyamuralidharan-ai

[ X ] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug
Not able to see the reason for ragas score.

Ragas version: 0.3.2
Python version: 3.11.6

Code to Reproduce
for trace in predictions:
# --- build reference
reference = infer_reference(trace["overall_input"])
print("============reference===============")
print(reference)
reference_tool_calls = sorted(
[ToolCall(name=tool, args={}) for tool in reference.get("expected_tools", [])],
key=lambda x: x.name
)
actual_tool_called = sorted(
[ToolCall(name=tool, args={}) for tool in set(trace["tool_calls"])],
key=lambda x: x.name
)

    # --- multi-turn sample
    sample = MultiTurnSample(
        user_input=[
            RHMessage(content=trace["overall_input"]),
            RAMessage(content=trace["overall_output"], tool_calls=actual_tool_called),
        ],
        reference_tool_calls=reference_tool_calls,
        reference=reference["reference"],
        reference_topics=[reference["reference_topic"]]
    )

    # --- single-turn sample
    test_data = SingleTurnSample(
        user_input=trace["overall_input"],
        response=trace["overall_output"]
    )

    # --- run evaluations
    dataset_multi = EvaluationDataset(samples=[sample])
    # dataset_single = EvaluationDataset(samples=[test_data])

    multi_results = evaluate(dataset=dataset_multi, metrics=multi_turn_metrics)

Error trace
Not getting reason for ragas score.

Expected behavior
Need to see both score and reason

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredπŸ€– The question has been answered. Will be closed automatically if no new commentsbugSomething isn't workingmodule-metricsthis is part of metrics module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions