ProcessAttachment converts a raw [MessagePart] into a [Document] with fully resolved Source.InlineData or Source.InlineText. It is called once when a message is assembled — never at inference time. Supported input types: - [MessagePartTypeFile]: reads the file from the local filesystem, detects it
(_ context.Context, part MessagePart)
| 48 | // transcoding to any image/* InlineData. A Document with no inline content |
| 49 | // is an error. |
| 50 | func ProcessAttachment(_ context.Context, part MessagePart) (Document, error) { |
| 51 | doc, _, err := ProcessAttachmentWithMetadata(part) |
| 52 | return doc, err |
| 53 | } |
| 54 | |
| 55 | // ProcessAttachmentWithMetadata is like [ProcessAttachment] but also returns |
| 56 | // the [ImageResizeResult] when the attachment was an image that went through |