-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Add the utility to truncate by tokens #6746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
0208094
tighten
aibrahim-oai e91a3b8
tighten
aibrahim-oai fbe5fcf
tighten_panic_double_truncation
aibrahim-oai dbb25e9
tighten_panic_double_truncation
aibrahim-oai d264c11
Merge branch 'main' of https://github.com/openai/codex into tighten_p…
aibrahim-oai 63596d1
truncate
aibrahim-oai b811a9b
change function names
aibrahim-oai d599cf2
cleanup
aibrahim-oai 16369ee
progress
aibrahim-oai 5805ab0
tests
aibrahim-oai 7812ef5
tests
aibrahim-oai c9bc844
tests
aibrahim-oai f1522ba
tests
aibrahim-oai da16813
lint
aibrahim-oai d1d0644
lint
aibrahim-oai 7f9637d
remove line
aibrahim-oai 2835118
remove line
aibrahim-oai 64bb960
router
aibrahim-oai bbfa97e
router
aibrahim-oai 4b58b60
router
aibrahim-oai 5db71f6
router
aibrahim-oai d3c94a3
tests
aibrahim-oai fcc981f
tests
aibrahim-oai a8cdae9
avoid approx with tests
aibrahim-oai 0312d3b
avoid approx with tests
aibrahim-oai 121e943
tests
aibrahim-oai ff3fae6
lint
aibrahim-oai b270394
names
aibrahim-oai ba01537
names
aibrahim-oai 7c3f260
test
aibrahim-oai 95d68bf
comment
aibrahim-oai 779bd97
comment
aibrahim-oai a42e62e
comment
aibrahim-oai f6e6128
comment
aibrahim-oai 3835ee0
progress
aibrahim-oai 6660471
progress
aibrahim-oai 3a51044
progress
aibrahim-oai 21677c5
progress
aibrahim-oai 97ed9f2
tokio tests
aibrahim-oai 459a82e
Merge branch 'main' into truncate-by-tokens
aibrahim-oai 73c79e7
test
aibrahim-oai 163acbe
tests
aibrahim-oai e798801
tests
aibrahim-oai 9c92aad
tests
aibrahim-oai a6abc6a
tests
aibrahim-oai ebb5d98
tests
aibrahim-oai a87aba9
tests
aibrahim-oai 1070fe1
tests
aibrahim-oai 6e910a0
source
aibrahim-oai 602956e
bytes
aibrahim-oai 8c49888
source
aibrahim-oai 0a6de89
test
aibrahim-oai c9bd3e2
tests
aibrahim-oai 5dca008
bytes
aibrahim-oai 53554e3
Merge branch 'main' into truncate-by-tokens
aibrahim-oai 9f337f3
just use bytes
aibrahim-oai 903514b
clean
aibrahim-oai 9572b62
clean
aibrahim-oai cac5b3e
const
aibrahim-oai ddeadc5
const
aibrahim-oai 8ae4de4
helpers
aibrahim-oai 5dbf7d3
Merge branch 'main' into truncate-by-tokens
aibrahim-oai b244de2
tests
aibrahim-oai 63df57d
tests
aibrahim-oai 91741d6
tests
aibrahim-oai 3027a59
tests
aibrahim-oai e5c77dd
test
aibrahim-oai f7a5f69
name
aibrahim-oai c380dae
name
aibrahim-oai 5944058
fix
aibrahim-oai e6af809
fix
aibrahim-oai 7c3afa4
fix
aibrahim-oai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,6 +195,9 @@ pub struct Config { | |
| /// Additional filenames to try when looking for project-level docs. | ||
| pub project_doc_fallback_filenames: Vec<String>, | ||
|
|
||
| /// Token budget applied when storing tool/function outputs in the context manager. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a user-friendlier name? |
||
| pub tool_output_token_limit: Option<usize>, | ||
|
|
||
| /// Directory containing all Codex state (defaults to `~/.codex` but can be | ||
| /// overridden by the `CODEX_HOME` environment variable). | ||
| pub codex_home: PathBuf, | ||
|
|
@@ -636,6 +639,9 @@ pub struct ConfigToml { | |
| /// Ordered list of fallback filenames to look for when AGENTS.md is missing. | ||
| pub project_doc_fallback_filenames: Option<Vec<String>>, | ||
|
|
||
| /// Token budget applied when storing tool/function outputs in the context manager. | ||
| pub tool_output_token_limit: Option<usize>, | ||
|
|
||
| /// Profile to use from the `profiles` map. | ||
| pub profile: Option<String>, | ||
|
|
||
|
|
@@ -1209,6 +1215,7 @@ impl Config { | |
| } | ||
| }) | ||
| .collect(), | ||
| tool_output_token_limit: cfg.tool_output_token_limit, | ||
| codex_home, | ||
| history, | ||
| file_opener: cfg.file_opener.unwrap_or(UriBasedFileOpener::VsCode), | ||
|
|
@@ -2961,6 +2968,7 @@ model_verbosity = "high" | |
| model_providers: fixture.model_provider_map.clone(), | ||
| project_doc_max_bytes: PROJECT_DOC_MAX_BYTES, | ||
| project_doc_fallback_filenames: Vec::new(), | ||
| tool_output_token_limit: None, | ||
| codex_home: fixture.codex_home(), | ||
| history: History::default(), | ||
| file_opener: UriBasedFileOpener::VsCode, | ||
|
|
@@ -3032,6 +3040,7 @@ model_verbosity = "high" | |
| model_providers: fixture.model_provider_map.clone(), | ||
| project_doc_max_bytes: PROJECT_DOC_MAX_BYTES, | ||
| project_doc_fallback_filenames: Vec::new(), | ||
| tool_output_token_limit: None, | ||
| codex_home: fixture.codex_home(), | ||
| history: History::default(), | ||
| file_opener: UriBasedFileOpener::VsCode, | ||
|
|
@@ -3118,6 +3127,7 @@ model_verbosity = "high" | |
| model_providers: fixture.model_provider_map.clone(), | ||
| project_doc_max_bytes: PROJECT_DOC_MAX_BYTES, | ||
| project_doc_fallback_filenames: Vec::new(), | ||
| tool_output_token_limit: None, | ||
| codex_home: fixture.codex_home(), | ||
| history: History::default(), | ||
| file_opener: UriBasedFileOpener::VsCode, | ||
|
|
@@ -3190,6 +3200,7 @@ model_verbosity = "high" | |
| model_providers: fixture.model_provider_map.clone(), | ||
| project_doc_max_bytes: PROJECT_DOC_MAX_BYTES, | ||
| project_doc_fallback_filenames: Vec::new(), | ||
| tool_output_token_limit: None, | ||
| codex_home: fixture.codex_home(), | ||
| history: History::default(), | ||
| file_opener: UriBasedFileOpener::VsCode, | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.