@ai-sdk/cohere 2.0.45 → 2.0.46

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.js CHANGED
@@ -28,51 +28,64 @@ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/cohere-provider.ts
30
30
  var import_provider4 = require("@ai-sdk/provider");
31
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
31
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/cohere-chat-language-model.ts
34
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
34
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
35
35
  var import_v43 = require("zod/v4");
36
36
 
37
37
  // src/cohere-chat-options.ts
38
+ var import_provider_utils = require("@ai-sdk/provider-utils");
38
39
  var import_v4 = require("zod/v4");
39
- var cohereChatModelOptions = import_v4.z.object({
40
- /**
41
- * Configuration for reasoning features (optional)
42
- *
43
- * Can be set to an object with the two properties `type` and `tokenBudget`. `type` can be set to `'enabled'` or `'disabled'` (defaults to `'enabled'`).
44
- * `tokenBudget` is the maximum number of tokens the model can use for thinking, which must be set to a positive integer. The model will stop thinking if it reaches the thinking token budget and will proceed with the response
45
- *
46
- * @see https://docs.cohere.com/reference/chat#request.body.thinking
47
- */
48
- thinking: import_v4.z.object({
49
- type: import_v4.z.enum(["enabled", "disabled"]).optional(),
50
- tokenBudget: import_v4.z.number().optional()
51
- }).optional()
52
- });
53
- var cohereImagePartProviderOptions = import_v4.z.object({
54
- /**
55
- * Image fidelity level passed through as `image_url.detail` on the Cohere chat API.
56
- *
57
- * @see https://docs.cohere.com/docs/image-inputs
58
- */
59
- detail: import_v4.z.enum(["auto", "low", "high"]).optional()
60
- });
40
+ var cohereChatModelOptions = (0, import_provider_utils.lazySchema)(
41
+ () => (0, import_provider_utils.zodSchema)(
42
+ import_v4.z.object({
43
+ /**
44
+ * Configuration for reasoning features (optional)
45
+ *
46
+ * Can be set to an object with the two properties `type` and `tokenBudget`. `type` can be set to `'enabled'` or `'disabled'` (defaults to `'enabled'`).
47
+ * `tokenBudget` is the maximum number of tokens the model can use for thinking, which must be set to a positive integer. The model will stop thinking if it reaches the thinking token budget and will proceed with the response
48
+ *
49
+ * @see https://docs.cohere.com/reference/chat#request.body.thinking
50
+ */
51
+ thinking: import_v4.z.object({
52
+ type: import_v4.z.enum(["enabled", "disabled"]).optional(),
53
+ tokenBudget: import_v4.z.number().optional()
54
+ }).optional()
55
+ })
56
+ )
57
+ );
58
+ var cohereImagePartProviderOptions = (0, import_provider_utils.lazySchema)(
59
+ () => (0, import_provider_utils.zodSchema)(
60
+ import_v4.z.object({
61
+ /**
62
+ * Image fidelity level passed through as `image_url.detail` on the Cohere chat API.
63
+ *
64
+ * @see https://docs.cohere.com/docs/image-inputs
65
+ */
66
+ detail: import_v4.z.enum(["auto", "low", "high"]).optional()
67
+ })
68
+ )
69
+ );
61
70
 
62
71
  // src/cohere-error.ts
63
- var import_provider_utils = require("@ai-sdk/provider-utils");
72
+ var import_provider_utils2 = require("@ai-sdk/provider-utils");
64
73
  var import_v42 = require("zod/v4");
65
- var cohereErrorDataSchema = import_v42.z.object({
66
- message: import_v42.z.string()
67
- });
68
- var cohereFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
74
+ var cohereErrorDataSchema = (0, import_provider_utils2.lazySchema)(
75
+ () => (0, import_provider_utils2.zodSchema)(
76
+ import_v42.z.object({
77
+ message: import_v42.z.string()
78
+ })
79
+ )
80
+ );
81
+ var cohereFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
69
82
  errorSchema: cohereErrorDataSchema,
70
83
  errorToMessage: (data) => data.message
71
84
  });
72
85
 
73
86
  // src/convert-to-cohere-chat-prompt.ts
74
87
  var import_provider = require("@ai-sdk/provider");
