Skip to content

feat(vision): a cloudTask option asks the cloud tier for the text alone - #301

Merged
jddunn merged 2 commits into
masterfrom
feat/vision-cloud-transcribe
Oct 11, 2026
Merged

jddunn merged 2 commits into
masterfrom
feat/vision-cloud-transcribe

Conversation

@jddunn

@jddunn jddunn commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Summary

The cloud vision tier always sends one prompt, "Describe this image in detail. Extract all visible text exactly as written. Identify the type of content ...", and its answer has a fixed confidence of 0.95, so it becomes result.text over every local tier that ran. A call that wants text gets a description. A Codex review of agentos-extensions#140 found the case that matters: vision_pipeline's handwriting mode at maxTier 3 had listed the cloud tier beside TrOCR (a single-line model, so a page of handwriting comes back as a few words), and the description replaced the transcription. The pack took the route out again; with this option it can put it back.

  • process(image, { cloudTask }): 'describe' (the default, the prompt as it is) or 'transcribe', which asks for the text alone, exactly as written, in reading order with its line breaks, and nothing when the image shows no text. Both of _process's cloud calls (the cloud-only path and tier 3) pass it.
  • Another value is refused before any tier runs: cloudTask must be 'describe' or 'transcribe'.
  • VisionCloudTask is exported; VisionResult.text's comment and docs/features/VISION_PIPELINE.md (the quick start, the tier table, a paragraph with the handwriting example, the result shape) say what each task gives.
  • Nothing else changes: the multimodal indexer embeds process(image).text and keeps the description.

Linked issues

Follow-up to framerslab/agentos-extensions#140 (Codex P2 on its first revision).

Type of change

  • Feature

How this was verified

CI on this pull request.

  • createVisionPipeline.gemini.e2e.test.ts, through the real generateText() and Gemini provider with only fetch stubbed: the default call's text part starts "Describe this image in detail.", the cloudTask: 'transcribe' call's starts "Transcribe all the text in this image exactly as written" and carries no description prompt.
  • VisionPipeline.test.ts: the prompt for each task; tiers: ['handwriting', 'cloud-vision'] with forceCategory: 'handwritten' and 'transcribe' runs both tiers and returns the transcription; an unknown task is refused with no OCR and no cloud call.

Migration notes

None: the default is the current prompt.

Checklist

  • Tests cover the changed behavior.
  • Docs are updated.
  • The title follows Conventional Commits, with ! before the colon for a change that breaks users (feat!: or feat(api)!:).
  • No secrets or private data are included.
  • Every automated review thread is settled (how).
  • I have read this change and can explain every line.

Summary by Sourcery

Support text-focused cloud vision processing while preserving the existing description behavior by default.

New Features:

  • Add a cloudTask option that lets vision processing request either the existing image description or text-only transcription from the cloud tier.

Bug Fixes:

  • Prevent empty cloud transcription responses from overriding text produced by local vision tiers.

Enhancements:

  • Export the VisionCloudTask type and document the cloud task behavior and handwriting transcription use case.

Documentation:

  • Document cloud description and text-only transcription modes, including their confidence and result-selection behavior.

Tests:

  • Add unit and provider-level coverage for cloud task prompts, transcription selection, empty responses, and invalid task validation.

The cloud tier always asked its model to describe the image, and its
answer, at a fixed confidence of 0.95, became the result's text over
every local tier. A call that wanted text, such as a page of handwriting
read with TrOCR and the cloud tier, got a description in place of the
transcription.

process() takes cloudTask: 'describe' (the default, unchanged) or
'transcribe', which asks for the text alone, exactly as written, in
reading order. Another value is refused before any tier runs. The
multimodal indexer keeps the description it embeds.
@jddunn
jddunn requested a review from Victor-Evogor as a code owner October 11, 2026 11:17
@sourcery-ai

sourcery-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown

Sorry @jddunn, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 hours and 34 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an optional cloudTask to vision processing, selecting between the existing image-description prompt and a text-only transcription prompt while validating inputs, preserving default behavior, documenting the API, and covering both mocked and provider-level execution paths.

Sequence diagram for vision cloud task selection

