Move string truncation helpers into codex-utils-string#15572
Move string truncation helpers into codex-utils-string#15572aibrahim-oai merged 3 commits intomainfrom
Conversation
56b3e16 to
12948a4
Compare
c62c328 to
5ed93d4
Compare
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
9401d05 to
b8a17ba
Compare
Co-authored-by: Codex <noreply@openai.com>
b8a17ba to
a28046a
Compare
Co-authored-by: Codex <noreply@openai.com>
a28046a to
9e2a887
Compare
9e2a887 to
8aca7f8
Compare
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
8aca7f8 to
fda1492
Compare
Co-authored-by: Codex <noreply@openai.com>
fda1492 to
4bf0fbc
Compare
Co-authored-by: Codex <noreply@openai.com>
4bf0fbc to
8a0da2e
Compare
Co-authored-by: Codex <noreply@openai.com>
8a0da2e to
e66ce7d
Compare
|
@codex review this |
1 similar comment
|
@codex review this |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Co-authored-by: Codex <noreply@openai.com>
e66ce7d to
56f37f8
Compare
Co-authored-by: Codex <noreply@openai.com>
56f37f8 to
333051d
Compare
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 333051d7bc
ℹ️ 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".
| Some(MiddleTruncation { | ||
| prefix, | ||
| suffix, | ||
| removed_bytes: s.len().saturating_sub(max_bytes), |
There was a problem hiding this comment.
Derive removed_bytes from retained slices, not budget
removed_bytes is set to s.len() - max_bytes, but UTF-8 boundary preservation can retain fewer than max_bytes bytes. This undercounts removals for multibyte text (e.g. 4 emojis with max_bytes=14 removes 8 bytes but reports 2). truncate_middle_with_token_budget then underreports removed_tokens because it relies on this field. Compute removals from prefix.len() and suffix.len() instead.
Useful? React with 👍 / 👎.
3b6fddc to
918fbba
Compare
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 918fbba026
ℹ️ 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".
Co-authored-by: Codex <noreply@openai.com>
|
@review and make sure no behavioral changes. |
cf6ff4f to
eae882e
Compare
Co-authored-by: Codex <noreply@openai.com>
7ea10d9 to
94b0e35
Compare
| out | ||
| } | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
why not path = truncate_tests.rs
coreintocodex-utils-stringcodex-coreso rollout can reuse the shared helper in the next stacked PR