ai 2.1.30 → 2.1.32

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/README.md CHANGED
@@ -5,7 +5,7 @@ The Vercel AI SDK is **a library for building AI-powered streaming text and chat
5
5
  ## Features
6
6
 
7
7
  - [SWR](https://swr.vercel.app)-powered React, Svelte, Vue and Solid helpers for streaming text responses and building chat and completion UIs
8
- - First-class support for [LangChain](https://js.langchain.com/docs) and [OpenAI](https://openai.com), [Anthropic](https://www.anthropic.com), [Cohere](https://cohere.com) and [Hugging Face](https://huggingface.co)
8
+ - First-class support for [LangChain](https://js.langchain.com/docs) and [OpenAI](https://openai.com), [Anthropic](https://www.anthropic.com), [Cohere](https://cohere.com), [Hugging Face](https://huggingface.co), and [Replicate](https://replicate.com)
9
9
  - Node.js, Serverless, and [Edge Runtime](https://edge-runtime.vercel.app/) support
10
10
  - Callbacks for saving completed streaming responses to a database (in the same request)
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "2.1.30",
3
+ "version": "2.1.32",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -780,6 +780,12 @@ function useChat({
780
780
  );
781
781
  input.set("");
782
782
  };
783
+ const isLoading = (0, import_store.derived)(
784
+ [isSWRLoading, loading],
785
+ ([$isSWRLoading, $loading]) => {
786
+ return $isSWRLoading || $loading;
787
+ }
788
+ );
783
789
  return {
784
790
  messages,
785
791
  error,
@@ -789,7 +795,7 @@ function useChat({
789
795
  setMessages,
790
796
  input,
791
797
  handleSubmit,
792
- isLoading: isSWRLoading || loading
798
+ isLoading
793
799
  };
794
800
  }
795
801
 
@@ -917,6 +923,12 @@ function useCompletion({
917
923
  return;
918
924
  return complete(inputValue);
919
925
  };
926
+ const isLoading = (0, import_store2.derived)(
927
+ [isSWRLoading, loading],
928
+ ([$isSWRLoading, $loading]) => {
929
+ return $isSWRLoading || $loading;
930
+ }
931
+ );
920
932
  return {
921
933
  completion,
922
934
  complete,
@@ -925,7 +937,7 @@ function useCompletion({
925
937
  setCompletion,
926
938
  input,
927
939
  handleSubmit,
928
- isLoading: isSWRLoading || loading
940
+ isLoading
929
941
  };
930
942
  }
931
943
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,5 +1,5 @@
1
1
  // svelte/use-chat.ts
2
- import { get, writable } from "svelte/store";
2
+ import { get, writable, derived } from "svelte/store";
3
3
 
4
4
  // ../../node_modules/.pnpm/swrev@4.0.0/node_modules/swrev/dist/swrev.mjs
5
5
  var P = Object.defineProperty;
@@ -753,6 +753,12 @@ function useChat({
753
753
  );
754
754
  input.set("");
755
755
  };
756
+ const isLoading = derived(
757
+ [isSWRLoading, loading],
758
+ ([$isSWRLoading, $loading]) => {
759
+ return $isSWRLoading || $loading;
760
+ }
761
+ );
756
762
  return {
757
763
  messages,
758
764
  error,
@@ -762,12 +768,12 @@ function useChat({
762
768
  setMessages,
763
769
  input,
764
770
  handleSubmit,
765
- isLoading: isSWRLoading || loading
771
+ isLoading
766
772
  };
767
773
  }
768
774
 
769
775
  // svelte/use-completion.ts
770
- import { get as get2, writable as writable2 } from "svelte/store";
776
+ import { derived as derived2, get as get2, writable as writable2 } from "svelte/store";
771
777
  var uniqueId2 = 0;
772
778
  var store2 = {};
773
779
  function useCompletion({
@@ -890,6 +896,12 @@ function useCompletion({
890
896
  return;
891
897
  return complete(inputValue);
892
898
  };
899
+ const isLoading = derived2(
900
+ [isSWRLoading, loading],
901
+ ([$isSWRLoading, $loading]) => {
902
+ return $isSWRLoading || $loading;
903
+ }
904
+ );
893
905
  return {
894
906
  completion,
895
907
  complete,
@@ -898,7 +910,7 @@ function useCompletion({
898
910
  setCompletion,
899
911
  input,
900
912
  handleSubmit,
901
- isLoading: isSWRLoading || loading
913
+ isLoading
902
914
  };
903
915
  }
904
916
  export {