Skip to content

feat(#3996): resolve and filter input media per request model - #4016

Open
aheritier wants to merge 3 commits into
mainfrom
media-input-modalities
Open

feat(#3996): resolve and filter input media per request model#4016
aheritier wants to merge 3 commits into
mainfrom
media-input-modalities

Conversation

@aheritier

@aheritier aheritier commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

What and why

Resolve audio/video input capability independently and support latest-only configuration overrides. Filter unsupported image/audio/video parts using the model selected for each request, preserve provider-specific image fallbacks, and prepare history again for fallback models. Stored history and supported text/document ordering remain intact. Input audio/video capability invariants are retained; this does not add universal upload or conversion support.

Part of #3996. Review this PR against its immediate parent, main, rather than the aggregate stack against main.

Commit inventory

Head: 309a95662d205a795722eae67a1b3c9d906f99bc; parent SHA: 316a5d2fe3c1b3a97fe0e6a867f6715d173cbd70.

Validation

Build, test compilation, owning-package tests and the named fixture passed at this PR head.

Exact deterministic fixture command:

go test -v -count=1 ./pkg/modelinfo ./pkg/config/latest ./pkg/runtime ./pkg/hooks/builtins -run 'TestResolveCaps_OverrideAudioVideo|TestLoadCaps_UnknownModelHasNoAudioVideo|TestStripUnsupportedModalitiesTransform|TestRunStream_FallbackUsesItsOwnCapabilities|TestRegisterInstallsAllBuiltins|TestModelConfigCapabilitiesAudioVideo'

Matched top-level tests: pkg/config/latest: 2; pkg/hooks/builtins: 1; pkg/modelinfo: 2; pkg/runtime: 3.

Deterministic scope: the named local fixture exercises this PR boundary with disposable configuration/stores and fake or loopback providers as applicable. Every listed package ran nonzero matching top-level tests.

Deferred/live scope: Live provider, remote CI, and platform execution are not claimed by this deterministic receipt. The final stack head passed build, lint, full tests, an uncached full suite, focused race tests and documentation checks in disposable environments. Remote CI is tracked by the checks below; no new paid-provider or active-database validation was run.

@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/providers/openai For features/issues/fixes related to the usage of OpenAI models area/providers/anthropic For features/issues/fixes related to the usage of Anthropic models area/providers/bedrock AWS Bedrock provider support area/providers/gemini Google Gemini provider support area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/testing Test infrastructure, CI/CD, test runners, evaluation kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Aug 22, 2026
@aheritier
aheritier force-pushed the media-input-modalities branch 2 times, most recently from 2000915 to d2b8ce4 Compare August 25, 2026 20:24
@aheritier
aheritier force-pushed the media-input-modalities branch 3 times, most recently from d2b8ce4 to 26adf11 Compare September 1, 2026 16:29
aheritier

This comment was marked as resolved.

@aheritier
aheritier force-pushed the media-input-modalities branch 7 times, most recently from 1898a54 to 0180c77 Compare September 8, 2026 17:30
Extend ModelCapabilities, CapsWith, CapsOverride and catalogue parsing with
audio/video input support. Unknown models remain conservative. Update
provider and attachment callers for the expanded capability shape without
adding audio/video conversion support or changing the config schema.

Retain the existing cancellable catalogue-load timeout and conservative
fallback; waiting for the shared store lock remains outside that timeout.
Cover modality and MIME matching, overrides, and fallback behavior.
Extend latest.CapabilitiesConfig with Audio and Video and wire all four
input flags through base.Config.CapsOverride. This lets custom or
uncatalogued models override incomplete models.dev input metadata.
Update agent-schema.json, model-reference docs, capability-overrides.yaml,
and schema/config/provider tests. Numbered config packages stay frozen.
Generalize strip_unsupported_modalities across image, audio, and video
parts using the capabilities of the model selected for each attempt.
Prepare history again for each fallback provider rather than reusing the
primary model's filtered copy, so a capable fallback retains user media.
Keep stored history unchanged, preserve text and document ordering, and
register the builtin by default for agents that bypass the YAML loader.

Expose ModelAudioCapable and ModelVideoCapable to transform hooks. Unknown
catalogue entries remain conservative for audio/video; retain DMR provider
flags and the existing Anthropic/Claude image/PDF fallback. Update the
configuration reference and example, and test MIME mapping, runtime-only
agents, per-tool models, and primary/fallback capability differences.
@aheritier
aheritier force-pushed the media-input-modalities branch from 0180c77 to 309a956 Compare September 8, 2026 20:32
@aheritier aheritier changed the title feat(#3996): strip unsupported audio/video media parts feat(#3996): resolve and filter input media per request model Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/providers/anthropic For features/issues/fixes related to the usage of Anthropic models area/providers/bedrock AWS Bedrock provider support area/providers/gemini Google Gemini provider support area/providers/openai For features/issues/fixes related to the usage of OpenAI models area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/testing Test infrastructure, CI/CD, test runners, evaluation kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant