Multimodal evaluator

Updated at:

A multimodal evaluator lets you directly reference media inputs, such as images, audio, and video, in an evaluation prompt. You can declare the media type of each variable. During evaluation, the system sends the media content together with the message to a multimodal large language model, allowing the model to score the actual content instead of guessing based on URL text.

Note

Multimodal evaluators are supported by LLM evaluators and agent evaluators. Code evaluators do not support media input.

Overview

In a conventional text evaluator, if an image or audio URL is referenced in the prompt, the model sees only a URL string. It cannot actually see or hear the content, but may still return a plausible-looking score. This can cause severe evaluation distortion. A multimodal evaluator addresses this issue in two ways:

  • Media is sent directly to the model: A variable declared as an image, audio, or video is extracted as a separate multimodal content part and submitted with the message. Only a placeholder, such as [Provided as an image input with this message], remains at the corresponding position in the prompt.

  • Fail closed instead of guessing: If a dataset declares that a record contains an image but the evaluator variable is declared as audio, the system terminates evaluation for that record with an error instead of silently falling back to text-based scoring.

Benefits

  • True multimodal understanding: The model evaluates visual, audio, and video content. This is suitable for subjective or perceptual evaluation scenarios such as aesthetics, clarity, speech quality, and video coherence.

  • Dual validation by the dataset and evaluator: Dataset metadata, which represents facts, is cross-checked against evaluator variable declarations, which represent intent. A mismatch immediately fails with a clear error.

  • Flexible value formats: Public URLs, data URIs, OSS addresses (oss://), SLS addresses (sls://), and row-level metadata in JSON are supported. The system parses them into addresses that the model can consume.

  • Automatic detection mode: After task-level multimodal mode is enabled, you do not need to declare a type for each variable. The system detects and routes media based on value prefixes and suffixes.

Typical scenarios

Scenario

Description

Image quality evaluation

Score generated or uploaded images for aesthetics, clarity, composition, and other dimensions.

Image-text consistency evaluation

Determine whether copy matches an image and accurately describes its content.

Speech or audio quality evaluation

Evaluate the naturalness, clarity, and emotional expression of synthesized speech.

Video content evaluation

Evaluate the content plausibility and temporal coherence of generated videos.

Omnimodal output review

Send images, audio, and video from the same record to the model for comprehensive evaluation.

Supported regions

Region

Region ID

China (Hangzhou)

cn-hangzhou

China (Shanghai)

cn-shanghai

China (Beijing)

cn-beijing

China (Shenzhen)

cn-shenzhen

China (Hong Kong)

cn-hongkong

Singapore

ap-southeast-1

Create a multimodal evaluator

Multimodal capabilities are enabled by declaring types for evaluator variables. The creation process is the same as that for a regular LLM evaluator or agent evaluator.

Step 1: Create an evaluator

  1. Log on to the AgentLoop console and go to the Evaluators page.

  2. Click Create Evaluator and select LLM Evaluator or Agent Evaluator.

  3. Configure the basic information:

    Configuration item

    Required

    Description

    Name

    Yes

    The evaluator name. It must be unique within the current account.

    Type

    Yes

    LLM evaluator, which directly calls a large language model, or agent evaluator, which uses a digital employee.

    Display name

    No

    The name displayed in the console.

    Description

    No

    A description of the evaluator purpose.

    Tag

    No

    Used for classification and search.

Step 2: Write the evaluation prompt

In Evaluation Configuration, write the prompt to send to the model. Use the {{variable_name}} syntax to reference input data. Example:

Evaluate the overall quality of this product image.

Image: {{product_image}}
User question: {{question}}

Score the image from 0 to 10 for clarity, composition, and aesthetics, and explain your reasoning.

Note: Only variables declared as media types use the multimodal channel. Undeclared variables are processed as text, and their URLs remain ordinary strings in the prompt.

Step 3: Configure variable types

Configure a type for each {{variable_name}} in the variable list:

Variable type

Description

Text

The default type. The value is rendered in the prompt as-is and is not sent through a media channel.

Image

The value is submitted to the model as an image content part.

Audio

The value is submitted to the model as an audio content part.

Video

The value is submitted to the model as a video content part.

File

The value is not parsed as media. Its signed accessible address remains in the prompt for an agent tool such as readPDF to read.

Multimodal array

The value is a MediaRef array in JSON and can contain multiple media types. For more information, see the following sections.

You can also configure the following settings for each variable:

  • Required: If a required variable has no value in a record, evaluation of the record fails. If an optional variable has no value, the corresponding media channel is skipped.

  • Description: Helps others understand the purpose of the variable.

Important

If a variable type is undeclared or unknown, the system always processes the variable as text and does not infer a media type.

Step 4: Select a multimodal model and publish the evaluator

  • LLM evaluator: In the model configuration, select a model labeled (multimodal), such as qwen3-vl-plus(multimodal). The label indicates model capabilities and is automatically removed during calls.

  • Agent evaluator: We also recommend that you select a model labeled (multimodal). Multimodal input is delivered to the digital employee together with the message.

For audio, select qwen3.8-omni-flash(multimodal). After the configuration is complete, publish the evaluator for use in evaluation tasks.

Variable value formats

Evaluator variable values from dataset record fields or trace fields can use the following formats. The system parses them consistently during evaluation:

Format

Example

Processing

Public URL or data URI

https://example.com/a.jpg or data:image/png;base64,...

Passed directly to the model.

OSS address

oss://my-bucket/path/to/image.png

A presigned URL is generated by using the configured role and then sent to the model.

SLS address

sls://project/logstore/path/to/audio.wav

Resolved to a signed accessible address and then sent to the model.

Row-level metadata in JSON

{"type":"uri","modality":"image","mime_type":"image/png","uri":"oss://..."}

The type is detected from the modality field and the uri field is resolved.

Accepted values by modality

Modality

Accepted values

Description

Image

http(s):// URL, data:image/ data URI, oss://, sls://, or row-level metadata in JSON.

URLs can contain up to 8,192 characters. Data URIs can contain up to 15 MB of characters.

Audio

http(s):// URL, data:audio/ data URI, oss://, sls://, or row-level metadata in JSON.

URLs can contain up to 8,192 characters. Data URIs can contain up to 10 MB of characters.

Video

Only http(s):// URLs, including resolved oss:// and sls:// addresses and row-level metadata in JSON.

Inline video data URIs are not supported because they necessarily exceed the size limit. URLs can contain up to 8,192 characters.

Note: If a media variable value does not match an accepted prefix and is not a resolvable OSS or SLS address, the value remains as plain text in the prompt and a warning is logged. If an oss:// address, sls:// address, or metadata JSON fails to resolve, evaluation fails and prompts you to check oss.roleArn and oss.region. The system does not continue with an unusable address.

Authorize access to OSS and SLS addresses

To use oss:// or sls:// addresses, configure authorization in the task configuration:

Configuration item

Required

Description

oss.roleArn

No

The ARN of the role assumed to access your OSS resources. Resolution priority: explicit configuration > connector found by bucket > user SLR. Resolution fails if none is available.

oss.region

No

The region of your OSS resources. The evaluation task region is used by default.

sls.region

No

The region of the SLS multimodal object. The evaluation task region is used by default.

Keys with the oss. or sls. prefix are validated when a task is created. A misspelled key such as oss.rolearn causes an error instead of being silently ignored. All oss:// addresses in one evaluation record must belong to the same bucket.

Configure an assumable role for direct oss:// access

To directly use an oss:// address, prepare a RAM role that AgentLoop can assume and specify its ARN in oss.roleArn. Configure the following items:

1. Trust policy: Allow the following cloud services to assume the role.

{
  "Statement": [
    {"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":["aliyunsplc.aliyuncs.com"]}},
    {"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":["agentloop.aliyuncs.com"]}},
    {"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":["operation-platform.aliyuncs.com","cloudmonitor.aliyuncs.com"]}}
  ],
  "Version": "1"
}

