Skip to content
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

fix: fixup token limits #1139

Merged
merged 1 commit into from
Sep 22, 2023
Merged

fix: fixup token limits #1139

merged 1 commit into from
Sep 22, 2023

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Sep 21, 2023

RE: #207

There's a hard error "The amount of text selected exceeds Cody’s current capacity" which isn't true because the same thing is possible in chat.

We should use MAX_CURRENT_FILE_TOKENS for the current selection instead of limiting it to a quarter of it, because surrounding code is not as important if users cannot use the command in the first place.

We can limit the context to include the quarter rule instead.

Test plan

  • Start Cody from this branch
  • Select line 198 to 234 and run the /edit command, you can use this instruction for testing correct any typos

Before

you will get an error from Cody say The amount of text selected exceeds Cody's current capacity.

image

After

Cody fixed all typos it found

image

@abeatrix abeatrix requested a review from a team September 21, 2023 19:48
Copy link
Contributor

@arafatkatze arafatkatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the PR and it makes more sense to have the token limit to 1000 versus 500 in the current case. Not to get too nitpicky, but if you were to go very literal about variable definition, the purpose of MAX_CURRENT_FILE_TOKENS is to highlight the maximum tokens that can come from the current file, which would still be more than this because after using this you're gonna add the prefix and the suffix AFTER this selection.

Perhaps can have a new variable which is MAX_CURRENT_FILE_SELECTION_TOKENS with the value of 1000 but this is cool too.

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCHMART

@abeatrix abeatrix merged commit 4ced9fa into main Sep 22, 2023
12 checks passed
@abeatrix abeatrix deleted the bee/fixup-token branch September 22, 2023 14:06
abeatrix added a commit that referenced this pull request Sep 22, 2023
This PR adds the missing Changelog items for [pull/1116
1139](#1116) &
#1139

Also fixed a minor oversight from pull/1116.

## Test plan

<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->

changelog update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants