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