2. Permissions: Grant the following three permissions to the role.

Permission

Description

CreateServiceLinkedRole

Creates a service-linked role.

AliyunOSSReadOnlyAccess

Provides read-only access to OSS media objects.

AliyunSTSAssumeRoleAccess

Provides the STS permission required to assume a role.

Report multimodal data to SLS in presigned OSS mode

sls:// addresses used by evaluators typically come from instrumentation data reported by AI applications. When an application uses the presigned OSS mode of LoongSuite GenAI Utils SDK, large multimodal data such as images and audio is automatically uploaded to OSS. Original Base64 content or URLs in span attributes are replaced with lightweight sls:// addresses to prevent large files from overwhelming trace data. For more information, see Use GenAI Utils to report multi-modal data in pre-authorization OSS mode.

Prerequisites:

  • Install LoongSuite GenAI Utils 0.9.0 or later:

    pip install -U "loongsuite-otel-util-genai>=0.9.0"
    
  • In a pure SDK scenario, explicitly configure all of the following environment variables. If any variable is missing, the multimodal pipeline is silently disabled. Original Base64 content or URLs remain in spans and no upload logs are generated.

    Environment variable

    Description

    ARMS_LICENSE_KEY

    The License Key used for authentication. The SDK does not hold an AccessKey pair and uses this key to request short-lived presigned URLs from the server.

    ARMS_WORKSPACE

    The workspace name.

    OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_UPLOAD_MODE

    Upload scope: both, input, output, or none.

    OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_UPLOADER

    Set the value to presign.

    OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_PRE_UPLOADER

    Set the value to presign.

    OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_DOWNLOAD_ENABLED

    Set the value to true if remote URL content must be downloaded.

    OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_OSS_PATH_PREFIX

    Optional. The object prefix, such as genai/my-app.

    APSARA_APM_COLLECTOR_MULTIMODAL_SLS_PROJECT

    The SLS project name, such as proj-xtrace-xxx-cn-hangzhou.

    APSARA_APM_COLLECTOR_MULTIMODAL_SLS_LOGSTORE

    The SLS Logstore name, such as multimodal.

    OTEL_SEMCONV_STABILITY_OPT_IN

    The value must include gen_ai_latest_experimental.

    OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT

    Set the value to the enum name SPAN_ONLY or SPAN_AND_EVENT. Do not use true or 1, which causes a silent fallback.

