MCPcopy Create free account
hub / github.com/cortexkit/magic-context / assistantMessage

Function assistantMessage

packages/pi-plugin/src/test-utils.test.ts:29–52  ·  view source on GitHub ↗
(
	text: string,
	timestamp = 2,
	extra: Partial<Record<string, unknown>> = {},
)

Source from the content-addressed store, hash-verified

27}
28
29export function assistantMessage(
30 text: string,
31 timestamp = 2,
32 extra: Partial<Record<string, unknown>> = {},
33): PiMessage {
34 return {
35 role: "assistant",
36 content: [{ type: "text", text }],
37 api: "test-api",
38 provider: "test-provider",
39 model: "test-model",
40 usage: {
41 input: 0,
42 output: 0,
43 cacheRead: 0,
44 cacheWrite: 0,
45 totalTokens: 0,
46 cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
47 },
48 stopReason: "stop",
49 timestamp,
50 ...extra,
51 } as PiMessage;
52}
53
54export function assistantToolCall(
55 id: string,

Calls

no outgoing calls

Tested by

no test coverage detected