Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

CSV files load all values as strings. When conversation data was provided as JSON strings, the in operator performed substring matching instead of dictionary key checking, causing "messages" not in '{"messages": [...]}' to return False, then attempting string["messages"] raised TypeError.

Changes

  • JSON parsing: Parse string conversations automatically in _convert_kwargs_to_eval_input, with clear error messages for invalid JSON
  • Type guard: Check isinstance(conversation, dict) before key lookup in _is_multi_modal_conversation to prevent substring matching
  • Tests: Add unit tests covering string parsing, dict passthrough, invalid JSON, and multimodal detection

Example

CSV files can now contain conversation data:

conversation
"{""messages"": [{""role"": ""user"", ""content"": ""Hello""}, {""role"": ""assistant"", ""content"": ""Hi""}]}"
evaluate(
    data="data.csv",
    evaluators={"coherence": CoherenceEvaluator(model_config)},
    evaluator_config={"default": {"conversation": "${data.conversation}"}},
)

JSONL and dict-based conversations continue to work unchanged.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pypi.org
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-4x52i202/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=40.8.0 on _clients.py p/bin/git grep (dns block)
  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>azure.ai.evaluation SDK cannot handle conversation input from a csv file.</issue_title>
<issue_description>- Package Name: azure.ai.evaluation

  • Package Version: 1.8.0
  • Operating System: Windows 11
  • Python Version: 3.12.9

Describe the bug
In a csv file,

To Reproduce
Steps to reproduce the behavior:

pip install azure.ai.evaluation==1.8.0
Setup file data.csv:

conversation
"{""messages"": [{""role"": ""user"", ""content"": ""Hello""}, {""role"": ""assistant"", ""content"": ""Hello""}]}"

Setup file main.py

from pathlib import Path
from azure.ai.evaluation import (
    evaluate,
    CoherenceEvaluator,
    AzureOpenAIModelConfiguration,
)

dataset_path = Path("data.csv").resolve()

model_config = AzureOpenAIModelConfiguration(
    azure_deployment="xxx",
    azure_endpoint="xxx",
)


ret = evaluate(
    data=dataset_path,
    evaluators={"coherence": CoherenceEvaluator(model_config=model_config)},
    evaluator_config={"default": {"conversation": "${data.conversation}"}},
)

Expected behavior
It should output coherence score

Additional context
In line 346 of the code https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_common/_base_eval.py

Looks like the input conversation is a string, instead of a Dict, the previous check not in doesn't take effect, because the stringified conversation json does contain the substring 'message'.</issue_description>

<agent_instructions>Validate if this issue exists</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@luigiw This is the expected behavior so far. csv files as input only support query/responese format. @ This is really strange behavior. I only discovered this after looking at the code indicated by the exception message, maybe it would be better to add some notification in the function signature or documentation.

Do you have plan to further support conversation input in csv file in the future? </comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 12, 2026 22:16
- Add JSON parsing for conversation strings from CSV
- Add type checking in _is_multi_modal_conversation to handle strings
- Add helpful error messages for invalid JSON
- Create unit tests for CSV conversation parsing

Co-authored-by: singankit <[email protected]>
- Fix typo: 'iss' → 'is' in docstring
- Update kwargs to maintain consistency after JSON parsing
- Remove unused imports from test file

Co-authored-by: singankit <[email protected]>
Copilot AI changed the title [WIP] Fix azure.ai.evaluation SDK handling of conversation input from CSV Fix conversation input parsing from CSV files Jan 12, 2026
Copilot AI requested a review from singankit January 12, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

azure.ai.evaluation SDK cannot handle conversation input from a csv file.

2 participants