Example environment variables:

export ARMS_LICENSE_KEY='<your-license-key>'
export ARMS_WORKSPACE='<your-workspace-name>'

# Multimodal: presigned OSS mode
export OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_UPLOAD_MODE=both
export OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_UPLOADER=presign
export OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_PRE_UPLOADER=presign
export OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_DOWNLOAD_ENABLED=true
export OTEL_INSTRUMENTATION_GENAI_MULTIMODAL_OSS_PATH_PREFIX=genai/my-app

# Multimodal storage destination
export APSARA_APM_COLLECTOR_MULTIMODAL_SLS_PROJECT=proj-xtrace-xxx-cn-hangzhou
export APSARA_APM_COLLECTOR_MULTIMODAL_SLS_LOGSTORE=multimodal

# Enable message content capture
export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY

Instrumentation method: Populate the result by updating fields of the Invocation object. Put media in message parts as Blob objects for binary data or Uri objects for addresses. The following sample shows the key code:

from opentelemetry.util.genai.types import Blob, InputMessage, Text, LLMInvocation
from opentelemetry.util.genai.extended_handler import get_extended_telemetry_handler

handler = get_extended_telemetry_handler(tracer_provider=provider)
invocation = LLMInvocation(
    request_model="my-vl-model",
    provider="my-app",
    input_messages=[InputMessage(role="user", parts=[
        Text(content="What color is this image?"),
        Blob(mime_type="image/png", modality="image", content=input_png),
    ])],
)
handler.start_llm(invocation)
# Call the model and populate output messages and token counts.
handler.stop_llm(invocation)   # The upload is converted to an asynchronous task.
provider.force_flush(10_000)   # Wait for the asynchronous upload before exit.

Object address format: The sls:// address is determined locally in the following format:

sls://{project}/{logstore}[/{prefix}]/{yyyymmdd}/{md5}.{ext}

The actual object key is the part after sls:// plus the bucket prefix selected by the server. If no Logstore is specified, logstore-multimodal is used.

Use in evaluation: After data is reported, view media metadata in the Span attributes named gen_ai.input.multimodal_metadata and gen_ai.output.multimodal_metadata. Their URIs start with sls://. Map these fields to evaluator variables for direct consumption. During evaluation, the system resolves them to signed accessible addresses. Make sure that sls.region, or the task region, matches the SLS region.

Cross-validation of modalities

