@langchain/anthropic
Version:
Anthropic integrations for LangChain.js
25 lines (24 loc) • 479 B
JavaScript
export function handleToolChoice(toolChoice) {
if (!toolChoice) {
return undefined;
}
else if (toolChoice === "any") {
return {
type: "any",
};
}
else if (toolChoice === "auto") {
return {
type: "auto",
};
}
else if (typeof toolChoice === "string") {
return {
type: "tool",
name: toolChoice,
};
}
else {
return toolChoice;
}
}