respond(to:options:contextOptions:metadata:)
Produces a response to a prompt.
Declaration
@discardableResult nonisolated(nonsending) final func respond(to prompt: Prompt, options: GenerationOptions = GenerationOptions(), contextOptions: ContextOptions = ContextOptions(), metadata: [String : any Sendable & Codable & Equatable] = [:]) async throws -> LanguageModelSession.Response<String>Parameters
- prompt:
A prompt for the model to respond to.
- 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.
Return Value
A string composed of the tokens produced by sampling model output.