---
title: collect()
framework: foundationmodels
role: symbol
role_heading: Instance Method
path: foundationmodels/languagemodelsession/responsestream/collect()
---

# collect()

The result from a streaming response, after it completes.

## Declaration

```swift
nonisolated(nonsending) func collect() async throws -> sending LanguageModelSession.Response<Content>
```

## Discussion

Discussion If the streaming response was finished successfully before calling collect(), this method Response returns immediately. If the streaming response was finished with an error before calling collect(), this method propagates that error.