The system performs two checks when parsing media to prevent silent errors, such as processing an image as audio:

  1. Compare dataset metadata, which represents facts, with evaluator declarations, which represent intent: For media with row-level metadata, such as {"type":"uri","modality":"video",...}, the modality must match the evaluator variable type. Otherwise, evaluation of the record fails with an error similar to:

    variable 'demo_video' is declared as image by the evaluator, but the dataset
    metadata says it holds video (mime_type=video/mp4)
    
  2. Detect modality conflicts for the same URI: If the same media address is declared as different variable types in one record, evaluation also fails with Conflicting modalities for the same media URI.

This design prevents the model from inventing a plausible-looking score based only on prompt text when it cannot access the media or receives the wrong media type. An explicit failure is preferable to an incorrect score.

Multimodal array variables

If a field contains multiple media items or a mixture of text and media, use the multimodal array type. Its value is a JSON array in which each media item is a MediaRef object:

[
  {"type":"uri","modality":"image","mime_type":"image/png","uri":"oss://my-bucket/step1.png"},
  {"type":"uri","modality":"image","mime_type":"image/jpeg","uri":"https://example.com/step2.jpg"}
]

The following table describes the fields:

Field

Required

Description

type

Yes

The fixed value uri.

modality

Yes

The media type: image, video, or audio.

mime_type

Yes

The media MIME type. Its prefix must match modality, such as image/png with image.

uri

Yes

The media address. oss://, sls://, and https:// with a host are supported.

  • If a required multimodal array variable is empty, evaluation of the record fails with Missing required multimodal variable: {name}.

  • If the value is not an array, evaluation fails with Multimodal variable must be a MediaRef array: {name}.

  • The number of media items in the array is subject to the limits described in the summary table.

Use the evaluator in an evaluation task

Select a multimodal model

In the model configuration of the evaluation task, select a model labeled (multimodal). If you use an agent evaluator, make sure that the digital employee also supports multimodal input.

Field mapping

In the field mappings of the evaluation task, map dataset record fields to evaluator variables. Example:

Evaluator variable

Mapping source

{{product_image}}

trace.output.image_url or the dataset field image.

{{user_audio}}

The dataset field audio_uri.

{{result}}

trace.output.

Mapping sources include dataset record fields and trace fields such as trace.input, trace.output, and trace.tool_context.

Automatic detection mode

If declaring a type for each media field in the dataset is inconvenient, enable automatic multimodal detection in the task configuration by setting multimodal=true:

  • The system detects and routes media based on variable values without requiring type declarations on the evaluator.

  • Detection rules:

    • Audio: The value starts with data:audio/, or the path suffix of the HTTP(S) URL is wav / mp3 / m4a / aac / flac / ogg / opus / amr / wma / aiff / aif.

    • Video: The value starts with data:video/, or the path suffix is mp4 / mov / webm / mkv / avi / flv / wmv / m4v / mpeg / mpg / 3gp.

    • Image: The value starts with data:image/, or the path suffix is jpg / jpeg / png / gif / webp / bmp / svg / tiff / tif / ico / heic / heif / raw.

  • URL query strings and fragments are removed before suffix detection, so signed OSS addresses are supported.

  • Only string checks are performed. No network requests are initiated.

  • Variables with explicitly declared types and variables declared as file do not participate in automatic detection.

We recommend that you use automatic detection with a model labeled (multimodal). If explicit declarations and automatic detection coexist, explicit declarations take precedence.

Compatibility note: If automatic detection is disabled, the system retains name-based inference for audio and video variables. A variable is inferred as the corresponding media type if its name equals or ends with _audio, _audio_url, _audio_uri, _video, _video_url, or _video_uri. camelCase names are supported. Explicit declarations always take precedence.

Trace media

For trace-based evaluation data, the system automatically collects LLM input and output media from traces:

  • Media is collected from spans where gen_ai.span.kind=llm.

  • Evaluation results display LLM input media and LLM output media separately, including count badges.

  • Exports automatically include the corresponding media. Input and output exports include their respective media, and trace exports include both.

  • Trace media addresses are also signed and resolved. Identical media in explicit variables and traces is deduplicated by address, modality, and MIME type, and shares the signature cache.

Evaluator input channels (advanced configuration)

Agent evaluators support modality-specific input channels on the server. This is a deployment-level setting whose default value is inline_value:

Channel

Description

inline_value

Media content is delivered inline with the message. This is the default.

