Skip to content

fix(discovery): read input modalities from the architecture object - #86

Merged
jigjigjig merged 1 commit into
mainfrom
fix/read-nested-input-modalities
Nov 20, 2026
Merged

jigjigjig merged 1 commit into
mainfrom
fix/read-nested-input-modalities

Conversation

@jigjigjig

@jigjigjig jigjigjig commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

I was trying to have images capabilities in deepseek and kept failing

Refs #6

What was wrong

parseStandardEntry only read a top-level input_modalities (or modality). The authenticated GET /v1/models response nests the field under architecture, so every model fell back to ["text"] and Pi stripped images ("Current model does not support images") even for vision-capable models.

Real entry shape (trimmed):

{
  "id": "deepseek/deepseek-v4.1-flash-1017",
  "object": "model",
  "type": "chat",
  "architecture": { "input_modalities": ["text", "image"], "output_modalities": ["text"] },
  "supported_parameters": ["tools", "tool_choice", "response_format", "reasoning"]
}

There is no top-level input_modalities or modality key in that response.

Fix

Read architecture.input_modalities too. Precedence: top-level input_modalities, then architecture.input_modalities, then modality. Existing reads are unchanged. When nothing is declared, models stay text-only. The omp/ directory imports this parsing rather than duplicating it, so it needs no change.

Testing

New cases in test/model-mapper.test.ts: nested image and text-only, top-level wins over architecture, no info defaults to text-only via toProviderModel, and a malformed architecture (string, null, array) does not throw. npm run check passes (format, lint, typecheck, 262 tests). The live API was not called.

Issue #6 is broader than this, so it stays open.

@jigjigjig jigjigjig added the bug Something isn't working label Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@jigjigjig jigjigjig left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed the diff and tested it against the live gateway. Nothing to change.

Code

  • One-line change in parseStandardEntry: architecture.input_modalities is read after the top-level input_modalities and before modality, so existing behaviour is untouched for any response that already worked.
  • record() guards the nested read, so a string, null or array architecture is ignored instead of throwing. Covered by the new it.each.
  • The text-only default in toProviderModel is unchanged when nothing is declared.
  • omp/ imports this parser, so it picks the fix up with no change of its own.

Checked against the live model list (GET https://api.otari.ai/api/v1/models, 349 models)

  • main: 0 models register image input.
  • This branch: 180 register image input. deepseek/deepseek-v4.1-flash-1017 maps to ["text", "image"].
  • Reasoning count is the same on both (109), so nothing else moved.

Checked the capability is real

  • Sent a solid red PNG to deepseek/deepseek-v4.1-flash-1017 through chat/completions as an image_url part. It answered "Red".

Not tested

  • The patched extension running inside Pi with a real image attachment.

CI (Validate package) is green.

@jigjigjig
jigjigjig marked this pull request as ready for review November 20, 2026 13:25
@jigjigjig
jigjigjig merged commit 0e4e165 into main Nov 20, 2026
1 check passed
@jigjigjig
jigjigjig deleted the fix/read-nested-input-modalities branch November 20, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant