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(inline-completion): potential inline completion failure due to input validation exception of supplemental context #5466

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Will-ShaoHua
Copy link
Contributor

@Will-ShaoHua Will-ShaoHua commented Mar 11, 2025

Description

ERROR: at 'supplementalContexts' failed to satisfy constraint: Member must have length less than or equal to 5

ERROR: supplementalContexts.1.member.content' failed to satisfy constraint: Member must have length less than or equal to 10240

VSCode PR aws/aws-toolkit-vscode#6758

* Requirement
 * - Maximum 5 supplemental context.
 * - Each chunk can't exceed 10240 characters
 * - Sum of all chunks can't exceed 20480 characters

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Will-ShaoHua Will-ShaoHua requested a review from a team as a code owner March 11, 2025 08:30
@Will-ShaoHua Will-ShaoHua changed the title fix potential inline completion failure due to input validation excep… fix(inline-completion): potential inline completion failure due to input validation exception of supplemental context Mar 11, 2025
@Will-ShaoHua Will-ShaoHua requested a review from a team as a code owner March 11, 2025 10:46
@Will-ShaoHua Will-ShaoHua marked this pull request as draft March 11, 2025 10:50
fun truncateContext(context: SupplementalContextInfo): SupplementalContextInfo {
var c = context.contents
while (c.sumOf { it.content.length } >= CodeWhispererConstants.CrossFile.MAX_TOTAL_LENGTH) {
var c = context.contents.map {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be done on the service side?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nah they don't have the plan

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.

2 participants