query_stream_iter

command
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL