Use connected models in cloud evaluations

Connected models were previously called admin-connected models.

Connected models are models hosted behind an enterprise AI gateway, such as Azure API Management or a non-Azure AI model gateway, that an administrator connects to your Foundry project. You can use a connected model for cloud evaluation scenarios that accept a model deployment.

Foundry resolves the connection endpoint and authentication, including API key, managed identity, or OAuth 2.0 authentication. Your evaluation request simply references the connection and deployment and the service manages resolving the gateway endpoint resolution and authentication.

Important

Connected models require the connected deployment to expose the OpenAI Chat Completions API.

Note

Connected model support in cloud evaluation is in preview and might not be available in all regions.

Prerequisites

Reference a connected model

Use the following format anywhere a supported evaluation scenario accepts a model deployment:

<connection-name>/<deployment-name>

The following table shows common evaluation surfaces and the field that accepts the reference:

Scenario Field
AI-assisted evaluator (judge) initialization_parameters.model
Model target target.model
Conversation simulation model_configuration.model

Use a connected model as an evaluator judge model

Set initialization_parameters.model when you configure an AI-assisted evaluator. This example uses the connected model as the judge for the coherence evaluator:

from azure.ai.projects.models import TestingCriterionAzureAIEvaluator

connected_model = "my-apim-connection/my-model-name"

testing_criteria = [
    TestingCriterionAzureAIEvaluator(
        type="azure_ai_evaluator",
        name="coherence",
        evaluator_name="builtin.coherence",
        initialization_parameters={"model": connected_model},
        data_mapping={
            "query": "{{item.query}}",
            "response": "{{item.response}}",
        },
    ),
]

Use a connected model as a target

Set target.model to send each evaluation input to the connected model:

connected_model = "my-apim-connection/my-model-name"

target = {
    "type": "azure_ai_model",
    "model": connected_model,
    "sampling_params": {
        "top_p": 1.0,
        "max_completion_tokens": 2048,
    },
}

Use this target with the model target evaluation flow described in Run evaluations in the cloud.

Use other evaluation scenarios

Other model-based scenarios in Run evaluations in the cloud by using the Microsoft Foundry SDK work similarly with connected models. Wherever the scenario accepts a supported model deployment, replace the deployment name with <connection-name>/<deployment-name>. For example, conversation simulation accepts this reference in model_configuration.model.

Keep the Foundry project endpoint unchanged, and don't add the gateway endpoint or credentials to the evaluation request. Foundry resolves those values from the connected model connection.

Note

Connected models aren't available for synthetic data generation.