75
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
88
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
76
89
  async function convertToCohereChatPrompt(prompt) {
77
90
  var _a, _b;
78
91
  const messages = [];
@@ -99,7 +112,7 @@ async function convertToCohereChatPrompt(prompt) {
99
112
  if (isImageMediaType(part.mediaType)) {
100
113
  hasImage = true;
101
114
  const url = buildImageUrl({ part });
102
- const cohereOptions = (_a = await (0, import_provider_utils2.parseProviderOptions)({
115
+ const cohereOptions = (_a = await (0, import_provider_utils3.parseProviderOptions)({
103
116
  provider: "cohere",
104
117
  providerOptions: part.providerOptions,
105
118
  schema: cohereImagePartProviderOptions
@@ -221,7 +234,7 @@ function buildImageUrl({ part }) {
221
234
  return part.data.toString();
222
235
  }
223
236
  const mediaType = part.mediaType === "image" || part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
224
- return `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`;
237
+ return `data:${mediaType};base64,${(0, import_provider_utils3.convertToBase64)(part.data)}`;
225
238
  }
226
239
 
227
240
  // src/map-cohere-finish-reason.ts
@@ -324,7 +337,7 @@ var CohereChatLanguageModel = class {
324
337
  providerOptions
325
338
  }) {
326
339
  var _a, _b;
327
- const cohereOptions = (_a = await (0, import_provider_utils3.parseProviderOptions)({
340
+ const cohereOptions = (_a = await (0, import_provider_utils4.parseProviderOptions)({
328
341
  provider: "cohere",
329
342
  providerOptions,
330
343
  schema: cohereChatModelOptions
@@ -379,12 +392,12 @@ var CohereChatLanguageModel = class {
379
392
  responseHeaders,
380
393
  value: response,
381
394
  rawValue: rawResponse
382
- } = await (0, import_provider_utils3.postJsonToApi)({
395
+ } = await (0, import_provider_utils4.postJsonToApi)({
383
396
  url: `${this.config.baseURL}/chat`,
384
- headers: (0, import_provider_utils3.combineHeaders)(this.config.headers(), options.headers),
397
+ headers: (0, import_provider_utils4.combineHeaders)(this.config.headers(), options.headers),
385
398
  body: args,
386
399
  failedResponseHandler: cohereFailedResponseHandler,
387
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
400
+ successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
388
401
  cohereChatResponseSchema
389
402
  ),
390
403
  abortSignal: options.abortSignal,
@@ -449,12 +462,12 @@ var CohereChatLanguageModel = class {
449
462
  }
450
463
  async doStream(options) {
451
464
  const { args, warnings } = await this.getArgs(options);
452
- const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({
465
+ const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
453
466
  url: `${this.config.baseURL}/chat`,
454
- headers: (0, import_provider_utils3.combineHeaders)(this.config.headers(), options.headers),
467
+ headers: (0, import_provider_utils4.combineHeaders)(this.config.headers(), options.headers),
455
468
  body: { ...args, stream: true },
456
469
  failedResponseHandler: cohereFailedResponseHandler,
457
- successfulResponseHandler: (0, import_provider_utils3.createEventSourceResponseHandler)(
470
+ successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(
458
471
  cohereChatChunkSchema
459
472
  ),
460
473
  abortSignal: options.abortSignal,
@@ -621,197 +634,215 @@ var CohereChatLanguageModel = class {
621
634
  };
622
635
  }
623
636
  };
624
- var cohereChatResponseSchema = import_v43.z.object({
625
- generation_id: import_v43.z.string().nullish(),
626
- message: import_v43.z.object({
627
- role: import_v43.z.string(),
628
- content: import_v43.z.array(
629
- import_v43.z.union([
630
- import_v43.z.object({
631
- type: import_v43.z.literal("text"),
632
- text: import_v43.z.string()
633
- }),
634
- import_v43.z.object({
635
- type: import_v43.z.literal("thinking"),
636
- thinking: import_v43.z.string()
637
- })
638
- ])
639
- ).nullish(),
640
- tool_plan: import_v43.z.string().nullish(),
641
- tool_calls: import_v43.z.array(
642
- import_v43.z.object({
643
- id: import_v43.z.string(),
644
- type: import_v43.z.literal("function"),
645
- function: import_v43.z.object({
646
- name: import_v43.z.string(),
647
- arguments: import_v43.z.string()
648
- })
649
- })
650
- ).nullish(),
651
- citations: import_v43.z.array(
652
- import_v43.z.object({
653
- start: import_v43.z.number(),
654
- end: import_v43.z.number(),
655
- text: import_v43.z.string(),
656
- sources: import_v43.z.array(
657
- import_v43.z.object({
658
- type: import_v43.z.string().optional(),
659
- id: import_v43.z.string().optional(),
660
- document: import_v43.z.object({
661
- id: import_v43.z.string().optional(),
662
- text: import_v43.z.string(),
663
- title: import_v43.z.string()
664
- })
665
- })
666
- ),
667
- type: import_v43.z.string().optional()
668
- })
669
- ).nullish()
670
- }),
671
- finish_reason: import_v43.z.string(),
672
- usage: import_v43.z.object({
673
- billed_units: import_v43.z.object({
674
- input_tokens: import_v43.z.number(),
675
- output_tokens: import_v43.z.number()
676
- }),
677
- tokens: import_v43.z.object({
678
- input_tokens: import_v43.z.number(),
679
- output_tokens: import_v43.z.number()
680
- })
681
- })
682
- });
683
- var cohereChatChunkSchema = import_v43.z.discriminatedUnion("type", [
684
- import_v43.z.object({
685
- type: import_v43.z.literal("citation-start")
686
- }),
687
- import_v43.z.object({
688
- type: import_v43.z.literal("citation-end")
689
- }),
690
- import_v43.z.object({
691
- type: import_v43.z.literal("content-start"),
692
- index: import_v43.z.number(),
693
- delta: import_v43.z.object({
637
+ var cohereChatResponseSchema = (0, import_provider_utils4.lazySchema)(
638
+ () => (0, import_provider_utils4.zodSchema)(
639
+ import_v43.z.object({
640
+ generation_id: import_v43.z.string().nullish(),
694
641
  message: import_v43.z.object({
695
- content: import_v43.z.union([
696
- import_v43.z.object({
697
- type: import_v43.z.literal("text"),
698
- text: import_v43.z.string()
699
- }),
642
+ role: import_v43.z.string(),
643
+ content: import_v43.z.array(
644
+ import_v43.z.union([
645
+ import_v43.z.object({
646
+ type: import_v43.z.literal("text"),
647
+ text: import_v43.z.string()
648
+ }),
649
+ import_v43.z.object({
650
+ type: import_v43.z.literal("thinking"),
651
+ thinking: import_v43.z.string()
652
+ })
653
+ ])
654
+ ).nullish(),
655
+ tool_plan: import_v43.z.string().nullish(),
656
+ tool_calls: import_v43.z.array(
700
657
  import_v43.z.object({
701
- type: import_v43.z.literal("thinking"),
702
- thinking: import_v43.z.string()
658
+ id: import_v43.z.string(),
659
+ type: import_v43.z.literal("function"),
660
+ function: import_v43.z.object({
661
+ name: import_v43.z.string(),
662
+ arguments: import_v43.z.string()
663
+ })
703
664
  })
704
- ])
705
- })
706
- })
707
- }),
708
- import_v43.z.object({
709
- type: import_v43.z.literal("content-delta"),
710
- index: import_v43.z.number(),
711
- delta: import_v43.z.object({
712
- message: import_v43.z.object({
713
- content: import_v43.z.union([
665
+ ).nullish(),
666
+ citations: import_v43.z.array(
714
667
  import_v43.z.object({
715
- text: import_v43.z.string()
716
- }),
717
- import_v43.z.object({
718
- thinking: import_v43.z.string()
668
+ start: import_v43.z.number(),
669
+ end: import_v43.z.number(),
670
+ text: import_v43.z.string(),
671
+ sources: import_v43.z.array(
672
+ import_v43.z.object({
673
+ type: import_v43.z.string().optional(),
674
+ id: import_v43.z.string().optional(),
675
+ document: import_v43.z.object({
676
+ id: import_v43.z.string().optional(),
677
+ text: import_v43.z.string(),
678
+ title: import_v43.z.string()
679
+ })
680
+ })
681
+ ),
682
+ type: import_v43.z.string().optional()
719
683
  })
720
- ])
721
- })
722
- })
723
- }),
724
- import_v43.z.object({
725
- type: import_v43.z.literal("content-end"),
726
- index: import_v43.z.number()
727
- }),
728
- import_v43.z.object({
729
- type: import_v43.z.literal("message-start"),
730
- id: import_v43.z.string().nullish()
731
- }),
732
- import_v43.z.object({
733
- type: import_v43.z.literal("message-end"),
734
- delta: import_v43.z.object({
684
+ ).nullish()
685
+ }),
735
686
  finish_reason: import_v43.z.string(),
736
687
  usage: import_v43.z.object({
688
+ billed_units: import_v43.z.object({
689
+ input_tokens: import_v43.z.number(),
690
+ output_tokens: import_v43.z.number()
691
+ }),
737
692
  tokens: import_v43.z.object({
738
693
  input_tokens: import_v43.z.number(),
739
694
  output_tokens: import_v43.z.number()
740
695
  })
741
696
  })
742
697
  })
743
- }),
744
- // https://docs.cohere.com/v2/docs/streaming#tool-use-stream-events-for-tool-calling
745
- import_v43.z.object({
746
- type: import_v43.z.literal("tool-plan-delta"),
747
- delta: import_v43.z.object({
748
- message: import_v43.z.object({
749
- tool_plan: import_v43.z.string()
750
- })
751
- })
752
- }),
753
- import_v43.z.object({
754
- type: import_v43.z.literal("tool-call-start"),
755
- delta: import_v43.z.object({
756
- message: import_v43.z.object({
757
- tool_calls: import_v43.z.object({
758
- id: import_v43.z.string(),
759
- type: import_v43.z.literal("function"),
760
- function: import_v43.z.object({
761
- name: import_v43.z.string(),
762
- arguments: import_v43.z.string()
698
+ )
699
+ );
700
+ var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
701
+ () => (0, import_provider_utils4.zodSchema)(
702
+ import_v43.z.discriminatedUnion("type", [
703
+ import_v43.z.object({
704
+ type: import_v43.z.literal("citation-start")
705
+ }),
706
+ import_v43.z.object({
707
+ type: import_v43.z.literal("citation-end")
708
+ }),
709
+ import_v43.z.object({
710
+ type: import_v43.z.literal("content-start"),
711
+ index: import_v43.z.number(),
712
+ delta: import_v43.z.object({
713
+ message: import_v43.z.object({
714
+ content: import_v43.z.union([
715
+ import_v43.z.object({
716
+ type: import_v43.z.literal("text"),
717
+ text: import_v43.z.string()
718
+ }),
719
+ import_v43.z.object({
720
+ type: import_v43.z.literal("thinking"),
721
+ thinking: import_v43.z.string()
722
+ })
723
+ ])
763
724
  })
764
725
  })
765
- })
766
- })
767
- }),
768
- // A single tool call's `arguments` stream in chunks and must be accumulated
769
- // in a string and so the full tool object info can only be parsed once we see
770
- // `tool-call-end`.
771
- import_v43.z.object({
772
- type: import_v43.z.literal("tool-call-delta"),
773
- delta: import_v43.z.object({
774
- message: import_v43.z.object({
775
- tool_calls: import_v43.z.object({
776
- function: import_v43.z.object({
777
- arguments: import_v43.z.string()
726
+ }),
727
+ import_v43.z.object({
728
+ type: import_v43.z.literal("content-delta"),
729
+ index: import_v43.z.number(),
730
+ delta: import_v43.z.object({
731
+ message: import_v43.z.object({
732
+ content: import_v43.z.union([
733
+ import_v43.z.object({
734
+ text: import_v43.z.string()
735
+ }),
736
+ import_v43.z.object({
737
+ thinking: import_v43.z.string()
738
+ })
739
+ ])
740
+ })
741
+ })
742
+ }),
743
+ import_v43.z.object({
744
+ type: import_v43.z.literal("content-end"),
745
+ index: import_v43.z.number()
746
+ }),
747
+ import_v43.z.object({
748
+ type: import_v43.z.literal("message-start"),
749
+ id: import_v43.z.string().nullish()
750
+ }),
751
+ import_v43.z.object({
752
+ type: import_v43.z.literal("message-end"),
753
+ delta: import_v43.z.object({
754
+ finish_reason: import_v43.z.string(),
755
+ usage: import_v43.z.object({
756
+ tokens: import_v43.z.object({
757
+ input_tokens: import_v43.z.number(),
758
+ output_tokens: import_v43.z.number()
759
+ })
760
+ })
761
+ })
762
+ }),
763
+ // https://docs.cohere.com/v2/docs/streaming#tool-use-stream-events-for-tool-calling
764
+ import_v43.z.object({
765
+ type: import_v43.z.literal("tool-plan-delta"),
766
+ delta: import_v43.z.object({
767
+ message: import_v43.z.object({
768
+ tool_plan: import_v43.z.string()
769
+ })
770
+ })
771
+ }),
772
+ import_v43.z.object({
773
+ type: import_v43.z.literal("tool-call-start"),
774
+ delta: import_v43.z.object({
775
+ message: import_v43.z.object({
776
+ tool_calls: import_v43.z.object({
777
+ id: import_v43.z.string(),
778
+ type: import_v43.z.literal("function"),
779
+ function: import_v43.z.object({
780
+ name: import_v43.z.string(),
781
+ arguments: import_v43.z.string()
782
+ })
783
+ })
778
784
  })
779
785
  })
786
+ }),
787
+ // A single tool call's `arguments` stream in chunks and must be accumulated
788
+ // in a string and so the full tool object info can only be parsed once we see
789
+ // `tool-call-end`.
790
+ import_v43.z.object({
791
+ type: import_v43.z.literal("tool-call-delta"),
792
+ delta: import_v43.z.object({
793
+ message: import_v43.z.object({
794
+ tool_calls: import_v43.z.object({
795
+ function: import_v43.z.object({
796
+ arguments: import_v43.z.string()
797
+ })
798
+ })
799
+ })
800
+ })
801
+ }),
802
+ import_v43.z.object({
803
+ type: import_v43.z.literal("tool-call-end")
780
804
  })
781
- })
782
- }),
783
- import_v43.z.object({
784
- type: import_v43.z.literal("tool-call-end")
785
- })
786
- ]);
805
+ ])
806
+ )
807
+ );
787
808
 
788
809
  // src/cohere-embedding-model.ts
789
810
  var import_provider3 = require("@ai-sdk/provider");
790
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
811
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
791
812
  var import_v45 = require("zod/v4");
792
813
 
793
814
  // src/cohere-embedding-options.ts
815
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
794
816
  var import_v44 = require("zod/v4");
795
- var cohereEmbeddingOptions = import_v44.z.object({
796
- /**
797
- * Specifies the type of input passed to the model. Default is `search_query`.
798
- *
799
- * - "search_document": Used for embeddings stored in a vector database for search use-cases.
800
- * - "search_query": Used for embeddings of search queries run against a vector DB to find relevant documents.
801
- * - "classification": Used for embeddings passed through a text classifier.
802
- * - "clustering": Used for embeddings run through a clustering algorithm.
803
- */
804
- inputType: import_v44.z.enum(["search_document", "search_query", "classification", "clustering"]).optional(),
805
- /**
806
- * Specifies how the API will handle inputs longer than the maximum token length.
807
- * Default is `END`.
808
- *
809
- * - "NONE": If selected, when the input exceeds the maximum input token length will return an error.
810
- * - "START": Will discard the start of the input until the remaining input is exactly the maximum input token length for the model.
811
- * - "END": Will discard the end of the input until the remaining input is exactly the maximum input token length for the model.
812
- */
813
- truncate: import_v44.z.enum(["NONE", "START", "END"]).optional()
814
- });
817
+ var cohereEmbeddingOptions = (0, import_provider_utils5.lazySchema)(
818
+ () => (0, import_provider_utils5.zodSchema)(
819
+ import_v44.z.object({
820
+ /**
821
+ * Specifies the type of input passed to the model. Default is `search_query`.
822
+ *
823
+ * - "search_document": Used for embeddings stored in a vector database for search use-cases.
824
+ * - "search_query": Used for embeddings of search queries run against a vector DB to find relevant documents.
825
+ * - "classification": Used for embeddings passed through a text classifier.
826
+ * - "clustering": Used for embeddings run through a clustering algorithm.
827
+ */
828
+ inputType: import_v44.z.enum([
829
+ "search_document",
830
+ "search_query",
831
+ "classification",
832
+ "clustering"
833
+ ]).optional(),
834
+ /**
835
+ * Specifies how the API will handle inputs longer than the maximum token length.
836
+ * Default is `END`.
837
+ *
838
+ * - "NONE": If selected, when the input exceeds the maximum input token length will return an error.
839
+ * - "START": Will discard the start of the input until the remaining input is exactly the maximum input token length for the model.
840
+ * - "END": Will discard the end of the input until the remaining input is exactly the maximum input token length for the model.
841
+ */
842
+ truncate: import_v44.z.enum(["NONE", "START", "END"]).optional()
843
+ })
844
+ )
845
+ );
815
846
 
816
847
  // src/cohere-embedding-model.ts
817
848
  var CohereEmbeddingModel = class {
@@ -832,7 +863,7 @@ var CohereEmbeddingModel = class {
832
863
  providerOptions
833
864
  }) {
834
865
  var _a;
835
- const embeddingOptions = await (0, import_provider_utils4.parseProviderOptions)({
866
+ const embeddingOptions = await (0, import_provider_utils6.parseProviderOptions)({
836
867
  provider: "cohere",
837
868
  providerOptions,
838
869
  schema: cohereEmbeddingOptions
@@ -849,9 +880,9 @@ var CohereEmbeddingModel = class {
849
880
  responseHeaders,
850
881
  value: response,
851
882
  rawValue
852
- } = await (0, import_provider_utils4.postJsonToApi)({
883
+ } = await (0, import_provider_utils6.postJsonToApi)({
853
884
  url: `${this.config.baseURL}/embed`,
854
- headers: (0, import_provider_utils4.combineHeaders)(this.config.headers(), headers),
885
+ headers: (0, import_provider_utils6.combineHeaders)(this.config.headers(), headers),
855
886
  body: {
856
887
  model: this.modelId,
857
888
  // The AI SDK only supports 'float' embeddings which are also the only ones
@@ -863,7 +894,7 @@ var CohereEmbeddingModel = class {
863
894
  truncate: embeddingOptions == null ? void 0 : embeddingOptions.truncate
864
895
  },
865
896
  failedResponseHandler: cohereFailedResponseHandler,
866
- successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
897
+ successfulResponseHandler: (0, import_provider_utils6.createJsonResponseHandler)(
867
898
  cohereTextEmbeddingResponseSchema
868
899
  ),
869
900
  abortSignal,
@@ -876,27 +907,31 @@ var CohereEmbeddingModel = class {
876
907
  };
877
908
  }
878
909
  };
879
- var cohereTextEmbeddingResponseSchema = import_v45.z.object({
880
- embeddings: import_v45.z.object({
881
- float: import_v45.z.array(import_v45.z.array(import_v45.z.number()))
882
- }),
883
- meta: import_v45.z.object({
884
- billed_units: import_v45.z.object({
885
- input_tokens: import_v45.z.number()
910
+ var cohereTextEmbeddingResponseSchema = (0, import_provider_utils6.lazySchema)(
911
+ () => (0, import_provider_utils6.zodSchema)(
912
+ import_v45.z.object({
913
+ embeddings: import_v45.z.object({
914
+ float: import_v45.z.array(import_v45.z.array(import_v45.z.number()))
915
+ }),
916
+ meta: import_v45.z.object({
917
+ billed_units: import_v45.z.object({
918
+ input_tokens: import_v45.z.number()
919
+ })
920
+ })
886
921
  })
887
- })
888
- });
922
+ )
923
+ );
889
924
 
890
925
  // src/version.ts
891
- var VERSION = true ? "2.0.45" : "0.0.0-test";
926
+ var VERSION = true ? "2.0.46" : "0.0.0-test";
892
927
 
893
928
  // src/cohere-provider.ts
894
929
  function createCohere(options = {}) {
895
930
  var _a;
896
- const baseURL = (_a = (0, import_provider_utils5.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.cohere.com/v2";
897
- const getHeaders = () => (0, import_provider_utils5.withUserAgentSuffix)(
931
+ const baseURL = (_a = (0, import_provider_utils7.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.cohere.com/v2";
932
+ const getHeaders = () => (0, import_provider_utils7.withUserAgentSuffix)(
898
933
  {
899
- Authorization: `Bearer ${(0, import_provider_utils5.loadApiKey)({
934
+ Authorization: `Bearer ${(0, import_provider_utils7.loadApiKey)({
900
935
  apiKey: options.apiKey,
901
936
  environmentVariableName: "COHERE_API_KEY",
902
937
  description: "Cohere"
@@ -912,7 +947,7 @@ function createCohere(options = {}) {
912
947
  baseURL,
913
948
  headers: getHeaders,
914
949
  fetch: options.fetch,
915
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils5.generateId
950
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils7.generateId
916
951
  });
917
952
  };
918
953
  const createTextEmbeddingModel = (modelId) => new CohereEmbeddingModel(modelId, {