ai 2.2.9 → 2.2.10

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/index.d.ts CHANGED
@@ -449,6 +449,7 @@ declare function AnthropicStream(res: Response | AsyncIterable<CompletionChunk>,
449
449
 
450
450
  declare function LangChainStream(callbacks?: AIStreamCallbacksAndOptions): {
451
451
  stream: ReadableStream<any>;
452
+ writer: WritableStreamDefaultWriter<any>;
452
453
  handlers: {
453
454
  handleLLMNewToken: (token: string) => Promise<void>;
454
455
  handleLLMStart: (_llm: any, _prompts: string[], runId: string) => Promise<void>;
package/dist/index.js CHANGED
@@ -655,6 +655,7 @@ function LangChainStream(callbacks) {
655
655
  stream: stream.readable.pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(
656
656
  createStreamDataTransformer(callbacks == null ? void 0 : callbacks.experimental_streamData)
657
657
  ),
658
+ writer,
658
659
  handlers: {
659
660
  handleLLMNewToken: async (token) => {
660
661
  await writer.ready;
package/dist/index.mjs CHANGED
@@ -610,6 +610,7 @@ function LangChainStream(callbacks) {
610
610
  stream: stream.readable.pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(
611
611
  createStreamDataTransformer(callbacks == null ? void 0 : callbacks.experimental_streamData)
612
612
  ),
613
+ writer,
613
614
  handlers: {
614
615
  handleLLMNewToken: async (token) => {
615
616
  await writer.ready;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
package/vue/dist/index.js CHANGED
@@ -280,6 +280,7 @@ function useCompletion({
280
280
  onFinish,
281
281
  onError
282
282
  } = {}) {
283
+ var _a;
283
284
  const completionId = id || `completion-${uniqueId2++}`;
284
285
  const key = `${api}|${completionId}`;
285
286
  const { data, mutate: originalMutate } = useSWRV2(
@@ -287,8 +288,10 @@ function useCompletion({
287
288
  () => store2[key] || initialCompletion
288
289
  );
289
290
  const { data: isLoading, mutate: mutateLoading } = useSWRV2(
290
- `${completionId}-loading`
291
+ `${completionId}-loading`,
292
+ null
291
293
  );
294
+ (_a = isLoading.value) != null ? _a : isLoading.value = false;
292
295
  data.value || (data.value = initialCompletion);
293
296
  const mutate = (data2) => {
294
297
  store2[key] = data2;
@@ -243,6 +243,7 @@ function useCompletion({
243
243
  onFinish,
244
244
  onError
245
245
  } = {}) {
246
+ var _a;
246
247
  const completionId = id || `completion-${uniqueId2++}`;
247
248
  const key = `${api}|${completionId}`;
248
249
  const { data, mutate: originalMutate } = useSWRV2(
@@ -250,8 +251,10 @@ function useCompletion({
250
251
  () => store2[key] || initialCompletion
251
252
  );
252
253
  const { data: isLoading, mutate: mutateLoading } = useSWRV2(
253
- `${completionId}-loading`
254
+ `${completionId}-loading`,
255
+ null
254
256
  );
257
+ (_a = isLoading.value) != null ? _a : isLoading.value = false;
255
258
  data.value || (data.value = initialCompletion);
256
259
  const mutate = (data2) => {
257
260
  store2[key] = data2;