mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Account for file images in context budgets and Guardian reviews (#46072)
## Why File images contributed zero to history and compaction token estimates and were dropped from Guardian context. This undercounted context usage and omitted image evidence from reviews. ## What changed - Estimate file images using the fixed resized-image cost, or 10,000 patch tokens for `original` detail because file references do not expose dimensions. - Charge file images against remote compaction and Guardian request budgets. - Preserve file images from user messages and tool outputs through Guardian selection and delivery, and deduplicate review images by file ID. - Apply transcript image count and byte limits to both reference types, counting file ID bytes rather than referenced file contents. ## Testing Add coverage for file-image estimates, selection limits, delivery, and compaction retention. Extend Guardian tests to verify file-image evidence reaches reviews and uploaded original-detail images trigger reviewer-history compaction. GitOrigin-RevId: ee024204dcbe16e277fea9347c6a4d7fc120e18d
This commit is contained in:
1 parent
ce03f22af6
commit
b974893c90
18 files changed
+481
-199
No files matched your search
@@ -108,7 +108,9 @@ impl SectionCost {
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => {}
|
||||
} => {
|
||||
self.image_count = self.image_count.saturating_add(1);
|
||||
}
|
||||
ContentItem::InputAudio { audio_url } => {
|
||||
// Guardian currently has no audio contributor. Count a future opaque
|
||||
// payload conservatively until its consumer supplies modality costs.
|
||||
@@ -214,17 +216,16 @@ pub(super) fn content_framing_tokens(item_count: usize) -> usize {
|
||||
|
||||
fn adjusted_tokens(mut bytes: usize, content: &[ContentItem]) -> usize {
|
||||
for item in content {
|
||||
if let ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
..
|
||||
} = item
|
||||
{
|
||||
let payload = ByteCount::measure(|counter| serde_json::to_writer(counter, image_url));
|
||||
if payload == usize::MAX {
|
||||
return usize::MAX;
|
||||
if let ContentItem::InputImage { image, .. } = item {
|
||||
if let ImageReference::Inline { image_url } = image {
|
||||
let payload =
|
||||
ByteCount::measure(|counter| serde_json::to_writer(counter, image_url));
|
||||
if payload == usize::MAX {
|
||||
return usize::MAX;
|
||||
}
|
||||
bytes = bytes.saturating_sub(payload.saturating_sub(2));
|
||||
}
|
||||
bytes = bytes
|
||||
.saturating_sub(payload.saturating_sub(2))
|
||||
.saturating_add(TruncationPolicy::Tokens(IMAGE_TOKEN_RESERVATION).byte_budget());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ fn section_costs_keep_multimodal_payloads_separate() {
|
||||
},
|
||||
detail: None,
|
||||
}),
|
||||
Budgeted::required(ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: "file_123".to_owned(),
|
||||
},
|
||||
detail: None,
|
||||
}),
|
||||
]),
|
||||
},
|
||||
SectionOutput {
|
||||
@@ -44,7 +50,7 @@ fn section_costs_keep_multimodal_payloads_separate() {
|
||||
SectionCost {
|
||||
text_bytes: "évidence".len(),
|
||||
image_bytes: "data:image/png;base64,AAAA".len(),
|
||||
image_count: 1
|
||||
image_count: 2
|
||||
}
|
||||
),
|
||||
(
|
||||
@@ -71,6 +77,14 @@ fn request_estimate_reserves_images_independently_of_encoded_size() {
|
||||
let short = estimate_input_tokens(&image("AAAA"));
|
||||
assert_eq!(short, estimate_input_tokens(&image(&"A".repeat(200_000))));
|
||||
assert!(short >= IMAGE_TOKEN_RESERVATION);
|
||||
|
||||
let file = message(vec![ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: "file_123".to_owned(),
|
||||
},
|
||||
detail: Some(codex_protocol::models::ImageDetail::Original),
|
||||
}]);
|
||||
assert!(estimate_input_tokens(&file) >= IMAGE_TOKEN_RESERVATION);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -292,17 +292,7 @@ impl ComposedContext {
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
} => UserInput::Image {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
},
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => continue,
|
||||
ContentItem::InputImage { image, detail } => UserInput::Image { image, detail },
|
||||
ContentItem::InputAudio { .. } | ContentItem::OutputText { .. } => {
|
||||
return Err(SectionError::UnsupportedDelivery {
|
||||
section: section.id,
|
||||
@@ -330,10 +320,6 @@ impl ComposedContext {
|
||||
}
|
||||
}));
|
||||
}
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => {}
|
||||
content => user_content.push(content),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use super::*;
|
||||
use codex_protocol::models::ImageDetail;
|
||||
use codex_protocol::models::ImageReference;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
@@ -56,12 +58,21 @@ fn delivery_preserves_arbitrary_message_boundaries_and_rejects_them_for_sync() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn long_text_delivery_is_lossless_bounded_and_fully_budgeted() {
|
||||
fn long_text_and_file_image_delivery_is_lossless_bounded_and_fully_budgeted() {
|
||||
let text = "é🙂\"\n".repeat(/*n*/ 20_000);
|
||||
let file_image = ImageReference::File {
|
||||
file_id: "file_123".to_owned(),
|
||||
};
|
||||
let context = ComposedContext {
|
||||
sections: vec![SectionOutput {
|
||||
id: "planned_action",
|
||||
delivery: text_content(vec![text.clone()]),
|
||||
delivery: SectionDelivery::UserContent(vec![
|
||||
Budgeted::required(ContentItem::InputText { text: text.clone() }),
|
||||
Budgeted::required(ContentItem::InputImage {
|
||||
image: file_image.clone(),
|
||||
detail: Some(ImageDetail::High),
|
||||
}),
|
||||
]),
|
||||
}],
|
||||
truncations: Vec::new(),
|
||||
};
|
||||
@@ -70,7 +81,15 @@ fn long_text_delivery_is_lossless_bounded_and_fully_budgeted() {
|
||||
let ResponseItem::Message { content, .. } = &messages[0] else {
|
||||
panic!("user message")
|
||||
};
|
||||
let parts = content
|
||||
let (image, text_content) = content.split_last().expect("message content");
|
||||
assert_eq!(
|
||||
image,
|
||||
&ContentItem::InputImage {
|
||||
image: file_image.clone(),
|
||||
detail: Some(ImageDetail::High),
|
||||
}
|
||||
);
|
||||
let parts = text_content
|
||||
.iter()
|
||||
.map(|item| match item {
|
||||
ContentItem::InputText { text } => text.as_str(),
|
||||
@@ -84,14 +103,16 @@ fn long_text_delivery_is_lossless_bounded_and_fully_budgeted() {
|
||||
.all(|part| part.len() <= TruncationPolicy::Tokens(9_000).byte_budget())
|
||||
);
|
||||
assert!(estimated >= crate::estimate_input_tokens(&messages[0]));
|
||||
assert_eq!(
|
||||
context.into_user_inputs().unwrap(),
|
||||
parts
|
||||
.into_iter()
|
||||
.map(|part| UserInput::Text {
|
||||
text: part.to_owned(),
|
||||
text_elements: Vec::new(),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
let mut expected_inputs = parts
|
||||
.into_iter()
|
||||
.map(|part| UserInput::Text {
|
||||
text: part.to_owned(),
|
||||
text_elements: Vec::new(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
expected_inputs.push(UserInput::Image {
|
||||
image: file_image,
|
||||
detail: Some(ImageDetail::High),
|
||||
});
|
||||
assert_eq!(context.into_user_inputs().unwrap(), expected_inputs);
|
||||
}
|
||||
@@ -88,17 +88,13 @@ pub enum HistoryTruncation {
|
||||
impl ComposedContext {
|
||||
/// Applies host image admission before aggregate selection, preserving section
|
||||
/// identity and each retained item's selection policy.
|
||||
pub fn retain_images(&mut self, mut admit: impl FnMut(&str, &mut Option<ImageDetail>) -> bool) {
|
||||
pub fn retain_images(
|
||||
&mut self,
|
||||
mut admit: impl FnMut(&ImageReference, &mut Option<ImageDetail>) -> bool,
|
||||
) {
|
||||
for section in &mut self.sections {
|
||||
retain_content(section, &mut self.truncations, |_, item| match item {
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
} => admit(image_url, detail),
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => false,
|
||||
ContentItem::InputImage { image, detail } => admit(image, detail),
|
||||
_ => true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -236,8 +236,14 @@ fn budget_reserves_existing_context_and_preserves_required_messages() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_omission_preserves_text_and_later_eviction_policy() {
|
||||
fn image_accounting_preserves_later_eviction_policy() {
|
||||
let evidence = text(&"optional commentary ".repeat(/*n*/ 100));
|
||||
let file_image = ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: "file_123".to_owned(),
|
||||
},
|
||||
detail: None,
|
||||
};
|
||||
let mut context = ComposedContext {
|
||||
sections: vec![SectionOutput {
|
||||
id: "evidence",
|
||||
@@ -251,6 +257,7 @@ fn image_omission_preserves_text_and_later_eviction_policy() {
|
||||
},
|
||||
BudgetPriority::Image,
|
||||
),
|
||||
Budgeted::optional(file_image.clone(), BudgetPriority::Image),
|
||||
Budgeted::optional(evidence.clone(), BudgetPriority::Commentary),
|
||||
Budgeted::required(text("user restriction")),
|
||||
]),
|
||||
@@ -261,7 +268,7 @@ fn image_omission_preserves_text_and_later_eviction_policy() {
|
||||
.clone()
|
||||
.enforce_budget(
|
||||
RequestBudget {
|
||||
max_input_tokens: 1_000,
|
||||
max_input_tokens: content_tokens(&file_image).saturating_add(1_000),
|
||||
existing_context_tokens: 0,
|
||||
},
|
||||
"evidence omitted".to_owned(),
|
||||
@@ -271,12 +278,12 @@ fn image_omission_preserves_text_and_later_eviction_policy() {
|
||||
assert_eq!(
|
||||
without_oversized_image.into_messages(),
|
||||
vec![user_message(vec![
|
||||
evidence.clone(),
|
||||
file_image.clone(),
|
||||
text("user restriction"),
|
||||
text("evidence omitted")
|
||||
])]
|
||||
);
|
||||
context.retain_images(|_, _| false);
|
||||
context.retain_images(|image, _| matches!(image, ImageReference::File { .. }));
|
||||
let available = context.estimated_tokens();
|
||||
let retained = context
|
||||
.clone()
|
||||
@@ -291,12 +298,16 @@ fn image_omission_preserves_text_and_later_eviction_policy() {
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
retained.into_messages(),
|
||||
vec![user_message(vec![evidence, text("user restriction")])]
|
||||
vec![user_message(vec![
|
||||
file_image.clone(),
|
||||
evidence,
|
||||
text("user restriction")
|
||||
])]
|
||||
);
|
||||
let smaller = context
|
||||
.enforce_budget(
|
||||
RequestBudget {
|
||||
max_input_tokens: 100,
|
||||
max_input_tokens: content_tokens(&file_image).saturating_add(100),
|
||||
existing_context_tokens: 0,
|
||||
},
|
||||
"evidence omitted".to_owned(),
|
||||
@@ -306,6 +317,7 @@ fn image_omission_preserves_text_and_later_eviction_policy() {
|
||||
assert_eq!(
|
||||
smaller.into_messages(),
|
||||
vec![user_message(vec![
|
||||
file_image,
|
||||
text("user restriction"),
|
||||
text("evidence omitted")
|
||||
])]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Bounded image selection shared by Guardian consumers.
|
||||
//! Keeps source order and evicts oldest images using the existing count/byte caps.
|
||||
//! Byte caps cover inline URLs and file ID strings, not referenced file contents.
|
||||
//! Consumers still choose source visibility and model-specific image detail.
|
||||
|
||||
use crate::ContextSection;
|
||||
@@ -29,6 +30,7 @@ pub struct TranscriptImageInput<'a> {
|
||||
#[derive(Clone, Default, PartialEq)]
|
||||
pub struct TranscriptImages {
|
||||
pub images: Vec<ContentItem>,
|
||||
/// Omitted inline payload or file ID bytes, not the size of referenced files.
|
||||
pub omitted_bytes: usize,
|
||||
}
|
||||
|
||||
@@ -56,37 +58,37 @@ impl TranscriptImages {
|
||||
}
|
||||
|
||||
let mut images = VecDeque::new();
|
||||
let mut image_bytes = 0usize;
|
||||
let mut image_reference_bytes = 0usize;
|
||||
let mut omitted_bytes = 0usize;
|
||||
let mut include_image = |image_url: &str, detail: Option<ImageDetail>| {
|
||||
if image_url.len() > MAX_TRANSCRIPT_IMAGE_BYTES {
|
||||
omitted_bytes = omitted_bytes.saturating_add(image_url.len());
|
||||
let mut include_image = |image: &ImageReference, detail: Option<ImageDetail>| {
|
||||
let reference_bytes = match image {
|
||||
ImageReference::Inline { image_url } => image_url.len(),
|
||||
ImageReference::File { file_id } => file_id.len(),
|
||||
};
|
||||
if reference_bytes > MAX_TRANSCRIPT_IMAGE_BYTES {
|
||||
omitted_bytes = omitted_bytes.saturating_add(reference_bytes);
|
||||
return;
|
||||
}
|
||||
while images.len() >= MAX_TRANSCRIPT_IMAGES
|
||||
|| image_bytes + image_url.len() > MAX_TRANSCRIPT_IMAGE_BYTES
|
||||
|| image_reference_bytes + reference_bytes > MAX_TRANSCRIPT_IMAGE_BYTES
|
||||
{
|
||||
let Some(ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
..
|
||||
}) = images.pop_front()
|
||||
else {
|
||||
let Some(ContentItem::InputImage { image, .. }) = images.pop_front() else {
|
||||
break;
|
||||
};
|
||||
image_bytes -= image_url.len();
|
||||
omitted_bytes = omitted_bytes.saturating_add(image_url.len());
|
||||
let evicted_bytes = match image {
|
||||
ImageReference::Inline { image_url } => image_url.len(),
|
||||
ImageReference::File { file_id } => file_id.len(),
|
||||
};
|
||||
image_reference_bytes = image_reference_bytes.saturating_sub(evicted_bytes);
|
||||
omitted_bytes = omitted_bytes.saturating_add(evicted_bytes);
|
||||
}
|
||||
image_bytes += image_url.len();
|
||||
image_reference_bytes = image_reference_bytes.saturating_add(reference_bytes);
|
||||
images.push_back(ContentItem::InputImage {
|
||||
image: ImageReference::Inline {
|
||||
image_url: image_url.to_owned(),
|
||||
},
|
||||
image: image.clone(),
|
||||
detail,
|
||||
});
|
||||
};
|
||||
|
||||
// TODO(kc) Include file-backed images once Guardian can admit them without resolving or
|
||||
// applying byte-based checks in Core.
|
||||
for item in items {
|
||||
match item {
|
||||
ResponseItem::Message { role, content, .. }
|
||||
@@ -94,15 +96,10 @@ impl TranscriptImages {
|
||||
{
|
||||
for item in content {
|
||||
match item {
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
} => include_image(image_url, *detail),
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
ContentItem::InputImage { image, detail } => {
|
||||
include_image(image, *detail)
|
||||
}
|
||||
| ContentItem::InputText { .. }
|
||||
ContentItem::InputText { .. }
|
||||
| ContentItem::InputAudio { .. }
|
||||
| ContentItem::OutputText { .. } => {}
|
||||
}
|
||||
@@ -115,15 +112,10 @@ impl TranscriptImages {
|
||||
if let Some(content) = output.content_items() {
|
||||
for item in content {
|
||||
match item {
|
||||
FunctionCallOutputContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
} => include_image(image_url, *detail),
|
||||
FunctionCallOutputContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
FunctionCallOutputContentItem::InputImage { image, detail } => {
|
||||
include_image(image, *detail)
|
||||
}
|
||||
| FunctionCallOutputContentItem::InputText { .. }
|
||||
FunctionCallOutputContentItem::InputText { .. }
|
||||
| FunctionCallOutputContentItem::InputAudio { .. }
|
||||
| FunctionCallOutputContentItem::EncryptedContent { .. } => {}
|
||||
}
|
||||
@@ -137,9 +129,9 @@ impl TranscriptImages {
|
||||
for image in input.node_repl_images {
|
||||
match image {
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
image: image @ ImageReference::Inline { .. },
|
||||
detail,
|
||||
} => include_image(image_url, *detail),
|
||||
} => include_image(image, *detail),
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
use super::MAX_TRANSCRIPT_IMAGE_BYTES;
|
||||
use super::TranscriptImageInput;
|
||||
use super::TranscriptImages;
|
||||
use crate::CollectedContext;
|
||||
use crate::ContextPresentation;
|
||||
use crate::ContextSection;
|
||||
use crate::RenderedTranscript;
|
||||
use crate::composition::user_message;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::models::FunctionCallOutputContentItem;
|
||||
use codex_protocol::models::FunctionCallOutputPayload;
|
||||
@@ -99,20 +104,26 @@ fn image_selection_preserves_source_policy_order_and_both_limits() {
|
||||
);
|
||||
}
|
||||
|
||||
/// File-backed images stay out of Guardian without consuming its inline-image capacity.
|
||||
/// File-backed history images share count and reference-byte limits with inline images.
|
||||
#[test]
|
||||
fn file_images_are_omitted_without_displacing_inline_images() {
|
||||
fn file_images_are_selected_from_history_sources() {
|
||||
let file_image = ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: "file_123".to_string(),
|
||||
},
|
||||
detail: Some(ImageDetail::High),
|
||||
};
|
||||
let tool_file_image = ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: "file_tool".to_string(),
|
||||
},
|
||||
detail: Some(ImageDetail::High),
|
||||
};
|
||||
let history = [
|
||||
ResponseItem::Message {
|
||||
id: None,
|
||||
role: "user".into(),
|
||||
content: vec![image("first"), file_image.clone(), image("second")],
|
||||
content: vec![image("first"), file_image.clone()],
|
||||
phase: None,
|
||||
internal_chat_message_metadata_passthrough: None,
|
||||
},
|
||||
@@ -138,16 +149,7 @@ fn file_images_are_omitted_without_displacing_inline_images() {
|
||||
internal_chat_message_metadata_passthrough: None,
|
||||
},
|
||||
];
|
||||
let repl = [
|
||||
file_image,
|
||||
image("fourth"),
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: "file_repl".to_string(),
|
||||
},
|
||||
detail: Some(ImageDetail::High),
|
||||
},
|
||||
];
|
||||
let repl = [image("fourth")];
|
||||
|
||||
assert_eq!(
|
||||
TranscriptImages::collect(
|
||||
@@ -159,8 +161,94 @@ fn file_images_are_omitted_without_displacing_inline_images() {
|
||||
}
|
||||
),
|
||||
TranscriptImages {
|
||||
images: ["first", "second", "third", "fourth"].map(image).to_vec(),
|
||||
omitted_bytes: 0,
|
||||
images: vec![file_image, tool_file_image, image("third"), image("fourth")],
|
||||
omitted_bytes: "first".len(),
|
||||
}
|
||||
);
|
||||
|
||||
// Count-only eviction must remain observable even when no inline bytes were omitted.
|
||||
let file_images =
|
||||
["file_1", "file_2", "file_3", "file_4", "file_5"].map(|file_id| ContentItem::InputImage {
|
||||
image: ImageReference::File {
|
||||
file_id: file_id.to_owned(),
|
||||
},
|
||||
detail: Some(ImageDetail::High),
|
||||
});
|
||||
let history = [ResponseItem::Message {
|
||||
id: None,
|
||||
role: "user".into(),
|
||||
content: file_images.to_vec(),
|
||||
phase: None,
|
||||
internal_chat_message_metadata_passthrough: None,
|
||||
}];
|
||||
let selected = TranscriptImages::collect(
|
||||
&history,
|
||||
TranscriptImageInput {
|
||||
enabled: true,
|
||||
include_tool_outputs: true,
|
||||
node_repl_images: &[],
|
||||
},
|
||||
);
|
||||
assert_eq!(
|
||||
selected,
|
||||
TranscriptImages {
|
||||
images: file_images[1..].to_vec(),
|
||||
omitted_bytes: "file_1".len(),
|
||||
}
|
||||
);
|
||||
let context = CollectedContext {
|
||||
sections: vec![ContextSection::TranscriptImages(selected)],
|
||||
}
|
||||
.compose(
|
||||
ContextPresentation::Async,
|
||||
RenderedTranscript {
|
||||
items: Vec::new(),
|
||||
omission_note: None,
|
||||
truncations: Vec::new(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
context
|
||||
.truncations
|
||||
.iter()
|
||||
.map(|observation| (
|
||||
observation.component,
|
||||
observation.original_bytes,
|
||||
observation.retained_bytes,
|
||||
))
|
||||
.collect::<Vec<_>>(),
|
||||
vec![("transcript_image", "file_1".len(), 0)]
|
||||
);
|
||||
|
||||
// Newer evidence evicts the full-budget ID; the oversized ID must not displace it.
|
||||
let content = [
|
||||
ImageReference::File {
|
||||
file_id: "x".repeat(MAX_TRANSCRIPT_IMAGE_BYTES),
|
||||
},
|
||||
ImageReference::Inline {
|
||||
image_url: "recent".into(),
|
||||
},
|
||||
ImageReference::File {
|
||||
file_id: "y".repeat(MAX_TRANSCRIPT_IMAGE_BYTES + 1),
|
||||
},
|
||||
]
|
||||
.map(|image| ContentItem::InputImage {
|
||||
image,
|
||||
detail: Some(ImageDetail::High),
|
||||
});
|
||||
assert_eq!(
|
||||
TranscriptImages::collect(
|
||||
&[user_message(content.to_vec())],
|
||||
TranscriptImageInput {
|
||||
enabled: true,
|
||||
include_tool_outputs: true,
|
||||
node_repl_images: &[],
|
||||
},
|
||||
),
|
||||
TranscriptImages {
|
||||
images: vec![image("recent")],
|
||||
omitted_bytes: 2 * MAX_TRANSCRIPT_IMAGE_BYTES + 1,
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user