Contents

respond(options:prompt:)

Produces a response to a prompt.

Declaration

@discardableResult nonisolated(nonsending) final func respond(options: GenerationOptions = GenerationOptions(), @PromptBuilder prompt: () throws -> Prompt) async throws -> LanguageModelSession.Response<String>

Parameters

  • options:

    GenerationOptions that control how tokens are sampled from the distribution the model produces.

  • prompt:

    A prompt for the model to respond to.

Return Value

A string composed of the tokens produced by sampling model output.

See Also

Generating a request