sequenceDiagram
    participant Caller
    participant VisionPipeline
    participant LocalTiers
    participant CloudProvider

    Caller->>VisionPipeline: process(image, cloudTask)
    VisionPipeline->>VisionPipeline: validate cloudTask
    alt cloudTask is invalid
        VisionPipeline-->>Caller: throw Error
    else cloudTask is describe or transcribe
        VisionPipeline->>LocalTiers: run configured local tiers
        VisionPipeline->>CloudProvider: generateText(image, selected prompt)
        alt cloudTask is transcribe
            CloudProvider-->>VisionPipeline: text only in reading order
        else cloudTask is describe
            CloudProvider-->>VisionPipeline: image description with visible text
        end
        VisionPipeline-->>Caller: VisionResult.text from cloud tier
    end
Loading

File-Level Changes

Change Details Files
Add a selectable cloud vision task that preserves the existing descriptive behavior while supporting text-only transcription.
  • Add the cloudTask process option with 'describe' as the default and 'transcribe' as the alternate.
  • Use task-specific prompts in both cloud execution paths, including cloud-only and tier-3 routing.
  • Reject unsupported task values before preprocessing or any tier execution.
  • Export and document the new VisionCloudTask type and result semantics.
src/io/vision/VisionPipeline.ts
src/io/vision/types.ts
src/io/vision/index.ts
docs/features/VISION_PIPELINE.md
Verify prompt selection, routing, result precedence, and validation for the new cloud task.
  • Test default and transcription prompts with mocked cloud calls.
  • Test handwriting plus cloud transcription so the cloud text wins over TrOCR output.
  • Test invalid task rejection before OCR or cloud calls.
  • Exercise both prompts through the real provider integration path with fetch stubbed.
src/io/vision/__tests__/VisionPipeline.test.ts
src/io/vision/__tests__/createVisionPipeline.gemini.e2e.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 7 billable files and costs up to $1.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 2 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: framerslab/agentos/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: c43bf430-d185-44de-8779-70c6248f4745

📥 Commits

Reviewing files that changed from the base of the PR and between 8c2c56b and 0d610fd.


📒 Files selected for processing (7)
  • docs/features/VISION_PIPELINE.md
  • src/index.ts
  • src/io/vision/VisionPipeline.ts
  • src/io/vision/__tests__/VisionPipeline.test.ts
  • src/io/vision/__tests__/createVisionPipeline.gemini.e2e.test.ts
  • src/io/vision/index.ts
  • src/io/vision/types.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T11:19:28.329744Z 0facc88 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add an opt-in cloud transcription task to the vision pipeline

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Add cloudTask: 'transcribe' for text-only cloud results while preserving the default
 description.
• Reject unsupported tasks before running tiers and document how cloud text supersedes local
 results.
• Test prompt selection, handwriting-plus-cloud results, and requests through the Gemini provider.
Diagram

graph TD
  Caller["Process caller"] --> Pipeline["Vision pipeline"] --> Task{"Cloud task"} -->|describe| Describe["Description prompt"] --> Cloud["Cloud provider"] --> Result["Result text"]
  Task -->|transcribe| Transcribe["Transcription prompt"] --> Cloud
  Pipeline --> Handwriting["Local handwriting"] --> Result
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Configure the cloud task per pipeline
  • ➕ Keeps the task out of individual process calls.
  • ➖ Requires separate pipeline instances for description and transcription calls.
  • ➖ Makes the requested output less explicit at the call site.

Recommendation: Keep the per-call option: callers can choose the output they need while existing calls and the multimodal indexer's description behavior remain unchanged. A pipeline-level setting offers little benefit when the same instance serves both tasks.

Files changed (6) +131 / -7

Enhancement (3) +44 / -5
VisionPipeline.tsSelect the cloud prompt through a validated per-call task +31/-4

Select the cloud prompt through a validated per-call task

• Adds 'cloudTask' to 'process()', defaults it to 'describe', and rejects unknown values before running tiers. Passes the task through both cloud execution paths and selects a text-only transcription prompt when requested.

src/io/vision/VisionPipeline.ts

index.tsExport the cloud task type +1/-0

Export the cloud task type

• Exposes 'VisionCloudTask' from the vision module for callers typing the new option.

src/io/vision/index.ts

types.tsDefine cloud tasks and clarify result text +12/-1

Define cloud tasks and clarify result text

• Defines the 'describe | transcribe' task union and documents how the selected cloud task affects 'VisionResult.text'.

src/io/vision/types.ts

Tests (2) +72 / -0
VisionPipeline.test.tsCover prompt selection, handwriting results, and invalid tasks +44/-0

