attachmentLabel
TypeScriptget attachmentLabel(): stringSwift declarationlet attachmentLabel: StringThe label of the referenced image.
struct · iOS 27.0+ · SDK 27.1
struct ImageReferenceA reference to an image in a session's transcript. Use `ImageReference` to allow the model to reference images from the transcript of the current `LanguageModelSession`. You can define an `ImageReference` as an argument to a `Tool`. Retrieve the referenced image from the transcript during the tool call. ```swift struct MyTool: Tool { @SessionProperty(\.history) var history @Generable struct Arguments { var image: ImageReference } public func call(arguments: Arguments) async throws -> Output { guard let imageAttachment = arguments.image.resolved(in: history) else { throw ImageToolError.imageNotFound(arguments.image.attachmentLabel) } let image = imageAttachment.cgImage ... } } ```
get attachmentLabel(): stringSwift declarationlet attachmentLabel: StringThe label of the referenced image.
get generatedContent(): GeneratedContentSwift declarationnonisolated var generatedContent: GeneratedContent { get }This instance represented as generated content. Conformance to this protocol is provided by the `@Generable` macro. You can provide a manual implementation to map values onto properties using different names. Use the generated content property as shown below, to manually return a new ``GeneratedContent`` with the properties you specify. ```swift struct Person: ConvertibleToGeneratedContent { var name: String var age: Int var generatedContent: GeneratedContent { GeneratedContent(properties: [ "firstName": name, "ageInYears": age ]) } } ``` - Important: If your type also conforms to ``ConvertibleFromGeneratedContent``, it is critical that this implementation be symmetrical with ``ConvertibleFromGeneratedContent/init(_:)``.
static get generationSchema(): GenerationSchemaSwift declarationnonisolated static var generationSchema: GenerationSchema { get }An instance of the generation schema.
static init(content: GeneratedContent): ImageReferenceSwift declarationnonisolated init(_ content: GeneratedContent) throwsCreates an instance from content generated by a model. Conformance to this protocol is provided by the `@Generable` macro. You can provide a manual implementation to map values onto properties using different names. To manually initialize your type from generated content, decode the values as shown below: ```swift struct Person: ConvertibleFromGeneratedContent { var name: String var age: Int init(_ content: GeneratedContent) { self.name = try content.value(forProperty: "firstName") self.age = try content.value(forProperty: "ageInYears") } } ``` - Important: If your type also conforms to ``ConvertibleToGeneratedContent``, it is critical that this implementation be symmetrical with ``ConvertibleToGeneratedContent/generatedContent``. - SeeAlso: `@Generable` macro ``Generable(description:)``
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
ImageReference.resolved(in:)
This parameter hides a concrete Swift type.