-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Update openapi.yaml to allow webp and gif for image embeddings #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdated two OpenAPI path descriptions in src/libs/Cohere/openapi.yaml to expand allowed data URI image formats for embedding from image/jpeg and image/png to also include image/webp and image/gif. No schema or signature changes; per-call image limit and other notes remain unchanged. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/libs/Cohere/openapi.yaml (1)
8868-8868: Keep wording consistent across endpoints; same schema enforcement applies.
- Mirror the clarified size wording used above.
- Consider deduplicating this description via a shared component to avoid drift.
Apply this minimal description tweak:
- description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB.\n\nImage embeddings are supported with Embed v3.0 and newer models." + description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and must be no more than 5MB after decoding (before base64).\n\nImage embeddings are supported with Embed v3.0 and newer models."If helpful, I can extract a Components schema (e.g., components.schemas.EmbedImageDataUri) and wire both sites to it.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
src/libs/Cohere/Generated/Cohere.CohereClient.Embed.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.CohereClient.Embedv2.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Embed.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Embedv2.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.Models.EmbedRequest.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.Models.Embedv2Request.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Cohere/openapi.yaml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test / Build, test and publish
| x-fern-audiences: | ||
| - public | ||
| description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB.\n\nImages are only supported with Embed v3.0 and newer models." | ||
| description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB.\n\nImages are only supported with Embed v3.0 and newer models." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Clarify size semantics and enforce via schema (not only description).
- The 5MB limit is ambiguous for data URIs. Recommend clarifying “after decoding (before base64)”.
- Also add maxItems: 1 and (optionally) a data-URI pattern for allowed MIME types so tooling enforces constraints.
Apply this minimal description tweak:
- description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB.\n\nImages are only supported with Embed v3.0 and newer models."
+ description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and must be no more than 5MB after decoding (before base64).\n\nImages are only supported with Embed v3.0 and newer models."Schema hardening (outside this line) for the same property:
type: array
maxItems: 1
items:
type: string
pattern: '^data:(image/(jpeg|png|webp|gif));base64,[A-Za-z0-9+/=]+$'Verification script to catch remaining places that still list only jpeg/png:
🏁 Script executed:
#!/bin/bash
rg -n -C2 -e 'image/jpeg.*image/png(?!.*webp)(?!.*gif)' src/libs/Cohere/openapi.yamlLength of output: 119
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="src/libs/Cohere/openapi.yaml"
if [ ! -f "$file" ]; then
echo "MISSING_FILE:$file"
exit 0
fi
echo "FILE: $file"
echo
echo "=== occurrences of image MIME types (context -2 lines) ==="
rg -n -C2 -S 'image/(jpeg|png|webp|gif)' "$file" || true
echo
echo "=== lines mentioning data URI or data URI docs (context -2 lines) ==="
rg -n -C2 -S 'data URI|data-uri|dataURI|data:(image' "$file" || true
echo
echo "=== YAML blocks (paragraph mode) containing both jpeg and png but NOT webp/gif (heuristic) ==="
awk 'BEGIN{RS=""; ORS="\n\n"} /image\/jpeg/ && /image\/png/ && !/image\/webp/ && !/image\/gif/ {print "BLOCK:\n"$0}' "$file" || true
echo
echo "=== lines mentioning '5MB' or 'Maximum size' (context -2 lines) ==="
rg -n -C2 -S '5MB|5 MB|Maximum size' "$file" || trueLength of output: 47072
Clarify image size semantics and add schema constraints in src/libs/Cohere/openapi.yaml
Two description blocks still state "maximum size of 5MB" — change wording to clarify decoding semantics and add schema constraints. Locations: src/libs/Cohere/openapi.yaml lines 2168 and 8868.
Apply this minimal description tweak:
- description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB.\n\nImages are only supported with Embed v3.0 and newer models."
+ description: "An array of image data URIs for the model to embed. Maximum number of images per call is `1`.\n\nThe image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and must be no more than 5MB after decoding (before base64).\n\nImages are only supported with Embed v3.0 and newer models."Schema hardening (apply to the same property):
type: array
maxItems: 1
items:
type: string
pattern: '^data:(image/(jpeg|png|webp|gif));base64,[A-Za-z0-9+/=]+$'🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 2168 and 8868, change the
description text that currently says "maximum size of 5MB" to clarify that the
5MB limit applies to the decoded image bytes (i.e., after base64 decoding), and
harden the schema for that property so it is an array with a single item allowed
(maxItems: 1), where the item is a string and must match a data URI for an image
(i.e., begins with "data:image/" followed by one of jpeg, png, webp, or gif,
then ";base64," and only base64 characters). Ensure the schema enforces
type=array, maxItems=1, items.type=string and a regex pattern that matches
"data:image/(jpeg|png|webp|gif);base64,<base64 chars>" while updating the
description text accordingly.
Summary by CodeRabbit
New Features
Documentation