Cover prompt selection, handwriting results, and invalid tasks

• Tests default and transcription prompts, a combined handwriting-and-cloud call whose transcription wins, and rejection before OCR or cloud execution.

src/io/vision/tests/VisionPipeline.test.ts

createVisionPipeline.gemini.e2e.test.tsVerify both prompts reach the Gemini provider +28/-0

Verify both prompts reach the Gemini provider

• Checks the serialized requests for default and transcription calls through the real 'generateText()' and Gemini provider, with 'fetch' stubbed.

src/io/vision/tests/createVisionPipeline.gemini.e2e.test.ts

Documentation (1) +15 / -2
VISION_PIPELINE.mdDocument cloud transcription and its result semantics +15/-2

Document cloud transcription and its result semantics

• Adds text-only examples and explains the two cloud prompts, including a handwriting-page use case. Clarifies that cloud text wins over local tiers because its confidence remains 0.95.

docs/features/VISION_PIPELINE.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Blank cloud replies hide local text ✓ Resolved
Description
The transcription prompt permits an empty reply, but _runCloudVision assigns that reply confidence
0.95 and _assembleResult selects it without checking for text. When a local tier finds text that
the cloud model misses, result.text becomes empty even though the local transcription remains in
tierResults.
Code

src/io/vision/VisionPipeline.ts[118]

+  'commentary. If the image shows no text, reply with nothing.';
Evidence
The new prompt explicitly requests no output when the model sees no text; the cloud tier
nevertheless returns its output at fixed confidence, and result assembly chooses the highest
confidence without testing whether its text is empty.

src/io/vision/VisionPipeline.ts[115-118]
src/io/vision/VisionPipeline.ts[1096-1117]
src/io/vision/VisionPipeline.ts[1478-1496]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An empty cloud transcription currently wins over nonempty local text because it retains the cloud tier's fixed confidence.
## Fix Focus Areas
- src/io/vision/VisionPipeline.ts[115-118]
- src/io/vision/VisionPipeline.ts[1110-1117]
- src/io/vision/VisionPipeline.ts[1478-1496]
## Recommended Fix
Treat an empty or whitespace-only cloud transcription as having no text to rank above a nonempty local result. Preserve an empty result when no tier finds text, and add a test with nonempty local text and an empty cloud reply.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Root imports lack the cloud task type ✓ Resolved
Description
VisionCloudTask is added to the vision submodule's exports but not to the package root's explicit
vision type exports. Consumers importing the new type from @framers/agentos cannot resolve it,
although the root exports VisionPipeline and its other public types.
Code

src/io/vision/index.ts[53]

+  VisionCloudTask,
Evidence
The vision submodule exports the new type, while the root entry point explicitly lists vision type
re-exports and omits it; the package declares the root entry point in its exports.

src/io/vision/index.ts[45-56]
src/index.ts[103-119]
package.json[16-24]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new cloud task type is available from the vision submodule but missing from the package-root entry point.
## Fix Focus Areas
- src/io/vision/index.ts[50-54]
- src/index.ts[104-118]
## Recommended Fix
Add `VisionCloudTask` to the explicit vision type exports in `src/index.ts` so root-package consumers can import it alongside the other vision types.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/io/vision/VisionPipeline.ts Resolved
Comment thread src/io/vision/index.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0facc88a4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/io/vision/index.ts Resolved
…Task is a root export

The transcription prompt asks the model for nothing when the image
shows no text, and that empty answer, at the cloud tier's fixed 0.95,
would replace the text a local tier had read. An answer with no text in
it now has confidence 0, so the local text stands, and a cloud-only read
of an image without text returns empty text.

VisionCloudTask is exported from the package root with the other vision
types.
@jddunn
jddunn merged commit 2552104 into master Oct 11, 2026
10 checks passed
@jddunn
jddunn deleted the feat/vision-cloud-transcribe branch October 11, 2026 11:45
github-actions Bot pushed a commit that referenced this pull request Oct 11, 2026
## [0.13.50](v0.13.49...v0.13.50) (2026-10-11)

### feat

* **vision:** a cloudTask option asks the cloud tier for the text alone (#301) ([2552104](2552104))

### fix

* **deps:** bump @framers/* deps to latest published versions (#303) ([6278c44](6278c44))

### ci

* weekly pull request that bumps the @framers/* dependencies (#266) ([a9cad59](a9cad59))
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.

1 participant