openclaw / src /agents /test-helpers /sparse-transcript.test-support.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
e249c6d verified
Raw History Blame Contribute Delete
738 Bytes
export function sparseAssistant(content: unknown[]) {
return { role: "assistant" as const, content };
}
export function textToolResult(
toolCallId: string,
toolName: string,
text: string,
fields?: { isError?: boolean },
) {
return {
role: "toolResult" as const,
toolCallId,
toolName,
content: [{ type: "text" as const, text }],
...fields,
};
}
export function textAssistant(text: string): {
role: "assistant";
content: { type: "text"; text: string }[];
} {
return { role: "assistant", content: [{ type: "text", text }] };
}
export function timestampedTextAssistant(text: string, timestamp: number) {
return {
role: "assistant",
content: [{ type: "text", text }],
timestamp,
};
}