mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-01 17:53:14 +00:00
fix: Caching and prompting fixes (#474)
This commit is contained in:
parent
1d7ddf22a5
commit
12a9d357a1
4 changed files with 15 additions and 15 deletions
|
|
@ -86,12 +86,10 @@ export async function generateAction(
|
|||
`MCP tools added to Planner: ${mcpTools.map((t) => t.name).join(", ")}`,
|
||||
);
|
||||
// Cache Breakpoint 1: Add cache_control marker to the last tool for tools definition caching
|
||||
if (tools.length > 0) {
|
||||
tools[tools.length - 1] = {
|
||||
...tools[tools.length - 1],
|
||||
cache_control: { type: "ephemeral" },
|
||||
} as any;
|
||||
}
|
||||
tools[tools.length - 1] = {
|
||||
...tools[tools.length - 1],
|
||||
cache_control: { type: "ephemeral" },
|
||||
} as any;
|
||||
|
||||
const modelWithTools = model.bindTools(tools, {
|
||||
tool_choice: "auto",
|
||||
|
|
|
|||
|
|
@ -137,14 +137,11 @@ export async function generateAction(
|
|||
logger.info(
|
||||
`MCP tools added to Programmer: ${mcpTools.map((t) => t.name).join(", ")}`,
|
||||
);
|
||||
|
||||
// Cache Breakpoint 1: Add cache_control marker to the last tool for tools definition caching
|
||||
if (tools.length > 0) {
|
||||
tools[tools.length - 1] = {
|
||||
...tools[tools.length - 1],
|
||||
cache_control: { type: "ephemeral" },
|
||||
} as any;
|
||||
}
|
||||
tools[tools.length - 1] = {
|
||||
...tools[tools.length - 1],
|
||||
cache_control: { type: "ephemeral" },
|
||||
} as any;
|
||||
|
||||
const modelWithTools = model.bindTools(tools, {
|
||||
tool_choice: "auto",
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ export async function generateReviewActions(
|
|||
createShellTool(state),
|
||||
createInstallDependenciesTool(state),
|
||||
];
|
||||
tools[tools.length - 1] = {
|
||||
...tools[tools.length - 1],
|
||||
cache_control: { type: "ephemeral" },
|
||||
} as any;
|
||||
|
||||
const modelWithTools = model.bindTools(tools, {
|
||||
tool_choice: "auto",
|
||||
...(modelSupportsParallelToolCallsParam
|
||||
|
|
|
|||
|
|
@ -89,10 +89,10 @@ export function formatUserRequestPrompt(
|
|||
const userFollowupRequest = getRecentUserRequest(messages);
|
||||
|
||||
if (userFollowupRequest) {
|
||||
return singleRequestPrompt
|
||||
return followupRequestPrompt
|
||||
.replace("{USER_REQUEST}", userRequest)
|
||||
.replace("{USER_FOLLOWUP_REQUEST}", userFollowupRequest);
|
||||
}
|
||||
|
||||
return followupRequestPrompt.replace("{USER_REQUEST}", userRequest);
|
||||
return singleRequestPrompt.replace("{USER_REQUEST}", userRequest);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue