feat(llm): add image/audio output caps, ImageGenOptions, public OneChunkStream#71
Merged
Conversation
…unkStream Extends sdk/llm with the primitives needed by image-generation adapters in sdkx (MiniMax / Seedream / Qwen-Image) without coupling sdk/llm to any specific provider: - New capabilities CapImageOutput / CapAudioOutput so output modalities are declarable in the blacklist-based ModelCaps matrix; chat-only catalogs get them disabled in a follow-up sdkx PR. - ImageGenOptions + WithImageGen() carry size / aspect-ratio / N / seed / response-format through llm.GenerateOptions. - NewOneChunkStream extracts the previously-private oneChunkStream helper from with_caps.go so synchronous-only adapters can satisfy llm.StreamMessage with a single shared implementation. with_caps.go now delegates to the public helper. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
lIang70
added a commit
that referenced
this pull request
May 7, 2026
sdkx now requires sdk v0.2.8 (PR #71); the local replace makes the e2e module pick up that requirement transitively, so its indirect line needs syncing. CI was failing the 'go: updates to go.mod needed' check before this. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
sdk/llmwith the primitives needed by upcomingimage-generation adapters in
sdkx(MiniMax / Seedream /Qwen-Image), without coupling
sdk/llmto any specific provider.CapImageOutput/CapAudioOutputso outputmodalities are declarable in the blacklist-based
ModelCapsmatrix. Existing chat-only catalogs will get these disabled in a
follow-up
sdkxPR.ImageGenOptions+WithImageGen()carry size / aspect ratio/ N / seed / response-format knobs through
llm.GenerateOptions.NewOneChunkStreamextracts the previously-privateoneChunkStreamhelper fromwith_caps.goso synchronous-onlyadapters can satisfy
llm.StreamMessagewith a single sharedimplementation.
with_caps.gonow delegates to the publichelper.
Why this PR exists
Three image-generation providers are about to land in
sdkx. Theyall need:
parallel
sdk/imageinterface.text-oriented
LLMinterface lacks.single-chunk stream so
llm.StreamMessagecallers don't break.Keeping these in
sdk/llm(rather than copy-pasting per adapter)makes the matrix consistent and unblocks sdkx.
Test plan
go test ./sdk/llm/... -count=1 -race— covers the newonechunk_test.go(text, tool calls, multimodal parts) andthe existing
with_caps_test.gowhich now exercises thepublic helper via the streaming-downgrade path.
go vet ./sdk/...Follow-ups
sdkx: catalog updates (disable new caps on chat models) + thethree image adapters that consume
ImageGenOptionsandNewOneChunkStream.tests/conformance: live API integration tests for the imageproviders (gated on env vars).
Made with Cursor