@sema-agent/core
Version:
Stateless, task-oriented AI agent core
11 lines (10 loc) • 384 B
JavaScript
export const isTextBlock = (b) => {
const block = b;
return block?.type === "text" && typeof block.text === "string";
};
export const renderContentBlock = (b) => {
if (isTextBlock(b))
return b.text;
const block = b;
return `[${typeof block?.type === "string" ? block.type : "block"}${typeof block?.mimeType === "string" ? `: ${block.mimeType}` : ""}]`;
};