Skip to content

Commit 08bb107

Browse files
updates to cdn reference
1 parent 87414de commit 08bb107

File tree

2 files changed

+57
-9
lines changed

2 files changed

+57
-9
lines changed

judges/multimodal-evaluation.mdx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LLM judges can evaluate spans that contain images alongside text. This is useful
1414

1515
The LLM sees both the span's text data (input/output) and any attached images, giving it full context for evaluation.
1616

17-
Images can be provided as **base64-encoded strings** or as **presigned S3 URLs**. In both cases, ZeroEval copies the image into its own storage during ingestion, so any presigned URL only needs to remain valid long enough for the ingest request to complete.
17+
Images can be provided as **base64-encoded strings**, **presigned S3 URLs**, or **CDN image URLs**. In all cases, ZeroEval copies the image into its own storage during ingestion, so the source URL only needs to remain valid long enough for the ingest request to complete.
1818

1919
## Attaching images to spans
2020

@@ -78,12 +78,14 @@ with ze.span(name="button_hover_test") as span:
7878
)
7979
```
8080

81-
### Option 2: Presigned S3 URLs
81+
### Option 2: Image URLs (S3 presigned or CDN)
8282

83-
If your images are already stored in S3, you can pass a presigned HTTPS URL instead of base64 data. ZeroEval will download the image, validate it, and copy it into its own storage.
83+
If your images are already hosted externally, you can pass an HTTPS URL instead of base64 data. ZeroEval will download the image, validate it, and copy it into its own storage.
8484

8585
Attach URLs via `attributes.attachments` using a `url` key instead of `base64`:
8686

87+
**Presigned S3 URL**
88+
8789
```python
8890
import boto3
8991
import zeroeval as ze
@@ -110,8 +112,30 @@ with ze.span(name="chart_generation") as span:
110112
)
111113
```
112114

115+
**CDN URL**
116+
117+
```python
118+
import zeroeval as ze
119+
120+
cdn_url = "https://cdn.example.com/images/product-photo.png"
121+
122+
with ze.span(name="product_image_check") as span:
123+
span.attributes["attachments"] = [
124+
{
125+
"type": "image",
126+
"url": cdn_url,
127+
"label": "Product listing photo",
128+
}
129+
]
130+
131+
span.set_io(
132+
input_data="Check product image quality",
133+
output_data="Image attached for evaluation"
134+
)
135+
```
136+
113137
<Note>
114-
The presigned URL only needs to stay valid long enough for ZeroEval to download the image during ingestion (typically a few seconds). After that, ZeroEval serves the image from its own storage.
138+
The URL only needs to stay valid long enough for ZeroEval to download the image during ingestion (typically a few seconds). After that, ZeroEval serves the image from its own storage. CDN URLs must be from a trusted domain configured in the backend.
115139
</Note>
116140

117141
### Option 3: Structured output_data
@@ -155,7 +179,7 @@ with ze.span(
155179
]
156180
```
157181

158-
You can also use presigned S3 URLs in `output_data` by replacing the `base64` key with `url`:
182+
You can also use URLs (presigned S3 or CDN) in `output_data` by replacing the `base64` key with `url`:
159183

160184
```python
161185
span.output_data = [
@@ -251,7 +275,7 @@ Then configure your judge to only evaluate spans matching that tag. This prevent
251275
- WebP
252276
- GIF
253277

254-
Images can be provided as base64-encoded strings or presigned S3 URLs (`https://*.amazonaws.com`). In both cases, images are validated by magic bytes during ingestion. The maximum size is 10MB per image, with up to 5 images per span.
278+
Images can be provided as base64-encoded strings, presigned S3 URLs, or CDN image URLs from trusted domains. In all cases, images are validated by magic bytes during ingestion. The maximum size is 10MB per image, with up to 5 images per span.
255279

256280
## Viewing images in the dashboard
257281

tracing/sdks/python/reference.mdx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,16 +575,21 @@ with ze.span(name="chart_generation") as span:
575575
)
576576
```
577577

578-
##### Attaching images via presigned S3 URL
578+
##### Attaching images via URL (S3 presigned or CDN)
579579

580-
If your images are already stored in S3, you can pass a presigned HTTPS URL instead of base64 data. ZeroEval will download, validate, and copy the image into its own storage during ingestion.
580+
If your images are already hosted externally, you can pass an HTTPS URL instead of base64 data. ZeroEval will download, validate, and copy the image into its own storage during ingestion.
581+
582+
Supported URL sources:
583+
- **S3 presigned URLs** (`*.amazonaws.com` with valid authentication parameters)
584+
- **CDN URLs** from trusted domains
581585

582586
Attach URLs directly via `attributes.attachments` using the `url` key:
583587

584588
```python
585589
import boto3
586590
import zeroeval as ze
587591

592+
# Option A: Presigned S3 URL
588593
s3 = boto3.client("s3")
589594
presigned_url = s3.generate_presigned_url(
590595
"get_object",
@@ -607,7 +612,26 @@ with ze.span(name="chart_generation") as span:
607612
)
608613
```
609614

610-
The presigned URL only needs to remain valid long enough for ZeroEval to download the image during ingestion (typically a few seconds). Supported hosts: `*.amazonaws.com` with valid presigned authentication parameters.
615+
```python
616+
import zeroeval as ze
617+
618+
# Option B: CDN URL
619+
cdn_url = "https://cdn.example.com/images/product-photo.png"
620+
621+
with ze.span(name="product_image_check") as span:
622+
span.attributes["attachments"] = [
623+
{
624+
"type": "image",
625+
"url": cdn_url,
626+
"label": "Product listing photo",
627+
}
628+
]
629+
630+
span.set_io(
631+
input_data="Check product image quality",
632+
output_data="Image attached for evaluation"
633+
)
634+
```
611635

612636
<Note>
613637
Images attached to spans can be evaluated by LLM judges configured for multimodal evaluation. See the [Multimodal Evaluation](/judges/multimodal-evaluation) guide for setup instructions.

0 commit comments

Comments
 (0)