Skip to content

feat(attachment, llm): support binary attachments#423

Merged
JeanMertz merged 3 commits intomainfrom
image-attachments-support
Mar 9, 2026
Merged

feat(attachment, llm): support binary attachments#423
JeanMertz merged 3 commits intomainfrom
image-attachments-support

Conversation

@JeanMertz
Copy link
Collaborator

@JeanMertz JeanMertz commented Mar 9, 2026

JP now supports binary attachments, such as images and PDFs, allowing users to provide non-textual context to LLMs. This is achieved by detecting file types via magic bytes using the infer crate and imposing a 10 MiB safety limit on binary data.

Provider implementations have been updated to handle these attachments natively. For example, Anthropic uses document blocks, Google uses inline data, and OpenAI uses image/file content items. Text-based attachments continue to be serialized as XML for providers that do not support native document structures.

Internal changes include refactoring Thread decomposition to pass raw Attachment objects to providers, and updating the Handler trait to support upfront validation of local files.

The toolkit now supports binary attachments, such as images and PDFs,
allowing users to provide non-textual context to LLMs. This is achieved
by detecting file types via magic bytes using the `infer` crate and
imposing a 10 MiB safety limit on binary data.

Provider implementations have been updated to handle these attachments
natively. For example, Anthropic uses document blocks, Google uses
inline data, and OpenAI uses image/file content items. Text-based
attachments continue to be serialized as XML for providers that do not
support native document structures.

Internal changes include refactoring `Thread` decomposition to pass raw
`Attachment` objects to providers, and updating the `Handler` trait to
support upfront validation of local files.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 86fb8b0 into main Mar 9, 2026
11 checks passed
@JeanMertz JeanMertz deleted the image-attachments-support branch March 9, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant