@dxos/assistant 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/extraction/index.mjs +225 -0
- package/dist/lib/browser/extraction/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1114 -1843
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/extraction/index.mjs +226 -0
- package/dist/lib/node-esm/extraction/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1114 -1844
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/conversation/context.d.ts +103 -0
- package/dist/types/src/conversation/context.d.ts.map +1 -0
- package/dist/types/src/conversation/conversation.d.ts +29 -32
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/conversation/index.d.ts +1 -0
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/diff.d.ts +15 -0
- package/dist/types/src/diff.d.ts.map +1 -0
- package/dist/types/src/diff.test.d.ts +2 -0
- package/dist/types/src/diff.test.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +71 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/execution-graph.d.ts +85 -0
- package/dist/types/src/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph.test.d.ts +2 -0
- package/dist/types/src/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +1 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +195 -58
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts +1 -1
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +264 -165
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts +1 -1
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +2 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/services.d.ts +20 -0
- package/dist/types/src/functions/services.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/GenericToolkit.d.ts +84 -0
- package/dist/types/src/session/GenericToolkit.d.ts.map +1 -0
- package/dist/types/src/session/artifact-diff.d.ts +27 -0
- package/dist/types/src/session/artifact-diff.d.ts.map +1 -0
- package/dist/types/src/session/error-handling.d.ts +4 -0
- package/dist/types/src/session/error-handling.d.ts.map +1 -0
- package/dist/types/src/session/format.d.ts +12 -0
- package/dist/types/src/session/format.d.ts.map +1 -0
- package/dist/types/src/session/format.test.d.ts +2 -0
- package/dist/types/src/session/format.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +4 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +22 -0
- package/dist/types/src/session/observer.d.ts.map +1 -0
- package/dist/types/src/session/session.d.ts +36 -268
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +15 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.d.ts +5 -5
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +2 -0
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/templates/system.d.ts +18 -0
- package/dist/types/src/templates/system.d.ts.map +1 -0
- package/dist/types/src/types/artifact.d.ts +20 -0
- package/dist/types/src/types/artifact.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -26
- package/src/conversation/context.ts +186 -0
- package/src/conversation/conversation.ts +101 -76
- package/src/conversation/index.ts +1 -0
- package/src/diff.test.ts +43 -0
- package/src/diff.ts +84 -0
- package/src/errors.ts +15 -0
- package/src/execution-graph.test.ts +740 -0
- package/src/execution-graph.ts +509 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +14 -25
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +48 -52
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +18 -17
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +43 -41
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +12 -6
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +3 -1
- package/src/extraction/extraction.ts +7 -6
- package/src/extraction/quotes.test.ts +3 -3
- package/src/extraction/quotes.ts +4 -4
- package/src/functions/index.ts +5 -0
- package/src/functions/services.ts +162 -0
- package/src/index.ts +5 -5
- package/src/session/GenericToolkit.ts +130 -0
- package/src/session/artifact-diff.ts +41 -0
- package/src/session/error-handling.ts +41 -0
- package/src/session/format.test.ts +61 -0
- package/src/session/format.ts +144 -0
- package/src/session/index.ts +5 -0
- package/src/session/observer.ts +59 -0
- package/src/session/session.conversations.json +1 -0
- package/src/session/session.test.ts +88 -214
- package/src/session/session.ts +170 -539
- package/src/session/toolkit.ts +48 -0
- package/src/session/version-pin.ts +11 -12
- package/src/templates/index.ts +5 -0
- package/src/templates/instructions/format.tpl +61 -0
- package/src/templates/instructions/system.tpl +48 -0
- package/src/templates/system.ts +41 -0
- package/src/types/artifact.ts +71 -0
- package/src/types/index.ts +5 -0
- package/src/typings.d.ts +5 -0
- package/dist/types/bin/chat.d.ts +0 -2
- package/dist/types/bin/chat.d.ts.map +0 -1
- package/dist/types/src/blueprint/blueprint.d.ts +0 -41
- package/dist/types/src/blueprint/blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprint/index.d.ts +0 -3
- package/dist/types/src/blueprint/index.d.ts.map +0 -1
- package/dist/types/src/blueprint/registry.d.ts +0 -7
- package/dist/types/src/blueprint/registry.d.ts.map +0 -1
- package/dist/types/src/context/binder.d.ts +0 -34
- package/dist/types/src/context/binder.d.ts.map +0 -1
- package/dist/types/src/context/binding.d.ts +0 -38
- package/dist/types/src/context/binding.d.ts.map +0 -1
- package/dist/types/src/context/index.d.ts +0 -3
- package/dist/types/src/context/index.d.ts.map +0 -1
- package/dist/types/src/research/exa.d.ts +0 -7
- package/dist/types/src/research/exa.d.ts.map +0 -1
- package/dist/types/src/research/graph.d.ts +0 -41
- package/dist/types/src/research/graph.d.ts.map +0 -1
- package/dist/types/src/research/graph.test.d.ts +0 -2
- package/dist/types/src/research/graph.test.d.ts.map +0 -1
- package/dist/types/src/research/index.d.ts +0 -4
- package/dist/types/src/research/index.d.ts.map +0 -1
- package/dist/types/src/research/research.d.ts +0 -10
- package/dist/types/src/research/research.d.ts.map +0 -1
- package/dist/types/src/research/research.test.d.ts +0 -2
- package/dist/types/src/research/research.test.d.ts.map +0 -1
- package/dist/types/src/session/version-pin.test.d.ts +0 -2
- package/dist/types/src/session/version-pin.test.d.ts.map +0 -1
- package/dist/types/src/summarization/summarization.test.d.ts +0 -2
- package/dist/types/src/summarization/summarization.test.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337321991.d.ts +0 -38
- package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337331526.d.ts +0 -37
- package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337344119.d.ts +0 -58
- package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -3
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/blueprint/blueprint.ts +0 -75
- package/src/blueprint/index.ts +0 -6
- package/src/blueprint/registry.ts +0 -15
- package/src/context/binder.ts +0 -101
- package/src/context/binding.ts +0 -31
- package/src/context/index.ts +0 -6
- package/src/research/exa.ts +0 -100
- package/src/research/graph.test.ts +0 -15
- package/src/research/graph.ts +0 -337
- package/src/research/index.ts +0 -7
- package/src/research/instructions-research.tpl +0 -97
- package/src/research/research.test.ts +0 -190
- package/src/research/research.ts +0 -90
- package/src/session/version-pin.test.ts +0 -26
- package/src/summarization/summarization.test.ts +0 -221
- package/src/testing/exa-search-1748337321991.ts +0 -131
- package/src/testing/exa-search-1748337331526.ts +0 -144
- package/src/testing/exa-search-1748337344119.ts +0 -133
- package/src/testing/index.ts +0 -11
- package/src/typedefs.d.ts +0 -8
- package/src/types.ts +0 -8
- /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
+
import { describe, it } from '@effect/vitest';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Layer from 'effect/Layer';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { AiService, MemoizedAiService, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
13
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
14
|
+
import { Obj, Type } from '@dxos/echo';
|
|
15
|
+
import { TestHelpers } from '@dxos/effect';
|
|
16
|
+
import { TracingService } from '@dxos/functions';
|
|
14
17
|
import { log } from '@dxos/log';
|
|
15
18
|
|
|
16
|
-
import {
|
|
19
|
+
import { AiSession } from './session';
|
|
17
20
|
|
|
18
21
|
// Define a calendar event artifact schema.
|
|
19
22
|
const CalendarEventSchema = Schema.Struct({
|
|
@@ -30,178 +33,89 @@ const CalendarEventSchema = Schema.Struct({
|
|
|
30
33
|
|
|
31
34
|
type CalendarEvent = Schema.Schema.Type<typeof CalendarEventSchema>;
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// });
|
|
40
|
-
const session = new AISession({ operationModel: 'configured' });
|
|
41
|
-
|
|
42
|
-
const printer = new ConsolePrinter();
|
|
43
|
-
session.message.on((message) => printer.printMessage(message));
|
|
44
|
-
session.userMessage.on((message) => printer.printMessage(message));
|
|
45
|
-
session.block.on((block) => printer.printContentBlock(block));
|
|
46
|
-
|
|
47
|
-
// session.update.on((update) => {
|
|
48
|
-
// log('update', { update });
|
|
49
|
-
// });
|
|
50
|
-
|
|
51
|
-
const calculatorTool = createTool('test', {
|
|
52
|
-
name: 'calculator',
|
|
53
|
-
description: 'Adds to numbers',
|
|
54
|
-
schema: Schema.Struct({
|
|
55
|
-
operand1: Schema.Number,
|
|
56
|
-
operand2: Schema.Number,
|
|
36
|
+
const TestToolkit = Toolkit.make(
|
|
37
|
+
Tool.make('Calculator', {
|
|
38
|
+
description: 'Basic calculator tool',
|
|
39
|
+
parameters: {
|
|
40
|
+
input: Schema.String.annotations({
|
|
41
|
+
description: 'The calculation to perform.',
|
|
57
42
|
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
client: aiClient,
|
|
66
|
-
tools: [calculatorTool.id],
|
|
67
|
-
artifacts: [],
|
|
68
|
-
requiredArtifactIds: [],
|
|
69
|
-
history: [],
|
|
70
|
-
generationOptions: {
|
|
71
|
-
model: '@anthropic/claude-3-5-haiku-20241022',
|
|
72
|
-
},
|
|
73
|
-
prompt: 'What is 10 + 20?',
|
|
74
|
-
toolResolver: new ToolRegistry([calculatorTool]),
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
log('result', { response });
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('create calendar itinerary', { timeout: 60_000 }, async () => {
|
|
81
|
-
const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.REMOTE });
|
|
82
|
-
// const aiClient = new OllamaAiServiceClient({
|
|
83
|
-
// overrides: { model: 'llama3.1:8b' },
|
|
84
|
-
// });
|
|
85
|
-
const session = new AISession({ operationModel: 'configured' });
|
|
86
|
-
|
|
87
|
-
const objects = new Set<string>();
|
|
88
|
-
|
|
89
|
-
// Define calendar artifact.
|
|
90
|
-
const calendarArtifact = defineArtifact({
|
|
91
|
-
id: 'artifact:dxos.org/plugin/calendar',
|
|
92
|
-
name: 'Calendar',
|
|
93
|
-
instructions: 'Use this to create and query calendar events.',
|
|
94
|
-
schema: CalendarEventSchema,
|
|
95
|
-
tools: [
|
|
96
|
-
createTool('calendar', {
|
|
97
|
-
name: 'query',
|
|
98
|
-
description: 'Query the calendar for events',
|
|
99
|
-
schema: Schema.Struct({}),
|
|
100
|
-
execute: async () => {
|
|
101
|
-
return ToolResult.Success(CALENDAR_EVENTS);
|
|
102
|
-
},
|
|
103
|
-
}),
|
|
104
|
-
],
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const tableArtifact = defineArtifact({
|
|
108
|
-
id: 'artifact:dxos.org/plugin/table',
|
|
109
|
-
name: 'Table',
|
|
110
|
-
instructions: 'Use this to create and manage tables. Each table has a unique id.',
|
|
111
|
-
schema: Schema.Struct({}),
|
|
112
|
-
tools: [
|
|
113
|
-
createTool('table', {
|
|
114
|
-
name: 'create',
|
|
115
|
-
description: 'Create a table',
|
|
116
|
-
schema: Schema.Struct({
|
|
117
|
-
data: Schema.Array(Schema.Any).annotations({ description: 'Array of data payloads to add as rows' }),
|
|
118
|
-
}),
|
|
119
|
-
execute: async ({ data }) => {
|
|
120
|
-
log('create table', { data });
|
|
121
|
-
const id = DXN.fromLocalObjectId(ObjectId.random()).toString();
|
|
122
|
-
objects.add(id);
|
|
123
|
-
// TODO(dmaretskyi): consider xml for refs instead of @dxn:echo:@:XXXXX
|
|
124
|
-
return ToolResult.Success(`table @${id}`);
|
|
125
|
-
},
|
|
126
|
-
}),
|
|
127
|
-
],
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
const mapArtifact = defineArtifact({
|
|
131
|
-
id: 'artifact:dxos.org/plugin/map',
|
|
132
|
-
name: 'Map',
|
|
133
|
-
instructions:
|
|
134
|
-
'Use this to create and manage maps. Maps source data from tables. Table id is required to create a map.',
|
|
135
|
-
schema: Schema.Struct({}),
|
|
136
|
-
tools: [
|
|
137
|
-
createTool('map', {
|
|
138
|
-
name: 'create',
|
|
139
|
-
description: 'Create a map',
|
|
140
|
-
schema: Schema.Struct({
|
|
141
|
-
source: ArtifactId.annotations({
|
|
142
|
-
description: 'The table that will be used as the source of the map',
|
|
143
|
-
}),
|
|
144
|
-
}),
|
|
145
|
-
execute: async ({ source }) => {
|
|
146
|
-
// TODO(dmaretskyi): Use effect-schema decode instead of manual parsing.
|
|
147
|
-
const sourceId = ArtifactId.toDXN(source);
|
|
148
|
-
if (!objects.has(sourceId.toString())) {
|
|
149
|
-
return ToolResult.Error(`table id=${source} not found`);
|
|
150
|
-
}
|
|
151
|
-
log('create map', { sourceId });
|
|
152
|
-
const id = DXN.fromLocalObjectId(ObjectId.random()).toString();
|
|
153
|
-
objects.add(id);
|
|
154
|
-
// TODO(dmaretskyi): consider xml for refs instead of @dxn:echo:@:XXXXX
|
|
155
|
-
return ToolResult.Success(`map @${id}`);
|
|
156
|
-
},
|
|
157
|
-
}),
|
|
158
|
-
],
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
const scriptArtifact = defineArtifact({
|
|
162
|
-
id: 'artifact:dxos.org/plugin/script',
|
|
163
|
-
name: 'Script',
|
|
164
|
-
instructions: 'Use this to create and manage scripts',
|
|
165
|
-
schema: Schema.Struct({}),
|
|
166
|
-
tools: [],
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// session.streamEvent.on((event) => {
|
|
170
|
-
// printStreamEvent(event);
|
|
171
|
-
// });
|
|
43
|
+
},
|
|
44
|
+
success: Schema.Struct({
|
|
45
|
+
result: Schema.Number,
|
|
46
|
+
}),
|
|
47
|
+
failure: Schema.Never,
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
172
50
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
51
|
+
// Tool handlers.
|
|
52
|
+
const toolkitLayer = TestToolkit.toLayer({
|
|
53
|
+
Calculator: ({ input }) =>
|
|
54
|
+
Effect.gen(function* () {
|
|
55
|
+
const result = (() => {
|
|
56
|
+
// Restrict to basic arithmetic operations for safety.
|
|
57
|
+
const sanitizedInput = input.replace(/[^0-9+\-*/().\s]/g, '');
|
|
58
|
+
log.info('calculate', { sanitizedInput });
|
|
59
|
+
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
61
|
+
return Function(`"use strict"; return (${sanitizedInput})`)();
|
|
62
|
+
})();
|
|
63
|
+
|
|
64
|
+
return { result };
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
177
67
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
68
|
+
const TestLayer = Layer.mergeAll(
|
|
69
|
+
toolkitLayer,
|
|
70
|
+
AiService.model('@anthropic/claude-3-5-sonnet-20241022'),
|
|
71
|
+
TracingService.layerNoop,
|
|
72
|
+
ToolResolverService.layerEmpty,
|
|
73
|
+
ToolExecutionService.layerEmpty,
|
|
74
|
+
).pipe(
|
|
75
|
+
//
|
|
76
|
+
Layer.provideMerge(MemoizedAiService.layerTest()),
|
|
77
|
+
Layer.provide(AiServiceTestingPreset('direct')),
|
|
78
|
+
);
|
|
181
79
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
80
|
+
describe('AiSession', () => {
|
|
81
|
+
it.effect(
|
|
82
|
+
'no tools',
|
|
83
|
+
Effect.fnUntraced(
|
|
84
|
+
function* (_) {
|
|
85
|
+
const session = new AiSession({ operationModel: 'configured' });
|
|
86
|
+
const response = yield* session.run({
|
|
87
|
+
prompt: 'Hello world!',
|
|
88
|
+
history: [],
|
|
89
|
+
});
|
|
90
|
+
log.info('response', { response });
|
|
191
91
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
92
|
+
Effect.provide(TestLayer),
|
|
93
|
+
TestHelpers.provideTestContext,
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
it.effect(
|
|
98
|
+
'calculator',
|
|
99
|
+
Effect.fnUntraced(
|
|
100
|
+
function* (_) {
|
|
101
|
+
const session = new AiSession({ operationModel: 'configured' });
|
|
102
|
+
const toolkit = yield* TestToolkit;
|
|
103
|
+
const response = yield* session.run({
|
|
104
|
+
toolkit,
|
|
105
|
+
prompt: 'What is 10 + 30?',
|
|
106
|
+
history: [],
|
|
107
|
+
});
|
|
108
|
+
log.info('response', { response });
|
|
109
|
+
},
|
|
110
|
+
Effect.provide(TestLayer),
|
|
111
|
+
TestHelpers.provideTestContext,
|
|
112
|
+
),
|
|
113
|
+
);
|
|
201
114
|
});
|
|
202
115
|
|
|
203
116
|
// Travel to rome, florence, livorno, siena, madrid for conferences
|
|
204
|
-
|
|
117
|
+
|
|
118
|
+
const _CALENDAR_EVENTS: CalendarEvent[] = [
|
|
205
119
|
Obj.make(CalendarEventSchema, {
|
|
206
120
|
title: 'Exploring Ancient Ruins in Rome',
|
|
207
121
|
startTime: '2024-01-01T10:00:00Z',
|
|
@@ -233,43 +147,3 @@ const CALENDAR_EVENTS: CalendarEvent[] = [
|
|
|
233
147
|
description: 'Travel to Madrid',
|
|
234
148
|
}),
|
|
235
149
|
];
|
|
236
|
-
|
|
237
|
-
// const printStreamEvent = (event: GenerationStreamEvent) => {
|
|
238
|
-
// switch (event.type) {
|
|
239
|
-
// case 'message_start': {
|
|
240
|
-
// process.stdout.write(`${event.message.role.toUpperCase()}\n\n`);
|
|
241
|
-
// for (const content of event.message.content) {
|
|
242
|
-
// printContentBlock(content);
|
|
243
|
-
// }
|
|
244
|
-
// break;
|
|
245
|
-
// }
|
|
246
|
-
// case 'content_block_start': {
|
|
247
|
-
// printContentBlock(event.content);
|
|
248
|
-
// break;
|
|
249
|
-
// }
|
|
250
|
-
// case 'content_block_delta': {
|
|
251
|
-
// switch (event.delta.type) {
|
|
252
|
-
// case 'text_delta': {
|
|
253
|
-
// process.stdout.write(event.delta.text);
|
|
254
|
-
// break;
|
|
255
|
-
// }
|
|
256
|
-
// case 'input_json_delta': {
|
|
257
|
-
// process.stdout.write(event.delta.partial_json);
|
|
258
|
-
// break;
|
|
259
|
-
// }
|
|
260
|
-
// }
|
|
261
|
-
// break;
|
|
262
|
-
// }
|
|
263
|
-
// case 'content_block_stop': {
|
|
264
|
-
// process.stdout.write('\n');
|
|
265
|
-
// break;
|
|
266
|
-
// }
|
|
267
|
-
// case 'message_delta': {
|
|
268
|
-
// break;
|
|
269
|
-
// }
|
|
270
|
-
// case 'message_stop': {
|
|
271
|
-
// process.stdout.write('\n\n');
|
|
272
|
-
// break;
|
|
273
|
-
// }
|
|
274
|
-
// }
|
|
275
|
-
// };
|