Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

When using _use_pf_client=True with a target function, user-provided column mappings referencing target outputs (e.g., ${target.response}) fail because the conversion chain stops at ${run.outputs.} instead of completing to ${data.__outputs.} format required by ProxyClient.

Changes

  • Column mapping conversion: Added conversion step in _preprocess_data() to transform ${run.outputs.*}${data.__outputs.*} when using ProxyClient with target functions
  • Test coverage: Added test_column_mapping_with_target_and_pf_client to validate the fix

Technical Details

The conversion chain now properly handles all three stages:

  1. User input: ${target.response}
  2. _process_column_mappings(): ${run.outputs.response}
  3. New: ProxyClient conversion: ${data.__outputs.response}

Without step 3, ProxyClient cannot map columns from the temporary JSONL file containing target outputs.

Example

evaluate(
    data="data.csv",
    target=lambda query: {"response": f"Answer: {query}"},
    evaluators={"coherence": CoherenceEvaluator(model_config=config)},
    evaluator_config={
        "default": {
            "column_mapping": {
                "query": "${data.query}",
                "response": "${target.response}",  # This now works
            }
        }
    },
    _use_pf_client=True,
)

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-9p571cym/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=40.8.0 (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: column mapping error when set _use_pf_client to true</issue_title>
<issue_description>- Package Name: azure-ai-evaluation

  • Package Version: 1.10.0
  • Operating System: Windows 11
  • Python Version: 3.12

Describe the bug
Error when set _use_pf_client to true when invoking evaluate function.

To Reproduce
data.csv:

query
hello

main.py

from azure.ai.evaluation import (
    evaluate,
    CoherenceEvaluator,
    AzureOpenAIModelConfiguration,
)
from langchain_openai import AzureChatOpenAI
from azure.identity import AzureCliCredential, get_bearer_token_provider
from typing import TypedDict

endpoint = "xxx"


class TargetFunctionOutput(TypedDict):
    response: str


def eval_target(query: str) -> TargetFunctionOutput:
    llm = AzureChatOpenAI(
        azure_deployment="gpt-4.1-mini",
        model_name="gpt-4.1-mini",
        openai_api_version="2024-10-21",
        temperature=1,
        max_retries=3,
        max_tokens=None,
        timeout=None,
        azure_endpoint=endpoint,
        openai_api_type="azure",
        azure_ad_token_provider=get_bearer_token_provider(
            AzureCliCredential(), "https://cognitiveservices.azure.com/.default"
        ),
    )
    return TargetFunctionOutput(response=llm.invoke(query).content)


if __name__ == "__main__":
    evaluate(
        data="data.csv",
        target=eval_target,
        evaluators={
            "coherence": CoherenceEvaluator(
                model_config=AzureOpenAIModelConfiguration(
                    azure_deployment="gpt-4.1-mini",
                    azure_endpoint=endpoint,
                    api_version="2024-10-21",
                )
            )
        },
        evaluator_config={
            "default": {
                "column_mapping": {
                    "query": "${data.query}",
                    "response": "${target.response}",
                },
            }
        },
        _use_pf_client=True,
    )

</issue_description>

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

@w-javed @Wixee Can you provide the actual error you are seeing. Thanks! @w-javed Thanks for the info. We'll investigate this and get back to you asap.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 29, 2025 21:30
Co-authored-by: luigiw <1483379+luigiw@users.noreply.github.com>
Co-authored-by: luigiw <1483379+luigiw@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix column mapping error in azure-ai-evaluation Fix column mapping conversion for ProxyClient with target functions Dec 29, 2025
Copilot AI requested a review from luigiw December 29, 2025 21:35
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: column mapping error when set _use_pf_client to true

2 participants