hint back to llm when tool does not exist
This commit is contained in:
parent
6ed774ef62
commit
857a3cd522
1 changed files with 7 additions and 11 deletions
|
|
@ -13,7 +13,6 @@ import {
|
||||||
type ModelMessage,
|
type ModelMessage,
|
||||||
stepCountIs,
|
stepCountIs,
|
||||||
type StreamTextResult,
|
type StreamTextResult,
|
||||||
InvalidToolInputError,
|
|
||||||
} from "ai"
|
} from "ai"
|
||||||
|
|
||||||
import PROMPT_INITIALIZE from "../session/prompt/initialize.txt"
|
import PROMPT_INITIALIZE from "../session/prompt/initialize.txt"
|
||||||
|
|
@ -874,17 +873,14 @@ export namespace Session {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async experimental_repairToolCall(input) {
|
async experimental_repairToolCall(input) {
|
||||||
if (InvalidToolInputError.isInstance(input.error)) {
|
return {
|
||||||
return {
|
...input.toolCall,
|
||||||
...input.toolCall,
|
input: JSON.stringify({
|
||||||
input: JSON.stringify({
|
tool: input.toolCall.toolName,
|
||||||
tool: input.toolCall.toolName,
|
error: input.error.message,
|
||||||
error: input.error.message,
|
}),
|
||||||
}),
|
toolName: "invalid",
|
||||||
toolName: "invalid",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null
|
|
||||||
},
|
},
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
activeTools: Object.keys(tools).filter((x) => x !== "invalid"),
|
activeTools: Object.keys(tools).filter((x) => x !== "invalid"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue