streamResponse(options:contextOptions:metadata:prompt:)
Produces a response stream to a prompt.
Declaration
final func streamResponse(options: GenerationOptions = GenerationOptions(), contextOptions: ContextOptions = ContextOptions(), metadata: [String : any Sendable & Codable & Equatable] = [:], @PromptBuilder prompt: () throws -> Prompt) rethrows -> sending LanguageModelSession.ResponseStream<String>Parameters
- options:
Options that control how tokens are sampled from the distribution the model produces.
- contextOptions:
Settings that configure how the model is prompted.
- metadata:
Metadata to attach to the request.
- prompt:
A prompt for the model to respond to.
Return Value
A response stream that produces aggregated tokens.