mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
Track image preparation details in turn analytics (#36388)
## What changed - Record the effective detail setting and source and prepared dimensions for successfully decoded images. - Associate message images with their role and tool-output images with their originating call ID. - Include the collected image preparation metadata in the corresponding turn analytics event. ## Testing - Cover image resize metadata, tool-output attribution, turn aggregation, event serialization, and app-server analytics output. GitOrigin-RevId: dbfb5ba1ce7cb02dd93d9b579c5109817f16aef5
This commit is contained in:
1 parent
bf7804c254
commit
1bef168976
13 files changed
+315
-29
No files matched your search
@@ -39,6 +39,8 @@ pub use crate::error::ImageProcessingError;
|
||||
pub struct EncodedImage {
|
||||
pub bytes: Arc<[u8]>,
|
||||
pub mime: String,
|
||||
pub source_width: u32,
|
||||
pub source_height: u32,
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
}
|
||||
@@ -152,7 +154,7 @@ pub fn load_for_prompt_bytes(
|
||||
PromptImageMode::ResizeToFit | PromptImageMode::Original => None,
|
||||
};
|
||||
|
||||
let encoded = if let Some((width, height, resized)) = target_dimensions {
|
||||
let encoded = if let Some((prepared_width, prepared_height, resized)) = target_dimensions {
|
||||
let target_format = format
|
||||
.filter(|format| can_preserve_source_bytes(*format))
|
||||
.unwrap_or(ImageFormat::Png);
|
||||
@@ -161,8 +163,10 @@ pub fn load_for_prompt_bytes(
|
||||
EncodedImage {
|
||||
bytes: bytes.into(),
|
||||
mime,
|
||||
width,
|
||||
height,
|
||||
source_width: width,
|
||||
source_height: height,
|
||||
width: prepared_width,
|
||||
height: prepared_height,
|
||||
}
|
||||
} else {
|
||||
if let Some(format) = format.filter(|format| can_preserve_source_bytes(*format)) {
|
||||
@@ -170,6 +174,8 @@ pub fn load_for_prompt_bytes(
|
||||
EncodedImage {
|
||||
bytes: file_bytes.into(),
|
||||
mime,
|
||||
source_width: width,
|
||||
source_height: height,
|
||||
width,
|
||||
height,
|
||||
}
|
||||
@@ -179,6 +185,8 @@ pub fn load_for_prompt_bytes(
|
||||
EncodedImage {
|
||||
bytes: bytes.into(),
|
||||
mime,
|
||||
source_width: width,
|
||||
source_height: height,
|
||||
width,
|
||||
height,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user