pub struct TurnAttachments {
pub parts: Vec<ContentPart>,
pub omitted: Vec<OmittedAttachment>,
}Expand description
The turn’s files as a model can be given them, and the ones it cannot.
Fields§
§parts: Vec<ContentPart>The parts to append to the request, in the order the turn carried them.
omitted: Vec<OmittedAttachment>The files that did not make it, in the same order.
Never silently empty on a turn that dropped something: the whole point of carrying this beside the parts is that an answer about the wrong document is worse than an answer about none.
Implementations§
Source§impl TurnAttachments
impl TurnAttachments
Sourcepub async fn gather(
source: Option<&Arc<dyn AttachmentSource>>,
config: AttachmentConfig,
turn_id: &TurnId,
attachments: &[AttachmentRef],
carries: impl Fn(&ContentPart) -> bool,
) -> Self
pub async fn gather( source: Option<&Arc<dyn AttachmentSource>>, config: AttachmentConfig, turn_id: &TurnId, attachments: &[AttachmentRef], carries: impl Fn(&ContentPart) -> bool, ) -> Self
Fetches every attachment of the turn, in order, within the budget.
§Order, and why it is the turn’s
The files are taken in the order the user attached them and the budget is spent in that order, so a turn that overruns loses its last file rather than an arbitrary one. A file too large for the whole budget is skipped and the smaller ones behind it are still taken, because dropping the rest of somebody’s upload over one oversized photograph helps nobody.
§With no source configured
Nothing is fetched and nothing is reported. A deployment that never
registered an AttachmentSource has not lost a file it was showing —
it is the behaviour this runtime had before the port existed, and saying
“I could not look at your file” to every such turn would be noise about a
feature nobody asked for.