@genkit-ai/anthropic
Version:
Genkit AI framework plugin for Anthropic APIs.
33 lines • 736 B
JavaScript
function cacheControl(options) {
return {
cache_control: {
type: options?.type ?? "ephemeral",
...options?.ttl && { ttl: options.ttl }
}
};
}
function checkModelName(name) {
const cleanName = name?.replace(/^anthropic\//, "");
if (!cleanName) {
throw new Error("Model name is required.");
}
return cleanName;
}
function removeUndefinedProperties(obj) {
if (typeof obj !== "object" || obj === null) {
return obj;
}
return Object.fromEntries(
Object.entries(obj).filter(([_, value]) => value !== void 0)
);
}
function isKnownKey(key, obj) {
return key in obj;
}
export {
cacheControl,
checkModelName,
isKnownKey,
removeUndefinedProperties
};
//# sourceMappingURL=utils.mjs.map