@ai-sdk/alibaba 0.0.32 → 0.0.34

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.mjs CHANGED
@@ -17,6 +17,8 @@ import {
17
17
  InvalidResponseDataError
18
18
  } from "@ai-sdk/provider";
19
19
  import {
20
+ lazySchema as lazySchema3,
21
+ zodSchema as zodSchema3,
20
22
  combineHeaders,
21
23
  createEventSourceResponseHandler,
22
24
  createJsonResponseHandler,
@@ -29,46 +31,62 @@ import {
29
31
  import { z as z3 } from "zod/v4";
30
32
 
31
33
  // src/alibaba-chat-options.ts
34
+ import {
35
+ lazySchema,
36
+ zodSchema
37
+ } from "@ai-sdk/provider-utils";
32
38
  import { z } from "zod/v4";
33
- var alibabaLanguageModelOptions = z.object({
34
- /**
35
- * Enable thinking/reasoning mode for supported models.
36
- * When enabled, the model generates reasoning content before the response.
37
- *
38
- * @default false
39
- */
40
- enableThinking: z.boolean().optional(),
41
- /**
42
- * Maximum number of reasoning tokens to generate.
43
- */
44
- thinkingBudget: z.number().positive().optional(),
45
- /**
46
- * Whether to preserve reasoning from previous assistant messages.
47
- *
48
- * When enabled, historical reasoning is sent separately as
49
- * `reasoning_content` and Alibaba receives `preserve_thinking: true`.
50
- * Defaults to `true` for models that support preserved thinking; set to
51
- * `false` to opt out.
52
- */
53
- preserveThinking: z.boolean().optional(),
54
- /**
55
- * Whether to enable parallel function calling during tool use.
56
- *
57
- * @default true
58
- */
59
- parallelToolCalls: z.boolean().optional()
60
- });
39
+ var alibabaLanguageModelOptions = lazySchema(
40
+ () => zodSchema(
41
+ z.object({
42
+ /**
43
+ * Enable thinking/reasoning mode for supported models.
44
+ * When enabled, the model generates reasoning content before the response.
45
+ *
46
+ * @default false
47
+ */
48
+ enableThinking: z.boolean().optional(),
49
+ /**
50
+ * Maximum number of reasoning tokens to generate.
51
+ */
52
+ thinkingBudget: z.number().positive().optional(),
53
+ /**
54
+ * Whether to preserve reasoning from previous assistant messages.
55
+ *
56
+ * When enabled, historical reasoning is sent separately as
57
+ * `reasoning_content` and Alibaba receives `preserve_thinking: true`.
58
+ * Defaults to `true` for models that support preserved thinking; set to
59
+ * `false` to opt out.
60
+ */
61
+ preserveThinking: z.boolean().optional(),
62
+ /**
63
+ * Whether to enable parallel function calling during tool use.
64
+ *
65
+ * @default true
66
+ */
67
+ parallelToolCalls: z.boolean().optional()
68
+ })
69
+ )
70
+ );
61
71
 
62
72
  // src/alibaba-error.ts
63
- import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
73
+ import {
74
+ lazySchema as lazySchema2,
75
+ zodSchema as zodSchema2,
76
+ createJsonErrorResponseHandler
77
+ } from "@ai-sdk/provider-utils";
64
78
  import { z as z2 } from "zod/v4";
65
- var alibabaErrorDataSchema = z2.object({
66
- error: z2.object({
67
- message: z2.string(),
68
- code: z2.string().nullish(),
69
- type: z2.string().nullish()
70
- })
71
- });
79
+ var alibabaErrorDataSchema = lazySchema2(
80
+ () => zodSchema2(
81
+ z2.object({
82
+ error: z2.object({
83
+ message: z2.string(),
84
+ code: z2.string().nullish(),
85
+ type: z2.string().nullish()
86
+ })
87
+ })
88
+ )
89
+ );
72
90
  var alibabaFailedResponseHandler = createJsonErrorResponseHandler({
73
91
  errorSchema: alibabaErrorDataSchema,
74
92
  errorToMessage: (data) => data.error.message
@@ -758,7 +776,7 @@ var AlibabaLanguageModel = class {
758
776
  };
759
777
  }
760
778
  };
761
- var alibabaUsageSchema = z3.object({
779
+ var alibabaUsageSchema = () => z3.object({
762
780
  prompt_tokens: z3.number(),
763
781
  completion_tokens: z3.number(),
764
782
  total_tokens: z3.number(),
@@ -770,65 +788,73 @@ var alibabaUsageSchema = z3.object({
770
788
  reasoning_tokens: z3.number().nullish()
771
789
  }).nullish()
772
790
  });
773
- var alibabaChatResponseSchema = z3.object({
774
- id: z3.string().nullish(),
775
- created: z3.number().nullish(),
776
- model: z3.string().nullish(),
777
- choices: z3.array(
791
+ var alibabaChatResponseSchema = lazySchema3(
792
+ () => zodSchema3(
778
793
  z3.object({
779
- message: z3.object({
780
- role: z3.literal("assistant").nullish(),
781
- content: z3.string().nullish(),
782
- reasoning_content: z3.string().nullish(),
783
- // Alibaba thinking mode
784
- tool_calls: z3.array(
785
- z3.object({
786
- id: z3.string(),
787
- type: z3.literal("function"),
788
- function: z3.object({
789
- name: z3.string(),
790
- arguments: z3.string()
791
- })
792
- })
793
- ).nullish()
794
- }),
795
- finish_reason: z3.string().nullish(),
796
- index: z3.number()
794
+ id: z3.string().nullish(),
795
+ created: z3.number().nullish(),
796
+ model: z3.string().nullish(),
797
+ choices: z3.array(
798
+ z3.object({
799
+ message: z3.object({
800
+ role: z3.literal("assistant").nullish(),
801
+ content: z3.string().nullish(),
802
+ reasoning_content: z3.string().nullish(),
803
+ // Alibaba thinking mode
804
+ tool_calls: z3.array(
805
+ z3.object({
806
+ id: z3.string(),
807
+ type: z3.literal("function"),
808
+ function: z3.object({
809
+ name: z3.string(),
810
+ arguments: z3.string()
811
+ })
812
+ })
813
+ ).nullish()
814
+ }),
815
+ finish_reason: z3.string().nullish(),
816
+ index: z3.number()
817
+ })
818
+ ),
819
+ usage: alibabaUsageSchema().nullish()
797
820
  })
798
- ),
799
- usage: alibabaUsageSchema.nullish()
800
- });
801
- var alibabaChatChunkSchema = z3.object({
802
- id: z3.string().nullish(),
803
- created: z3.number().nullish(),
804
- model: z3.string().nullish(),
805
- choices: z3.array(
821
+ )
822
+ );
823
+ var alibabaChatChunkSchema = lazySchema3(
824
+ () => zodSchema3(
806
825
  z3.object({
807
- delta: z3.object({
808
- role: z3.enum(["assistant"]).nullish(),
809
- content: z3.string().nullish(),
810
- reasoning_content: z3.string().nullish(),
811
- // Alibaba thinking mode delta
812
- tool_calls: z3.array(
813
- z3.object({
814
- index: z3.number().nullish(),
815
- // Index for accumulating tool calls
816
- id: z3.string().nullish(),
817
- type: z3.literal("function").nullish(),
818
- function: z3.object({
819
- name: z3.string().nullish(),
820
- arguments: z3.string().nullish()
821
- }).nullish()
822
- })
823
- ).nullish()
824
- }),
825
- finish_reason: z3.string().nullish(),
826
- index: z3.number()
826
+ id: z3.string().nullish(),
827
+ created: z3.number().nullish(),
828
+ model: z3.string().nullish(),
829
+ choices: z3.array(
830
+ z3.object({
831
+ delta: z3.object({
832
+ role: z3.enum(["assistant"]).nullish(),
833
+ content: z3.string().nullish(),
834
+ reasoning_content: z3.string().nullish(),
835
+ // Alibaba thinking mode delta
836
+ tool_calls: z3.array(
837
+ z3.object({
838
+ index: z3.number().nullish(),
839
+ // Index for accumulating tool calls
840
+ id: z3.string().nullish(),
841
+ type: z3.literal("function").nullish(),
842
+ function: z3.object({
843
+ name: z3.string().nullish(),
844
+ arguments: z3.string().nullish()
845
+ }).nullish()
846
+ })
847
+ ).nullish()
848
+ }),
849
+ finish_reason: z3.string().nullish(),
850
+ index: z3.number()
851
+ })
852
+ ),
853
+ usage: alibabaUsageSchema().nullish()
854
+ // Usage only appears in final chunk
827
855
  })
828
- ),
829
- usage: alibabaUsageSchema.nullish()
830
- // Usage only appears in final chunk
831
- });
856
+ )
857
+ );
832
858
 
833
859
  // src/alibaba-embedding-model.ts
834
860
  import {
@@ -836,6 +862,8 @@ import {
836
862
  UnsupportedFunctionalityError as UnsupportedFunctionalityError3
837
863
  } from "@ai-sdk/provider";
838
864
  import {
865
+ lazySchema as lazySchema5,
866
+ zodSchema as zodSchema5,
839
867
  combineHeaders as combineHeaders2,
840
868
  createJsonErrorResponseHandler as createJsonErrorResponseHandler2,
841
869
  createJsonResponseHandler as createJsonResponseHandler2,
@@ -845,27 +873,35 @@ import {
845
873
  import { z as z5 } from "zod/v4";
846
874
 
847
875
  // src/alibaba-embedding-options.ts
876
+ import {
877
+ lazySchema as lazySchema4,
878
+ zodSchema as zodSchema4
879
+ } from "@ai-sdk/provider-utils";
848
880
  import { z as z4 } from "zod/v4";
849
- var alibabaEmbeddingModelOptions = z4.object({
850
- /**
851
- * Differentiates query text from document text for asymmetric retrieval tasks.
852
- * Defaults to `document`.
853
- */
854
- textType: z4.enum(["query", "document"]).optional(),
855
- /**
856
- * The dimension of the output embedding vectors. Defaults to 1024.
857
- *
858
- * `text-embedding-v4` also supports 1536 and 2048 dimensions.
859
- */
860
- dimension: z4.number().optional(),
861
- /**
862
- * The output vector type. Defaults to `dense`.
863
- *
864
- * Sparse-only output is not supported by the AI SDK embedding interface,
865
- * which requires dense number arrays.
866
- */
867
- outputType: z4.enum(["dense", "sparse", "dense&sparse"]).optional()
868
- });
881
+ var alibabaEmbeddingModelOptions = lazySchema4(
882
+ () => zodSchema4(
883
+ z4.object({
884
+ /**
885
+ * Differentiates query text from document text for asymmetric retrieval tasks.
886
+ * Defaults to `document`.
887
+ */
888
+ textType: z4.enum(["query", "document"]).optional(),
889
+ /**
890
+ * The dimension of the output embedding vectors. Defaults to 1024.
891
+ *
892
+ * `text-embedding-v4` also supports 1536 and 2048 dimensions.
893
+ */
894
+ dimension: z4.number().optional(),
895
+ /**
896
+ * The output vector type. Defaults to `dense`.
897
+ *
898
+ * Sparse-only output is not supported by the AI SDK embedding interface,
899
+ * which requires dense number arrays.
900
+ */
901
+ outputType: z4.enum(["dense", "sparse", "dense&sparse"]).optional()
902
+ })
903
+ )
904
+ );
869
905
 
870
906
  // src/alibaba-embedding-model.ts
871
907
  var alibabaEmbeddingFailedResponseHandler = createJsonErrorResponseHandler2({
@@ -962,28 +998,32 @@ var AlibabaEmbeddingModel = class {
962
998
  };
963
999
  }
964
1000
  };
965
- var alibabaTextEmbeddingSparseEmbeddingSchema = z5.object({
1001
+ var alibabaTextEmbeddingSparseEmbeddingSchema = () => z5.object({
966
1002
  index: z5.number(),
967
1003
  value: z5.number(),
968
1004
  token: z5.string().nullish()
969
1005
  });
970
- var alibabaTextEmbeddingResponseSchema = z5.object({
971
- output: z5.object({
972
- embeddings: z5.array(
973
- z5.object({
974
- embedding: z5.array(z5.number()),
975
- text_index: z5.number(),
976
- sparse_embedding: z5.array(alibabaTextEmbeddingSparseEmbeddingSchema).nullish()
977
- })
978
- )
979
- }),
980
- usage: z5.object({
981
- total_tokens: z5.number()
982
- }).nullish()
983
- });
1006
+ var alibabaTextEmbeddingResponseSchema = lazySchema5(
1007
+ () => zodSchema5(
1008
+ z5.object({
1009
+ output: z5.object({
1010
+ embeddings: z5.array(
1011
+ z5.object({
1012
+ embedding: z5.array(z5.number()),
1013
+ text_index: z5.number(),
1014
+ sparse_embedding: z5.array(alibabaTextEmbeddingSparseEmbeddingSchema()).nullish()
1015
+ })
1016
+ )
1017
+ }),
1018
+ usage: z5.object({
1019
+ total_tokens: z5.number()
1020
+ }).nullish()
1021
+ })
1022
+ )
1023
+ );
984
1024
 
985
1025
  // src/version.ts
986
- var VERSION = true ? "0.0.32" : "0.0.0-test";
1026
+ var VERSION = true ? "0.0.34" : "0.0.0-test";
987
1027
 
988
1028
  // src/alibaba-provider.ts
989
1029
  function createAlibaba(options = {}) {