Repository navigation
Truncate total tool calls text - #5979
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for it in items { | ||
| if let FunctionCallOutputContentItem::InputImage { image_url } = it { | ||
| out.push(FunctionCallOutputContentItem::InputImage { | ||
| image_url: image_url.clone(), |
There was a problem hiding this comment.
This could be a base64 encoded image which could also be huge
There was a problem hiding this comment.
Next step is resizing images
| // Append images. | ||
| for it in items { | ||
| if let FunctionCallOutputContentItem::InputImage { image_url } = it { | ||
| out.push(FunctionCallOutputContentItem::InputImage { |
There was a problem hiding this comment.
Doesn't this reorder items?
I would expect something like:
Map over the items:
- Count the length of the item
- Add it / 4 or some scalar to a running sum
- If >= some max amount, truncate with truncated text. If it's a base64 image, drop it entirely
- Add a text item that says n items ommitted if there are more
Wdyt?
There was a problem hiding this comment.
does the order matter here? If not, we can just have it like that.
I also think that image should be treated differently and resized. Thoughts?
|
Needs integration tests |
| } | ||
| FunctionCallOutputContentItem::InputImage { image_url } => { | ||
| out.push(FunctionCallOutputContentItem::InputImage { | ||
| image_url: image_url.clone(), |
There was a problem hiding this comment.
You can count the url towards remaining even i fyou don't truncate. Maybe add a TODO to truncate images so it doesn't look like they were either intentionally or mistakenly not included
There was a problem hiding this comment.
Do you want to at least subtract len from remaining? That seems low lift and net positive
| } | ||
| FunctionCallOutputContentItem::InputImage { image_url } => { | ||
| out.push(FunctionCallOutputContentItem::InputImage { | ||
| image_url: image_url.clone(), |
There was a problem hiding this comment.
Do you want to at least subtract len from remaining? That seems low lift and net positive
Put a cap on the aggregate output of text content on tool calls.