Documentation
¶
Overview ¶
Demonstrates opencodesdk.QueryStreamContent — the iterator-backed multimodal variant of QueryStream.
Unlike QueryStream (which takes a []string pre-materialised), this variant drives opencode from any iter.Seq[[]ContentBlock] source. The SDK provides four helper constructors:
- opencodesdk.PromptsFromStrings — []string → iter.Seq
- opencodesdk.PromptsFromSlice — [][]CB → iter.Seq
- opencodesdk.PromptsFromChannel — channel → iter.Seq (dynamic)
- opencodesdk.SinglePrompt — single → iter.Seq
This example uses PromptsFromChannel to feed prompts generated on the fly: a goroutine produces three follow-up prompts and closes the channel to signal end-of-stream. Useful for interactive CLIs, chat bots, or queue consumers.
go run ./examples/query_stream_iter
Click to show internal directories.
Click to hide internal directories.