---
title: GenerationID
framework: foundationmodels
role: symbol
role_heading: Structure
path: foundationmodels/generationid
---

# GenerationID

A unique identifier that is stable for the duration of a response, but not across responses.

## Declaration

```swift
struct GenerationID
```

## Overview

Overview The framework guarantees a GenerationID to be both present and stable when you receive it from a LanguageModelSession. When you create an instance of GenerationID there is no guarantee an identifier is present or stable. @Generable struct Person: Equatable {     var id: GenerationID     var name: String }

struct PeopleView: View {     @State private var session = LanguageModelSession()     @State private var people = [Person.PartiallyGenerated]()

var body: some View {         // A person's name changes as the response is generated,         // and two people can have the same name, so it is not suitable         // for use as an id.         //         // `GenerationID` receives special treatment and is guaranteed         // to be both present and stable.         List {             ForEach(people) { person in                 Text("Name: \(person.name)")             }         }         .task {             do {                 for try! await people in stream.streamResponse(                     to: "Who were the first 3 presidents of the US?",                     generating: [Person].self                 ) {                     withAnimation {                         self.people = people                 }             } catch {                 // Handle the thrown error.             }         }     } }

## Topics

### Creating an identifier

- [init()](foundationmodels/generationid/init().md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Identifying a generation

- [id](foundationmodels/generatedcontent/id.md)
