---
title: "respond(to:options:)"
framework: foundationmodels
role: symbol
role_heading: Instance Method
path: "foundationmodels/languagemodelsession/respond(to:options:)-b2re"
---

# respond(to:options:)

Produces a response to a prompt.

## Declaration

```swift
@discardableResult nonisolated(nonsending) final func respond(to prompt: String, options: GenerationOptions = GenerationOptions()) 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.

## Mentioned in

Generating content and performing tasks with Foundation Models

## Return Value

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