Skip to content

[BUG] azure-ai-evaluation: Cannot run built-in evaluators against multi-turn conversation input #45077

@Wixee

Description

@Wixee
  • Package Name: azure-ai-evaluation
  • Package Version: 1.15.0
  • Operating System: Windows

Describe the bug
Error raised when running the following script.
Error: azure.ai.evaluation._exceptions.EvaluationException: (InternalError) unhashable type: 'list'

To Reproduce
data.csv:

conversation
"{""messages"": [{""role"": ""user"", ""content"": ""Hi""}, {""role"": ""assistant"", ""content"": ""Hello""}]}"
"{""messages"": [{""role"": ""user"", ""content"": ""Hi""}, {""role"": ""assistant"", ""content"": ""Hello""}, {""role"": ""user"", ""content"": ""How are you?""}, {""role"": ""assistant"", ""content"": ""I am fine""}]}"

main.py:

import json
import os
from azure.ai.evaluation import (
    evaluate,
    CoherenceEvaluator,
    AzureOpenAIModelConfiguration,
)
from azure.identity import DefaultAzureCredential

MODEL_CONFIG = AzureOpenAIModelConfiguration(
    azure_endpoint="xxx",
    azure_deployment="xxx",
    api_version="2024-12-01-preview",
)


def target_function(conversation: str):
    return {"conversation": json.loads(conversation)}


if __name__ == "__main__":
    data_path = os.path.join(os.path.dirname(__file__), "data.csv")

    result = evaluate(
        data=data_path,
        target=target_function,
        evaluators={
            "coherence": CoherenceEvaluator(
                model_config=MODEL_CONFIG,
                credential=DefaultAzureCredential(),
                # is_reasoning_model=True,
            )
        },
        evaluator_config={
            "default": {
                "column_mapping": {
                    "conversation": "${target.conversation}",
                }
            }
        },
    )
    print(result)

Metadata

Metadata

Assignees

Labels

EvaluationIssues related to the client library for Azure AI EvaluationService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions