This commit is contained in:
LukeParkerDev
2026-04-24 08:23:18 +10:00
parent 7266b48ca0
commit 4f8ff6ab53
3 changed files with 20 additions and 6 deletions
+7 -5
View File
@@ -207,11 +207,7 @@ const live: Layer.Layer<
input.model.providerID.toLowerCase().includes("litellm") ||
input.model.api.id.toLowerCase().includes("litellm")
const repair = (toolName: string) => {
const next = toolName.toLowerCase()
if (!tools[next]) return
return next
}
const repair = (toolName: string) => repairToolName(toolName, tools)
// LiteLLM/Bedrock rejects requests where the message history contains tool
// calls but no tools param is present. When there are no active tools (e.g.
@@ -449,6 +445,12 @@ export const defaultLayer = Layer.suspend(() =>
),
)
export function repairToolName(toolName: string, tools: Record<string, Tool>) {
const next = ShellToolID.normalize(toolName.toLowerCase())
if (!tools[next]) return
return next
}
function resolveTools(input: Pick<StreamInput, "tools" | "agent" | "permission" | "user">) {
const disabled = Permission.disabled(
Object.keys(input.tools),