Skip to content

feat(schema): add type: 'image' to EVAL.yaml ContentItemSchema#831

Merged
christso merged 2 commits intomainfrom
feat/819-yaml-image
Mar 29, 2026
Merged

feat(schema): add type: 'image' to EVAL.yaml ContentItemSchema#831
christso merged 2 commits intomainfrom
feat/819-yaml-image

Conversation

@christso
Copy link
Copy Markdown
Collaborator

Closes #819

Changes

  • Add 'image' to ContentItemSchema type enum in eval-file.schema.ts
  • Add image file processing in message-processor.ts:
    • Reads image files as binary → base64-encoded data URIs
    • Extension-based media type detection (png, jpg, jpeg, gif, webp, svg, bmp)
    • Both processMessages and processExpectedMessages handle type: 'image'
    • Clear error messages for missing files and unsupported extensions
  • Regenerated eval-schema.json
  • Unit tests for media type detection, image processing, error cases, and backward compatibility

YAML syntax

tests:
  - input:
      - role: user
        content:
          - type: image
            value: ./fixtures/screenshot.png
          - type: text
            value: "Describe what you see"

Depends on

#828 (feat/817-content-union)

christso and others added 2 commits March 29, 2026 02:00
Introduce a discriminated union Content type (ContentText | ContentImage |
ContentFile) that enables multimodal content to flow through the pipeline
without lossy flattening.

Changes:
- Add packages/core/src/evaluation/content.ts with Content union type,
  type guards (isContent, isContentArray), and getTextContent() accessor
- Update Message.content from 'unknown' to 'string | Content[]'
- Update extractLastAssistantContent() to handle Content[] via getTextContent()
- Update claude-cli provider to preserve non-text content blocks (images)
  instead of dropping them during extraction
- Update cli provider to handle Content[] from external processes
- Export all content types from @agentv/core public API
- Add 25 unit tests covering type guards, accessors, backward compat,
  and extractLastAssistantContent with Content[]

Closes #817

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add 'image' to ContentItemSchema type enum in eval-file.schema.ts
- Add image file processing in message-processor.ts (base64 encoding, media type detection)
- Support both processMessages and processExpectedMessages
- Extension-based media type mapping: png, jpg, jpeg, gif, webp, svg, bmp
- Image content produces ContentImage blocks with data URI source
- Clear error messages for missing files and unsupported extensions
- Regenerated eval-schema.json
- Unit tests for media type detection, image processing, and error cases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ac05cf
Status: ✅  Deploy successful!
Preview URL: https://5cd722e8.agentv.pages.dev
Branch Preview URL: https://feat-819-yaml-image.agentv.pages.dev

View logs

Base automatically changed from feat/817-content-union to main March 29, 2026 04:28
@christso christso merged commit 39f626c into main Mar 29, 2026
2 checks passed
@christso christso deleted the feat/819-yaml-image branch March 29, 2026 04:28
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.

feat(schema): add type: 'image' to EVAL.yaml ContentItemSchema

1 participant