-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Only send environment details in last user message #3101
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
base: main
Are you sure you want to change the base?
Conversation
|
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
case "claude-3-opus-20240229": | ||
case "claude-3-haiku-20240307": | ||
betas.push("prompt-caching-2024-07-31") | ||
return { headers: { "anthropic-beta": betas.join(",") } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't in beta anymore; we don't need the header.
})(), | ||
) | ||
system = [{ text: systemPrompt, type: "text", cache_control: { type: "ephemeral" } }] | ||
addCacheBreakpoints(messages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call was changed from reassigning messages
(messages = addCacheBreakpoints(messages)
) to just calling addCacheBreakpoints(messages)
, which now mutates the array in place. Ensure that downstream code expects in-place modification rather than a new array, and consider documenting this side-effect.
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Context
Inspired by #3082, I decided to try a different variation of environment details de-duplication. I confirmed that it doesn't present cache issues:
I'm not sure if there are other implications from the removing all of the redundant environment details blocks, so we'll have to verify that this is okay.
Important
Environment details are now appended only to the last user message in
Cline.ts
, with updates to message processing and tests.Cline.ts
.processMessages()
inCline.ts
updated to append environment details to the last user message.addCacheBreakpoints()
inanthropic.ts
modified to handle cache control for user messages.attemptApiRequest()
inCline.ts
now takesenvironmentDetails
as a parameter.getEnvironmentDetails()
inCline.ts
is called before API requests to fetch environment details.Cline.test.ts
to mockgetEnvironmentDetails()
and test message processing logic.This description was created by
for 9174970. You can customize this summary. It will automatically update as commits are pushed.