@librechat/agents 2.4.30 → 2.4.33
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/cjs/common/enum.cjs +1 -0
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/events.cjs +3 -3
- package/dist/cjs/events.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +2 -1
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/main.cjs +7 -2
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/messages/ids.cjs +23 -0
- package/dist/cjs/messages/ids.cjs.map +1 -0
- package/dist/cjs/splitStream.cjs +2 -1
- package/dist/cjs/splitStream.cjs.map +1 -1
- package/dist/cjs/stream.cjs +87 -154
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +14 -3
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/handlers.cjs +144 -0
- package/dist/cjs/tools/handlers.cjs.map +1 -0
- package/dist/cjs/tools/search/content.cjs +140 -0
- package/dist/cjs/tools/search/content.cjs.map +1 -0
- package/dist/cjs/tools/search/firecrawl.cjs +131 -0
- package/dist/cjs/tools/search/firecrawl.cjs.map +1 -0
- package/dist/cjs/tools/search/format.cjs +203 -0
- package/dist/cjs/tools/search/format.cjs.map +1 -0
- package/dist/cjs/tools/search/highlights.cjs +245 -0
- package/dist/cjs/tools/search/highlights.cjs.map +1 -0
- package/dist/cjs/tools/search/rerankers.cjs +194 -0
- package/dist/cjs/tools/search/rerankers.cjs.map +1 -0
- package/dist/cjs/tools/search/schema.cjs +70 -0
- package/dist/cjs/tools/search/schema.cjs.map +1 -0
- package/dist/cjs/tools/search/search.cjs +491 -0
- package/dist/cjs/tools/search/search.cjs.map +1 -0
- package/dist/cjs/tools/search/tool.cjs +292 -0
- package/dist/cjs/tools/search/tool.cjs.map +1 -0
- package/dist/cjs/tools/search/utils.cjs +66 -0
- package/dist/cjs/tools/search/utils.cjs.map +1 -0
- package/dist/esm/common/enum.mjs +1 -0
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/events.mjs +1 -1
- package/dist/esm/events.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +2 -1
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/main.mjs +4 -1
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/messages/ids.mjs +21 -0
- package/dist/esm/messages/ids.mjs.map +1 -0
- package/dist/esm/splitStream.mjs +2 -1
- package/dist/esm/splitStream.mjs.map +1 -1
- package/dist/esm/stream.mjs +87 -152
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +14 -3
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/handlers.mjs +141 -0
- package/dist/esm/tools/handlers.mjs.map +1 -0
- package/dist/esm/tools/search/content.mjs +119 -0
- package/dist/esm/tools/search/content.mjs.map +1 -0
- package/dist/esm/tools/search/firecrawl.mjs +128 -0
- package/dist/esm/tools/search/firecrawl.mjs.map +1 -0
- package/dist/esm/tools/search/format.mjs +201 -0
- package/dist/esm/tools/search/format.mjs.map +1 -0
- package/dist/esm/tools/search/highlights.mjs +243 -0
- package/dist/esm/tools/search/highlights.mjs.map +1 -0
- package/dist/esm/tools/search/rerankers.mjs +188 -0
- package/dist/esm/tools/search/rerankers.mjs.map +1 -0
- package/dist/esm/tools/search/schema.mjs +61 -0
- package/dist/esm/tools/search/schema.mjs.map +1 -0
- package/dist/esm/tools/search/search.mjs +488 -0
- package/dist/esm/tools/search/search.mjs.map +1 -0
- package/dist/esm/tools/search/tool.mjs +290 -0
- package/dist/esm/tools/search/tool.mjs.map +1 -0
- package/dist/esm/tools/search/utils.mjs +61 -0
- package/dist/esm/tools/search/utils.mjs.map +1 -0
- package/dist/types/common/enum.d.ts +1 -0
- package/dist/types/graphs/Graph.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/messages/ids.d.ts +3 -0
- package/dist/types/messages/index.d.ts +1 -0
- package/dist/types/scripts/search.d.ts +1 -0
- package/dist/types/stream.d.ts +0 -8
- package/dist/types/tools/ToolNode.d.ts +6 -0
- package/dist/types/tools/example.d.ts +23 -3
- package/dist/types/tools/handlers.d.ts +8 -0
- package/dist/types/tools/search/content.d.ts +4 -0
- package/dist/types/tools/search/firecrawl.d.ts +38 -0
- package/dist/types/tools/search/format.d.ts +5 -0
- package/dist/types/tools/search/highlights.d.ts +13 -0
- package/dist/types/tools/search/index.d.ts +2 -0
- package/dist/types/tools/search/rerankers.d.ts +36 -0
- package/dist/types/tools/search/schema.d.ts +16 -0
- package/dist/types/tools/search/search.d.ts +9 -0
- package/dist/types/tools/search/test.d.ts +1 -0
- package/dist/types/tools/search/tool.d.ts +33 -0
- package/dist/types/tools/search/types.d.ts +540 -0
- package/dist/types/tools/search/utils.d.ts +10 -0
- package/package.json +10 -7
- package/src/common/enum.ts +1 -0
- package/src/events.ts +49 -15
- package/src/graphs/Graph.ts +6 -2
- package/src/index.ts +2 -0
- package/src/messages/ids.ts +26 -0
- package/src/messages/index.ts +1 -0
- package/src/scripts/search.ts +146 -0
- package/src/splitStream.test.ts +132 -71
- package/src/splitStream.ts +2 -1
- package/src/stream.ts +94 -183
- package/src/tools/ToolNode.ts +37 -14
- package/src/tools/handlers.ts +167 -0
- package/src/tools/search/content.test.ts +173 -0
- package/src/tools/search/content.ts +147 -0
- package/src/tools/search/firecrawl.ts +158 -0
- package/src/tools/search/format.ts +252 -0
- package/src/tools/search/highlights.ts +320 -0
- package/src/tools/search/index.ts +2 -0
- package/src/tools/search/output.md +2775 -0
- package/src/tools/search/rerankers.ts +269 -0
- package/src/tools/search/schema.ts +63 -0
- package/src/tools/search/search.ts +680 -0
- package/src/tools/search/test.html +884 -0
- package/src/tools/search/test.md +643 -0
- package/src/tools/search/test.ts +159 -0
- package/src/tools/search/tool.ts +427 -0
- package/src/tools/search/types.ts +621 -0
- package/src/tools/search/utils.ts +79 -0
- package/src/utils/llmConfig.ts +1 -1
package/src/events.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
// src/events.ts
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
UsageMetadata,
|
|
5
|
+
BaseMessageFields,
|
|
6
|
+
} from '@langchain/core/messages';
|
|
4
7
|
import type { Graph } from '@/graphs';
|
|
5
8
|
import type * as t from '@/types';
|
|
6
|
-
import { handleToolCalls } from '@/
|
|
9
|
+
import { handleToolCalls } from '@/tools/handlers';
|
|
7
10
|
import { Providers } from '@/common';
|
|
8
11
|
|
|
9
12
|
export class HandlerRegistry {
|
|
@@ -27,7 +30,12 @@ export class ModelEndHandler implements t.EventHandler {
|
|
|
27
30
|
this.collectedUsage = collectedUsage;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
handle(
|
|
33
|
+
handle(
|
|
34
|
+
event: string,
|
|
35
|
+
data: t.ModelEndData,
|
|
36
|
+
metadata?: Record<string, unknown>,
|
|
37
|
+
graph?: Graph
|
|
38
|
+
): void {
|
|
31
39
|
if (!graph || !metadata) {
|
|
32
40
|
console.warn(`Graph or metadata not found in ${event} event`);
|
|
33
41
|
return;
|
|
@@ -43,9 +51,12 @@ export class ModelEndHandler implements t.EventHandler {
|
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
console.log(`====== ${event.toUpperCase()} ======`);
|
|
46
|
-
console.dir(
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
console.dir(
|
|
55
|
+
{
|
|
56
|
+
usage,
|
|
57
|
+
},
|
|
58
|
+
{ depth: null }
|
|
59
|
+
);
|
|
49
60
|
|
|
50
61
|
if (metadata.provider !== Providers.GOOGLE) {
|
|
51
62
|
return;
|
|
@@ -60,7 +71,12 @@ export class ToolEndHandler implements t.EventHandler {
|
|
|
60
71
|
constructor(callback?: t.ToolEndCallback) {
|
|
61
72
|
this.callback = callback;
|
|
62
73
|
}
|
|
63
|
-
handle(
|
|
74
|
+
handle(
|
|
75
|
+
event: string,
|
|
76
|
+
data: t.StreamEventData | undefined,
|
|
77
|
+
metadata?: Record<string, unknown>,
|
|
78
|
+
graph?: Graph
|
|
79
|
+
): void {
|
|
64
80
|
if (!graph || !metadata) {
|
|
65
81
|
console.warn(`Graph or metadata not found in ${event} event`);
|
|
66
82
|
return;
|
|
@@ -74,14 +90,17 @@ export class ToolEndHandler implements t.EventHandler {
|
|
|
74
90
|
|
|
75
91
|
this.callback?.(toolEndData, metadata);
|
|
76
92
|
|
|
77
|
-
graph.handleToolCallCompleted(
|
|
93
|
+
graph.handleToolCallCompleted(
|
|
94
|
+
{ input: toolEndData.input, output: toolEndData.output },
|
|
95
|
+
metadata
|
|
96
|
+
);
|
|
78
97
|
}
|
|
79
98
|
}
|
|
80
99
|
|
|
81
100
|
export class TestLLMStreamHandler implements t.EventHandler {
|
|
82
101
|
handle(event: string, data: t.StreamEventData | undefined): void {
|
|
83
102
|
const chunk = data?.chunk;
|
|
84
|
-
const
|
|
103
|
+
const isMessageChunk = !!(chunk && 'message' in chunk);
|
|
85
104
|
const msg = isMessageChunk ? chunk.message : undefined;
|
|
86
105
|
if (msg && msg.tool_call_chunks && msg.tool_call_chunks.length > 0) {
|
|
87
106
|
console.log(msg.tool_call_chunks);
|
|
@@ -116,11 +135,17 @@ export class TestChatStreamHandler implements t.EventHandler {
|
|
|
116
135
|
}
|
|
117
136
|
|
|
118
137
|
export class LLMStreamHandler implements t.EventHandler {
|
|
119
|
-
handle(
|
|
138
|
+
handle(
|
|
139
|
+
event: string,
|
|
140
|
+
data: t.StreamEventData | undefined,
|
|
141
|
+
metadata?: Record<string, unknown>
|
|
142
|
+
): void {
|
|
120
143
|
const chunk = data?.chunk;
|
|
121
|
-
const
|
|
144
|
+
const isMessageChunk = !!(chunk && 'message' in chunk);
|
|
122
145
|
const msg = isMessageChunk && chunk.message;
|
|
123
|
-
if (metadata) {
|
|
146
|
+
if (metadata) {
|
|
147
|
+
console.log(metadata);
|
|
148
|
+
}
|
|
124
149
|
if (msg && msg.tool_call_chunks && msg.tool_call_chunks.length > 0) {
|
|
125
150
|
console.log(msg.tool_call_chunks);
|
|
126
151
|
} else if (msg && msg.content) {
|
|
@@ -133,12 +158,21 @@ export class LLMStreamHandler implements t.EventHandler {
|
|
|
133
158
|
}
|
|
134
159
|
}
|
|
135
160
|
|
|
136
|
-
export const createMetadataAggregator = (
|
|
161
|
+
export const createMetadataAggregator = (
|
|
162
|
+
_collected?: Record<
|
|
163
|
+
string,
|
|
164
|
+
NonNullable<BaseMessageFields['response_metadata']>
|
|
165
|
+
>[]
|
|
166
|
+
): t.MetadataAggregatorResult => {
|
|
137
167
|
const collected = _collected || [];
|
|
138
168
|
|
|
139
169
|
const handleLLMEnd: t.HandleLLMEnd = (output) => {
|
|
140
170
|
const { generations } = output;
|
|
141
|
-
const lastMessageOutput = (
|
|
171
|
+
const lastMessageOutput = (
|
|
172
|
+
generations[generations.length - 1] as
|
|
173
|
+
| (t.StreamGeneration | undefined)[]
|
|
174
|
+
| undefined
|
|
175
|
+
)?.[0];
|
|
142
176
|
if (!lastMessageOutput) {
|
|
143
177
|
return;
|
|
144
178
|
}
|
|
@@ -149,4 +183,4 @@ export const createMetadataAggregator = (_collected?: Record<string, NonNullable
|
|
|
149
183
|
};
|
|
150
184
|
|
|
151
185
|
return { handleLLMEnd, collected };
|
|
152
|
-
};
|
|
186
|
+
};
|
package/src/graphs/Graph.ts
CHANGED
|
@@ -105,7 +105,8 @@ export abstract class Graph<
|
|
|
105
105
|
lastToken?: string;
|
|
106
106
|
tokenTypeSwitch?: 'reasoning' | 'content';
|
|
107
107
|
reasoningKey: 'reasoning_content' | 'reasoning' = 'reasoning_content';
|
|
108
|
-
currentTokenType: ContentTypes.TEXT | ContentTypes.THINK =
|
|
108
|
+
currentTokenType: ContentTypes.TEXT | ContentTypes.THINK | 'think_and_text' =
|
|
109
|
+
ContentTypes.TEXT;
|
|
109
110
|
messageStepHasToolCalls: Map<string, boolean> = new Map();
|
|
110
111
|
messageIdsByStepKey: Map<string, string> = new Map();
|
|
111
112
|
prelimMessageIdsByStepKey: Map<string, string> = new Map();
|
|
@@ -303,7 +304,10 @@ export class StandardGraph extends Graph<t.BaseGraphState, GraphNode> {
|
|
|
303
304
|
metadata.langgraph_step as number,
|
|
304
305
|
metadata.checkpoint_ns as string,
|
|
305
306
|
];
|
|
306
|
-
if (
|
|
307
|
+
if (
|
|
308
|
+
this.currentTokenType === ContentTypes.THINK ||
|
|
309
|
+
this.currentTokenType === 'think_and_text'
|
|
310
|
+
) {
|
|
307
311
|
keyList.push('reasoning');
|
|
308
312
|
}
|
|
309
313
|
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/stream.ts
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import type { Graph } from '@/graphs';
|
|
4
|
+
import type * as t from '@/types';
|
|
5
|
+
|
|
6
|
+
export const getMessageId = (
|
|
7
|
+
stepKey: string,
|
|
8
|
+
graph: Graph<t.BaseGraphState>,
|
|
9
|
+
returnExistingId = false
|
|
10
|
+
): string | undefined => {
|
|
11
|
+
const messageId = graph.messageIdsByStepKey.get(stepKey);
|
|
12
|
+
if (messageId != null && messageId) {
|
|
13
|
+
return returnExistingId ? messageId : undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const prelimMessageId = graph.prelimMessageIdsByStepKey.get(stepKey);
|
|
17
|
+
if (prelimMessageId != null && prelimMessageId) {
|
|
18
|
+
graph.prelimMessageIdsByStepKey.delete(stepKey);
|
|
19
|
+
graph.messageIdsByStepKey.set(stepKey, prelimMessageId);
|
|
20
|
+
return prelimMessageId;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const message_id = `msg_${nanoid()}`;
|
|
24
|
+
graph.messageIdsByStepKey.set(stepKey, message_id);
|
|
25
|
+
return message_id;
|
|
26
|
+
};
|
package/src/messages/index.ts
CHANGED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
// src/scripts/cli.ts
|
|
3
|
+
import { config } from 'dotenv';
|
|
4
|
+
config();
|
|
5
|
+
import { HumanMessage, BaseMessage } from '@langchain/core/messages';
|
|
6
|
+
import type * as t from '@/types';
|
|
7
|
+
import { ChatModelStreamHandler, createContentAggregator } from '@/stream';
|
|
8
|
+
import { ToolEndHandler, ModelEndHandler } from '@/events';
|
|
9
|
+
import { createSearchTool } from '@/tools/search';
|
|
10
|
+
|
|
11
|
+
import { getArgs } from '@/scripts/args';
|
|
12
|
+
import { Run } from '@/run';
|
|
13
|
+
import { GraphEvents, Callback } from '@/common';
|
|
14
|
+
import { getLLMConfig } from '@/utils/llmConfig';
|
|
15
|
+
|
|
16
|
+
const conversationHistory: BaseMessage[] = [];
|
|
17
|
+
async function testStandardStreaming(): Promise<void> {
|
|
18
|
+
const { userName, location, provider, currentDate } = await getArgs();
|
|
19
|
+
const { contentParts, aggregateContent } = createContentAggregator();
|
|
20
|
+
const customHandlers = {
|
|
21
|
+
[GraphEvents.TOOL_END]: new ToolEndHandler(),
|
|
22
|
+
[GraphEvents.CHAT_MODEL_END]: new ModelEndHandler(),
|
|
23
|
+
[GraphEvents.CHAT_MODEL_STREAM]: new ChatModelStreamHandler(),
|
|
24
|
+
[GraphEvents.ON_RUN_STEP_COMPLETED]: {
|
|
25
|
+
handle: (
|
|
26
|
+
event: GraphEvents.ON_RUN_STEP_COMPLETED,
|
|
27
|
+
data: t.StreamEventData
|
|
28
|
+
): void => {
|
|
29
|
+
console.log('====== ON_RUN_STEP_COMPLETED ======');
|
|
30
|
+
// console.dir(data, { depth: null });
|
|
31
|
+
aggregateContent({
|
|
32
|
+
event,
|
|
33
|
+
data: data as unknown as { result: t.ToolEndEvent },
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
[GraphEvents.ON_RUN_STEP]: {
|
|
38
|
+
handle: (
|
|
39
|
+
event: GraphEvents.ON_RUN_STEP,
|
|
40
|
+
data: t.StreamEventData
|
|
41
|
+
): void => {
|
|
42
|
+
console.log('====== ON_RUN_STEP ======');
|
|
43
|
+
console.dir(data, { depth: null });
|
|
44
|
+
aggregateContent({ event, data: data as t.RunStep });
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
[GraphEvents.ON_RUN_STEP_DELTA]: {
|
|
48
|
+
handle: (
|
|
49
|
+
event: GraphEvents.ON_RUN_STEP_DELTA,
|
|
50
|
+
data: t.StreamEventData
|
|
51
|
+
): void => {
|
|
52
|
+
console.log('====== ON_RUN_STEP_DELTA ======');
|
|
53
|
+
console.dir(data, { depth: null });
|
|
54
|
+
aggregateContent({ event, data: data as t.RunStepDeltaEvent });
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
[GraphEvents.ON_MESSAGE_DELTA]: {
|
|
58
|
+
handle: (
|
|
59
|
+
event: GraphEvents.ON_MESSAGE_DELTA,
|
|
60
|
+
data: t.StreamEventData
|
|
61
|
+
): void => {
|
|
62
|
+
console.log('====== ON_MESSAGE_DELTA ======');
|
|
63
|
+
console.dir(data, { depth: null });
|
|
64
|
+
aggregateContent({ event, data: data as t.MessageDeltaEvent });
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
[GraphEvents.TOOL_START]: {
|
|
68
|
+
handle: (
|
|
69
|
+
_event: string,
|
|
70
|
+
data: t.StreamEventData,
|
|
71
|
+
metadata?: Record<string, unknown>
|
|
72
|
+
): void => {
|
|
73
|
+
console.log('====== TOOL_START ======');
|
|
74
|
+
// console.dir(data, { depth: null });
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const llmConfig = getLLMConfig(provider);
|
|
80
|
+
|
|
81
|
+
const run = await Run.create<t.IState>({
|
|
82
|
+
runId: 'test-run-id',
|
|
83
|
+
graphConfig: {
|
|
84
|
+
type: 'standard',
|
|
85
|
+
llmConfig,
|
|
86
|
+
tools: [createSearchTool()],
|
|
87
|
+
instructions:
|
|
88
|
+
'You are a friendly AI assistant. Always address the user by their name.',
|
|
89
|
+
// additional_instructions: `The user's name is ${userName} and they are located in ${location}.`,
|
|
90
|
+
},
|
|
91
|
+
returnContent: true,
|
|
92
|
+
customHandlers,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const config = {
|
|
96
|
+
configurable: {
|
|
97
|
+
provider,
|
|
98
|
+
thread_id: 'conversation-num-1',
|
|
99
|
+
},
|
|
100
|
+
streamMode: 'values',
|
|
101
|
+
version: 'v2' as const,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
console.log('Test 1: Search query (search tool test)');
|
|
105
|
+
|
|
106
|
+
// const userMessage = `
|
|
107
|
+
// Make a search for the weather in ${location} today, which is ${currentDate}.
|
|
108
|
+
// Before making the search, please let me know what you're about to do, then immediately start searching without hesitation.
|
|
109
|
+
// Make sure to always refer to me by name, which is ${userName}.
|
|
110
|
+
// After giving me a thorough summary, tell me a joke about the weather forecast we went over.
|
|
111
|
+
// `;
|
|
112
|
+
// const userMessage = 'Are massage guns good?';
|
|
113
|
+
// const userMessage = 'What is functional programming?';
|
|
114
|
+
const userMessage = "Get me today's trending news.";
|
|
115
|
+
// const userMessage = "search recent italy earthquake volcano activity";
|
|
116
|
+
// const userMessage =
|
|
117
|
+
// "use 'Trump' as the exact search query and tell me what you find.";
|
|
118
|
+
|
|
119
|
+
conversationHistory.push(new HumanMessage(userMessage));
|
|
120
|
+
|
|
121
|
+
const inputs = {
|
|
122
|
+
messages: conversationHistory,
|
|
123
|
+
};
|
|
124
|
+
const finalContentParts = await run.processStream(inputs, config);
|
|
125
|
+
const finalMessages = run.getRunMessages();
|
|
126
|
+
if (finalMessages) {
|
|
127
|
+
conversationHistory.push(...finalMessages);
|
|
128
|
+
console.dir(conversationHistory, { depth: null });
|
|
129
|
+
}
|
|
130
|
+
// console.dir(finalContentParts, { depth: null });
|
|
131
|
+
console.log('\n\n====================\n\n');
|
|
132
|
+
// console.dir(contentParts, { depth: null });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
136
|
+
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
|
137
|
+
console.log('Conversation history:');
|
|
138
|
+
process.exit(1);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
testStandardStreaming().catch((err) => {
|
|
142
|
+
console.error(err);
|
|
143
|
+
console.log('Conversation history:');
|
|
144
|
+
console.dir(conversationHistory, { depth: null });
|
|
145
|
+
process.exit(1);
|
|
146
|
+
});
|