tool_hint

Media is not inlined. Its address remains in the prompt, and the digital employee is instructed to load it with a tool. For video, the following instruction is appended: "Use the LoadMultimedia tool to load the following videos for analysis."

none

Disables the modality channel. If the evaluator still declares a variable of this type, evaluation fails.

Note: This configuration is typically maintained by the platform. If you declare a media variable but receive a channel-disabled error, contact the administrator to verify the channel configuration for that modality.

Limits

Item

Limit

Number of images

Up to 8 per evaluation record.

Number of videos

Up to 3 per evaluation record.

Number of audio items

Up to 8 for direct model calls by an LLM evaluator, or up to 4 for an agent evaluator.

HTTP(S) URL length

Up to 8,192 characters for images, audio, and video.

Data URI size

15 MB of characters for images and 10 MB for audio. Video data URIs are not supported.

OSS bucket

All oss:// addresses in one evaluation record must belong to the same bucket.

Trace metadata budget

16 MiB for trace media metadata and 1 MiB for media references.

Role authorization

oss.roleArn uses three-level resolution: explicit configuration > connector > user SLR.

During trace evaluation, media with row-level metadata such as {"type":"uri","modality":...,"uri":...} counts toward the preceding limits. Media beyond the limits is truncated and logged.

FAQ

If I do not configure a variable type, is the variable automatically processed as an image?

No. Undeclared and unknown types are always processed as text. Media is automatically detected by value prefix or suffix only when automatic detection mode is enabled by setting multimodal=true.

Why does evaluation report variable 'xxx' is declared as audio ... but the dataset metadata says it holds image?

The row-level dataset metadata declares the field as an image, but the evaluator variable declares it as audio. Correct one of the declarations so they match. The system does not continue evaluation when types conflict because the resulting score would be unreliable.

What do I check if an oss:// address fails to resolve?

Check the following items: 1. Verify that oss.roleArn is correct and the role has read permissions on the bucket. 2. Verify that the role trust policy allows services such as aliyunsplc.aliyuncs.com and agentloop.aliyuncs.com to assume the role and grants CreateServiceLinkedRole, AliyunOSSReadOnlyAccess, and AliyunSTSAssumeRoleAccess. 3. Verify that oss.region, or the task region, matches the bucket region. 4. Verify that one record does not contain addresses from multiple buckets. Misspelled keys cause an error when the task is created.

How do I troubleshoot an application-reported sls:// address that fails to resolve during evaluation?

First verify that the trace contains an sls:// address. If any required instrumentation environment variable is missing, multimodal reporting is silently disabled and the span retains the original Base64 content or URL instead of an sls:// address. If the address exists but still fails, verify that sls.region, or the task region, matches the SLS project region and that LoongSuite GenAI Utils SDK 0.9.0 or later is used.

Can I inline a video by using a data URI?

No. A video data URI necessarily exceeds the request body limit and is explicitly rejected. Use an HTTP(S), oss://, or sls:// address.

What happens if a variable is declared as an image but contains ordinary text?

The value remains as plain text in the prompt and a warning is logged. The corresponding media channel remains empty. If the variable is required and its value is empty, evaluation of the record fails.

Can images and audio from the same record be sent together?

Yes. Each modality is counted and validated independently. Multiple modalities can coexist in one evaluation record as long as each remains within its limit.

Recommendations

  1. Explicitly declare types: Prefer declaring media types in variable configurations over relying on name inference or automatic detection. This provides the clearest semantics and most predictable behavior.

  2. Reference media separately from text: In the prompt, use a sentence to explain each media variable, such as "The following image is the original image uploaded by the user." This helps the model evaluate content more accurately.

  3. Prefer OSS or SLS addresses: When evaluating large datasets, use oss:// or sls:// addresses so that the system can sign them consistently. This avoids temporary external links and oversized data URIs in datasets.

  4. Keep dataset metadata consistent with evaluator declarations: If a dataset field contains modality metadata, make the evaluator variable type match it to avoid cross-validation failures.

  5. Control concurrency and costs by modality: Video and audio consume significantly more tokens than images. Validate prompt performance on a small sample before scaling up evaluation.

  6. Use required variables carefully: After a media variable is made required, any record with a missing value fails individually. If data quality varies, make the variable optional first and observe the missing-value ratio in results.