@genkit-ai/anthropic
Version:
Genkit AI framework plugin for Anthropic APIs.
36 lines • 1.08 kB
JavaScript
import { convertDocumentSource, createDocumentBlock } from "./shared.mjs";
function betaServerToolUseBlockToPart(block) {
const baseName = block.name ?? "unknown_tool";
const serverToolName = block.server_name ? `${block.server_name}/${baseName}` : baseName;
return {
text: `[Anthropic server tool ${serverToolName}] input: ${JSON.stringify(block.input)}`,
metadata: {
anthropicServerToolUse: {
id: block.id,
name: serverToolName,
input: block.input
}
}
};
}
function unsupportedServerToolError(blockType) {
return `Anthropic beta runner does not yet support server-managed tool block '${blockType}'. Please retry against the stable API or wait for dedicated support.`;
}
function toBetaDocumentBlock(options) {
return createDocumentBlock(
options,
(source) => convertDocumentSource(
source,
(fileId) => ({
type: "file",
file_id: fileId
})
)
);
}
export {
betaServerToolUseBlockToPart,
toBetaDocumentBlock,
unsupportedServerToolError
};
//# sourceMappingURL=beta.mjs.map