Skip to content

Limit the length of the suffix by x%

Alexander Chueshev requested to merge ac-limit-suffix into main

According to the Google Doc,

For code completion, suffix represents the end of a piece of meaningful programming code. The model attempts to fill in the code in between the prefix and suffix.

We can consider this MR as the first iteration of #168 (closed). However, even with a smarter version of suffix truncation, we still need to limit the overall size of the suffix due to the unpredictable size of the context block where the cursor is positioned. More details here - #168 (comment 1490125106)

Default configuration:

_MAX_TOKENS_IMPORTS_PERCENT = 0.12  # about 245 tokens for code-gecko
_MAX_TOKENS_SUFFIX_PERCENT = 0.7  # about 126 tokens for code-gecko, if "imports" takes up all the available space

Closes #234 (closed)

Edited by Alexander Chueshev

Merge request reports