Skip to content

fix(ai): accept case-insensitive Cohere image MIME types - #58943

Draft
Galaxy-0 wants to merge 2 commits into
anomalyco:devfrom
Galaxy-0:cohere-image-mime
Draft

Galaxy-0 wants to merge 2 commits into
anomalyco:devfrom
Galaxy-0:cohere-image-mime

Conversation

@Galaxy-0

Copy link
Copy Markdown

Issue for this PR

Closes #58937

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Use Media's existing case-insensitive image classification in the native Cohere route instead of matching the raw MIME prefix. This accepts IMAGE/PNG and Image/Png without changing serialization or accepting non-image media.

AI disclosure: prepared and independently reviewed by AI agents; no human review is claimed. Kept as a draft for maintainer review.

How did you verify your code works?

On dev 32b5701 with Bun 1.4.4:

  • Nine request-compilation regressions cover lowercase/uppercase/mixed-case MIME with base64, bytes and URL images. Six failed before the fix; the Cohere file passes all 20 tests afterward (also 200/200 over ten repetitions).
  • Full AI package: 1,900 passed, 28 skipped, 0 failed. Both AI typecheck scripts, focused lint, Prettier and root bun run check pass (root check with telemetry disabled and writable temporary HOME).
  • Independent AI review reran Cohere and media suites: 310 passed across ten repetitions.

No live Cohere API calls or new cassette recordings; these verify request compilation and existing replay tests, not provider-side image recognition. Root lint retains pre-existing warnings.

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Merge dev ce53f18 and adapt the retained regression from LLM.request to ai.request. Preserve the original case-insensitive media.kind check and all nine MIME/source cases.

AI-assisted implementation and independent AI review; no human review claimed.
Validation on Linux, Bun 1.4.4, current frozen lockfile, install scripts disabled: AI suite 2055 pass / 28 skip / 0 fail; independent Cohere/media/media-input 420 pass; AI Bun and official TypeScript checks, focused formatting and root check pass. Baseline regression before the production fix: 14 pass / 6 fail. No live Cohere API or Windows E2E execution.

This branch has not been deployed

No deployments
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.

Cohere route rejects image MIME types with uppercase letters

1 participant