@ai-sdk/cohere 3.0.74 → 3.0.76

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
@@ -32,7 +32,7 @@ var import_provider_utils10 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/cohere-chat-language-model.ts
34
34
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
35
- var import_v43 = require("zod/v4");
35
+ var import_v44 = require("zod/v4");
36
36
 
37
37
  // src/cohere-chat-options.ts
38
38
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -68,13 +68,63 @@ var cohereImagePartProviderOptions = (0, import_provider_utils.lazySchema)(
68
68
  )
69
69
  );
70
70
 
71
+ // src/cohere-citations.ts
72
+ var import_v42 = require("zod/v4");
73
+ var cohereCitationSchema = import_v42.z.object({
74
+ start: import_v42.z.number().nullish(),
75
+ end: import_v42.z.number().nullish(),
76
+ text: import_v42.z.string().nullish(),
77
+ sources: import_v42.z.array(
78
+ import_v42.z.object({
79
+ type: import_v42.z.string().nullish(),
80
+ id: import_v42.z.string().nullish(),
81
+ // Documents are arbitrary objects; only the fields the provider maps
82
+ // are typed, everything else is passed through as provider metadata.
83
+ document: import_v42.z.looseObject({
84
+ id: import_v42.z.string().nullish(),
85
+ text: import_v42.z.string().nullish(),
86
+ title: import_v42.z.string().nullish()
87
+ }).nullish(),
88
+ tool_output: import_v42.z.looseObject({}).nullish()
89
+ })
90
+ ).nullish(),
91
+ type: import_v42.z.string().nullish()
92
+ });
93
+ function mapCohereCitationToSource(citation, generateId2) {
94
+ var _a, _b;
95
+ const document = (_b = (_a = citation.sources) == null ? void 0 : _a.find(
96
+ (source) => source.document != null
97
+ )) == null ? void 0 : _b.document;
98
+ if (document == null) {
99
+ return void 0;
100
+ }
101
+ return {
102
+ type: "source",
103
+ sourceType: "document",
104
+ id: generateId2(),
105
+ mediaType: "text/plain",
106
+ title: document.title || "Document",
107
+ providerMetadata: {
108
+ cohere: {
109
+ ...citation.start != null && { start: citation.start },
110
+ ...citation.end != null && { end: citation.end },
111
+ ...citation.text != null && { text: citation.text },
112
+ ...citation.sources != null && {
113
+ sources: citation.sources
114
+ },
115
+ ...citation.type != null && { citationType: citation.type }
116
+ }
117
+ }
118
+ };
119
+ }
120
+
71
121
  // src/cohere-error.ts
72
122
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
73
- var import_v42 = require("zod/v4");
123
+ var import_v43 = require("zod/v4");
74
124
  var cohereErrorDataSchema = (0, import_provider_utils2.lazySchema)(
75
125
  () => (0, import_provider_utils2.zodSchema)(
76
- import_v42.z.object({
77
- message: import_v42.z.string()
126
+ import_v43.z.object({
127
+ message: import_v43.z.string()
78
128
  })
79
129
  )
80
130
  );
@@ -142,6 +192,7 @@ function prepareTools({
142
192
 
143
193
  // src/convert-cohere-usage.ts
144
194
  function convertCohereUsage(usage) {
195
+ var _a, _b, _c, _d;
145
196
  if (usage == null) {
146
197
  return {
147
198
  inputTokens: {
@@ -158,9 +209,8 @@ function convertCohereUsage(usage) {
158
209
  raw: void 0
159
210
  };
160
211
  }
161
- const tokens = usage.tokens;
162
- const inputTokens = tokens.input_tokens;
163
- const outputTokens = tokens.output_tokens;
212
+ const inputTokens = (_b = (_a = usage.tokens) == null ? void 0 : _a.input_tokens) != null ? _b : void 0;
213
+ const outputTokens = (_d = (_c = usage.tokens) == null ? void 0 : _c.output_tokens) != null ? _d : void 0;
164
214
  return {
165
215
  inputTokens: {
166
216
  total: inputTokens,
@@ -180,6 +230,17 @@ function convertCohereUsage(usage) {
180
230
  // src/convert-to-cohere-chat-prompt.ts
181
231
  var import_provider2 = require("@ai-sdk/provider");
182
232
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
233
+ function serializeCohereToolCallArguments(input) {
234
+ if (typeof input === "string") {
235
+ try {
236
+ (0, import_provider_utils3.secureJsonParse)(input);
237
+ return input;
238
+ } catch (e) {
239
+ return JSON.stringify(input);
240
+ }
241
+ }
242
+ return (0, import_provider_utils3.stringifyWithBigIntAndCycles)(input);
243
+ }
183
244
  async function convertToCohereChatPrompt(prompt) {
184
245
  var _a, _b;
185
246
  const messages = [];
@@ -272,7 +333,7 @@ async function convertToCohereChatPrompt(prompt) {
272
333
  type: "function",
273
334
  function: {
274
335
  name: part.toolName,
275
- arguments: JSON.stringify(part.input)
336
+ arguments: serializeCohereToolCallArguments(part.input)
276
337
  }
277
338
  });
278
339
  break;
@@ -304,7 +365,7 @@ async function convertToCohereChatPrompt(prompt) {
304
365
  case "content":
305
366
  case "json":
306
367
  case "error-json":
307
- contentValue = JSON.stringify(output.value);
368
+ contentValue = (0, import_provider_utils3.stringifyWithBigIntAndCycles)(output.value);
308
369
  break;
309
370
  }
310
371
  return {
@@ -430,7 +491,7 @@ var CohereChatLanguageModel = class {
430
491
  };
431
492
  }
432
493
  async doGenerate(options) {
433
- var _a, _b, _c, _d, _e, _f, _g;
494
+ var _a, _b, _c, _d, _e, _f;
434
495
  const { args, warnings } = await this.getArgs(options);
435
496
  const {
436
497
  responseHeaders,
@@ -459,24 +520,15 @@ var CohereChatLanguageModel = class {
459
520
  }
460
521
  }
461
522
  for (const citation of (_b = response.message.citations) != null ? _b : []) {
462
- content.push({
463
- type: "source",
464
- sourceType: "document",
465
- id: this.config.generateId(),
466
- mediaType: "text/plain",
467
- title: ((_d = (_c = citation.sources[0]) == null ? void 0 : _c.document) == null ? void 0 : _d.title) || "Document",
468
- providerMetadata: {
469
- cohere: {
470
- start: citation.start,
471
- end: citation.end,
472
- text: citation.text,
473
- sources: citation.sources,
474
- ...citation.type && { citationType: citation.type }
475
- }
476
- }
477
- });
523
+ const source = mapCohereCitationToSource(
524
+ citation,
525
+ () => this.config.generateId()
526
+ );
527
+ if (source != null) {
528
+ content.push(source);
529
+ }
478
530
  }
479
- for (const toolCall of (_e = response.message.tool_calls) != null ? _e : []) {
531
+ for (const toolCall of (_c = response.message.tool_calls) != null ? _c : []) {
480
532
  content.push({
481
533
  type: "tool-call",
482
534
  toolCallId: toolCall.id,
@@ -490,13 +542,15 @@ var CohereChatLanguageModel = class {
490
542
  content,
491
543
  finishReason: {
492
544
  unified: mapCohereFinishReason(response.finish_reason),
493
- raw: (_f = response.finish_reason) != null ? _f : void 0
545
+ raw: (_d = response.finish_reason) != null ? _d : void 0
494
546
  },
495
547
  usage: convertCohereUsage(response.usage),
496
548
  request: { body: args },
497
549
  response: {
498
550
  // TODO timestamp, model id
499
- id: (_g = response.generation_id) != null ? _g : void 0,
551
+ // Cohere v2 returns `id`; `generation_id` is the v1 field, kept only
552
+ // for compatibility with proxies/mocks that still return it.
553
+ id: (_f = (_e = response.id) != null ? _e : response.generation_id) != null ? _f : void 0,
500
554
  headers: responseHeaders,
501
555
  body: rawResponse
502
556
  },
@@ -523,6 +577,7 @@ var CohereChatLanguageModel = class {
523
577
  let usage = void 0;
524
578
  let pendingToolCall = null;
525
579
  let isActiveReasoning = false;
580
+ const generateId2 = this.config.generateId;
526
581
  return {
527
582
  stream: response.pipeThrough(
528
583
  new TransformStream({
@@ -530,7 +585,7 @@ var CohereChatLanguageModel = class {
530
585
  controller.enqueue({ type: "stream-start", warnings });
531
586
  },
532
587
  async transform(chunk, controller) {
533
- var _a, _b;
588
+ var _a, _b, _c, _d;
534
589
  if (options.includeRawChunks) {
535
590
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
536
591
  }
@@ -588,6 +643,22 @@ var CohereChatLanguageModel = class {
588
643
  });
589
644
  return;
590
645
  }
646
+ case "citation-start": {
647
+ const citations = (_b = (_a = value.delta) == null ? void 0 : _a.message) == null ? void 0 : _b.citations;
648
+ if (citations == null) {
649
+ return;
650
+ }
651
+ for (const citation of Array.isArray(citations) ? citations : [citations]) {
652
+ const source = mapCohereCitationToSource(
653
+ citation,
654
+ generateId2
655
+ );
656
+ if (source != null) {
657
+ controller.enqueue(source);
658
+ }
659
+ }
660
+ return;
661
+ }
591
662
  case "tool-call-start": {
592
663
  const toolId = value.delta.message.tool_calls.id;
593
664
  const toolName = value.delta.message.tool_calls.function.name;
@@ -636,7 +707,7 @@ var CohereChatLanguageModel = class {
636
707
  toolName: pendingToolCall.name,
637
708
  input: JSON.stringify(
638
709
  await (0, import_provider_utils4.parseJSON)({
639
- text: ((_a = pendingToolCall.arguments) == null ? void 0 : _a.trim()) || "{}"
710
+ text: ((_c = pendingToolCall.arguments) == null ? void 0 : _c.trim()) || "{}"
640
711
  })
641
712
  )
642
713
  });
@@ -648,7 +719,7 @@ var CohereChatLanguageModel = class {
648
719
  case "message-start": {
649
720
  controller.enqueue({
650
721
  type: "response-metadata",
651
- id: (_b = value.id) != null ? _b : void 0
722
+ id: (_d = value.id) != null ? _d : void 0
652
723
  });
653
724
  return;
654
725
  }
@@ -678,148 +749,139 @@ var CohereChatLanguageModel = class {
678
749
  };
679
750
  }
680
751
  };
681
- var cohereUsageSchema = () => import_v43.z.looseObject({
682
- billed_units: import_v43.z.looseObject({
683
- input_tokens: import_v43.z.number(),
684
- output_tokens: import_v43.z.number()
752
+ var cohereUsageSchema = () => import_v44.z.looseObject({
753
+ billed_units: import_v44.z.looseObject({
754
+ input_tokens: import_v44.z.number().nullish(),
755
+ output_tokens: import_v44.z.number().nullish()
685
756
  }).nullish(),
686
- tokens: import_v43.z.looseObject({
687
- input_tokens: import_v43.z.number(),
688
- output_tokens: import_v43.z.number()
689
- }),
690
- cached_tokens: import_v43.z.number().nullish()
757
+ tokens: import_v44.z.looseObject({
758
+ input_tokens: import_v44.z.number().nullish(),
759
+ output_tokens: import_v44.z.number().nullish()
760
+ }).nullish(),
761
+ cached_tokens: import_v44.z.number().nullish()
691
762
  });
692
763
  var cohereChatResponseSchema = (0, import_provider_utils4.lazySchema)(
693
764
  () => (0, import_provider_utils4.zodSchema)(
694
- import_v43.z.object({
695
- generation_id: import_v43.z.string().nullish(),
696
- message: import_v43.z.object({
697
- role: import_v43.z.string(),
698
- content: import_v43.z.array(
699
- import_v43.z.union([
700
- import_v43.z.object({
701
- type: import_v43.z.literal("text"),
702
- text: import_v43.z.string()
765
+ import_v44.z.object({
766
+ id: import_v44.z.string().nullish(),
767
+ generation_id: import_v44.z.string().nullish(),
768
+ message: import_v44.z.object({
769
+ role: import_v44.z.string(),
770
+ content: import_v44.z.array(
771
+ import_v44.z.union([
772
+ import_v44.z.object({
773
+ type: import_v44.z.literal("text"),
774
+ text: import_v44.z.string()
703
775
  }),
704
- import_v43.z.object({
705
- type: import_v43.z.literal("thinking"),
706
- thinking: import_v43.z.string()
776
+ import_v44.z.object({
777
+ type: import_v44.z.literal("thinking"),
778
+ thinking: import_v44.z.string()
707
779
  })
708
780
  ])
709
781
  ).nullish(),
710
- tool_plan: import_v43.z.string().nullish(),
711
- tool_calls: import_v43.z.array(
712
- import_v43.z.object({
713
- id: import_v43.z.string(),
714
- type: import_v43.z.literal("function"),
715
- function: import_v43.z.object({
716
- name: import_v43.z.string(),
717
- arguments: import_v43.z.string()
782
+ tool_plan: import_v44.z.string().nullish(),
783
+ tool_calls: import_v44.z.array(
784
+ import_v44.z.object({
785
+ id: import_v44.z.string(),
786
+ type: import_v44.z.literal("function"),
787
+ function: import_v44.z.object({
788
+ name: import_v44.z.string(),
789
+ arguments: import_v44.z.string()
718
790
  })
719
791
  })
720
792
  ).nullish(),
721
- citations: import_v43.z.array(
722
- import_v43.z.object({
723
- start: import_v43.z.number(),
724
- end: import_v43.z.number(),
725
- text: import_v43.z.string(),
726
- sources: import_v43.z.array(
727
- import_v43.z.object({
728
- type: import_v43.z.string().optional(),
729
- id: import_v43.z.string().optional(),
730
- document: import_v43.z.object({
731
- id: import_v43.z.string().optional(),
732
- text: import_v43.z.string(),
733
- title: import_v43.z.string()
734
- })
735
- })
736
- ),
737
- type: import_v43.z.string().optional()
738
- })
739
- ).nullish()
793
+ citations: import_v44.z.array(cohereCitationSchema).nullish()
740
794
  }),
741
- finish_reason: import_v43.z.string(),
742
- usage: cohereUsageSchema()
795
+ finish_reason: import_v44.z.string(),
796
+ usage: cohereUsageSchema().nullish()
743
797
  })
744
798
  )
745
799
  );
746
800
  var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
747
801
  () => (0, import_provider_utils4.zodSchema)(
748
- import_v43.z.discriminatedUnion("type", [
749
- import_v43.z.object({
750
- type: import_v43.z.literal("citation-start")
802
+ import_v44.z.discriminatedUnion("type", [
803
+ // `citation-start` events can arrive without citations, and a single
804
+ // citation may be sent instead of an array.
805
+ import_v44.z.object({
806
+ type: import_v44.z.literal("citation-start"),
807
+ index: import_v44.z.number().nullish(),
808
+ delta: import_v44.z.object({
809
+ message: import_v44.z.object({
810
+ citations: import_v44.z.union([cohereCitationSchema, import_v44.z.array(cohereCitationSchema)]).nullish()
811
+ }).nullish()
812
+ }).nullish()
751
813
  }),
752
- import_v43.z.object({
753
- type: import_v43.z.literal("citation-end")
814
+ import_v44.z.object({
815
+ type: import_v44.z.literal("citation-end")
754
816
  }),
755
- import_v43.z.object({
756
- type: import_v43.z.literal("content-start"),
757
- index: import_v43.z.number(),
758
- delta: import_v43.z.object({
759
- message: import_v43.z.object({
760
- content: import_v43.z.union([
761
- import_v43.z.object({
762
- type: import_v43.z.literal("text"),
763
- text: import_v43.z.string()
817
+ import_v44.z.object({
818
+ type: import_v44.z.literal("content-start"),
819
+ index: import_v44.z.number(),
820
+ delta: import_v44.z.object({
821
+ message: import_v44.z.object({
822
+ content: import_v44.z.union([
823
+ import_v44.z.object({
824
+ type: import_v44.z.literal("text"),
825
+ text: import_v44.z.string()
764
826
  }),
765
- import_v43.z.object({
766
- type: import_v43.z.literal("thinking"),
767
- thinking: import_v43.z.string()
827
+ import_v44.z.object({
828
+ type: import_v44.z.literal("thinking"),
829
+ thinking: import_v44.z.string()
768
830
  })
769
831
  ])
770
832
  })
771
833
  })
772
834
  }),
773
- import_v43.z.object({
774
- type: import_v43.z.literal("content-delta"),
775
- index: import_v43.z.number(),
776
- delta: import_v43.z.object({
777
- message: import_v43.z.object({
778
- content: import_v43.z.union([
779
- import_v43.z.object({
780
- text: import_v43.z.string()
835
+ import_v44.z.object({
836
+ type: import_v44.z.literal("content-delta"),
837
+ index: import_v44.z.number(),
838
+ delta: import_v44.z.object({
839
+ message: import_v44.z.object({
840
+ content: import_v44.z.union([
841
+ import_v44.z.object({
842
+ text: import_v44.z.string()
781
843
  }),
782
- import_v43.z.object({
783
- thinking: import_v43.z.string()
844
+ import_v44.z.object({
845
+ thinking: import_v44.z.string()
784
846
  })
785
847
  ])
786
848
  })
787
849
  })
788
850
  }),
789
- import_v43.z.object({
790
- type: import_v43.z.literal("content-end"),
791
- index: import_v43.z.number()
851
+ import_v44.z.object({
852
+ type: import_v44.z.literal("content-end"),
853
+ index: import_v44.z.number()
792
854
  }),
793
- import_v43.z.object({
794
- type: import_v43.z.literal("message-start"),
795
- id: import_v43.z.string().nullish()
855
+ import_v44.z.object({
856
+ type: import_v44.z.literal("message-start"),
857
+ id: import_v44.z.string().nullish()
796
858
  }),
797
- import_v43.z.object({
798
- type: import_v43.z.literal("message-end"),
799
- delta: import_v43.z.object({
800
- finish_reason: import_v43.z.string(),
859
+ import_v44.z.object({
860
+ type: import_v44.z.literal("message-end"),
861
+ delta: import_v44.z.object({
862
+ finish_reason: import_v44.z.string(),
801
863
  usage: cohereUsageSchema()
802
864
  })
803
865
  }),
804
866
  // https://docs.cohere.com/v2/docs/streaming#tool-use-stream-events-for-tool-calling
805
- import_v43.z.object({
806
- type: import_v43.z.literal("tool-plan-delta"),
807
- delta: import_v43.z.object({
808
- message: import_v43.z.object({
809
- tool_plan: import_v43.z.string()
867
+ import_v44.z.object({
868
+ type: import_v44.z.literal("tool-plan-delta"),
869
+ delta: import_v44.z.object({
870
+ message: import_v44.z.object({
871
+ tool_plan: import_v44.z.string()
810
872
  })
811
873
  })
812
874
  }),
813
- import_v43.z.object({
814
- type: import_v43.z.literal("tool-call-start"),
815
- delta: import_v43.z.object({
816
- message: import_v43.z.object({
817
- tool_calls: import_v43.z.object({
818
- id: import_v43.z.string(),
819
- type: import_v43.z.literal("function"),
820
- function: import_v43.z.object({
821
- name: import_v43.z.string(),
822
- arguments: import_v43.z.string()
875
+ import_v44.z.object({
876
+ type: import_v44.z.literal("tool-call-start"),
877
+ delta: import_v44.z.object({
878
+ message: import_v44.z.object({
879
+ tool_calls: import_v44.z.object({
880
+ id: import_v44.z.string(),
881
+ type: import_v44.z.literal("function"),
882
+ function: import_v44.z.object({
883
+ name: import_v44.z.string(),
884
+ arguments: import_v44.z.string()
823
885
  })
824
886
  })
825
887
  })
@@ -828,20 +890,20 @@ var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
828
890
  // A single tool call's `arguments` stream in chunks and must be accumulated
829
891
  // in a string and so the full tool object info can only be parsed once we see
830
892
  // `tool-call-end`.
831
- import_v43.z.object({
832
- type: import_v43.z.literal("tool-call-delta"),
833
- delta: import_v43.z.object({
834
- message: import_v43.z.object({
835
- tool_calls: import_v43.z.object({
836
- function: import_v43.z.object({
837
- arguments: import_v43.z.string()
893
+ import_v44.z.object({
894
+ type: import_v44.z.literal("tool-call-delta"),
895
+ delta: import_v44.z.object({
896
+ message: import_v44.z.object({
897
+ tool_calls: import_v44.z.object({
898
+ function: import_v44.z.object({
899
+ arguments: import_v44.z.string()
838
900
  })
839
901
  })
840
902
  })
841
903
  })
842
904
  }),
843
- import_v43.z.object({
844
- type: import_v43.z.literal("tool-call-end")
905
+ import_v44.z.object({
906
+ type: import_v44.z.literal("tool-call-end")
845
907
  })
846
908
  ])
847
909
  )
@@ -850,14 +912,14 @@ var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
850
912
  // src/cohere-embedding-model.ts
851
913
  var import_provider3 = require("@ai-sdk/provider");
852
914
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
853
- var import_v45 = require("zod/v4");
915
+ var import_v46 = require("zod/v4");
854
916
 
855
917
  // src/cohere-embedding-options.ts
856
918
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
857
- var import_v44 = require("zod/v4");
919
+ var import_v45 = require("zod/v4");
858
920
  var cohereEmbeddingModelOptions = (0, import_provider_utils5.lazySchema)(
859
921
  () => (0, import_provider_utils5.zodSchema)(
860
- import_v44.z.object({
922
+ import_v45.z.object({
861
923
  /**
862
924
  * Specifies the type of input passed to the model. Default is `search_query`.
863
925
  *
@@ -866,7 +928,7 @@ var cohereEmbeddingModelOptions = (0, import_provider_utils5.lazySchema)(
866
928
  * - "classification": Used for embeddings passed through a text classifier.
867
929
  * - "clustering": Used for embeddings run through a clustering algorithm.
868
930
  */
869
- inputType: import_v44.z.enum([
931
+ inputType: import_v45.z.enum([
870
932
  "search_document",
871
933
  "search_query",
872
934
  "classification",
@@ -880,7 +942,7 @@ var cohereEmbeddingModelOptions = (0, import_provider_utils5.lazySchema)(
880
942
  * - "START": Will discard the start of the input until the remaining input is exactly the maximum input token length for the model.
881
943
  * - "END": Will discard the end of the input until the remaining input is exactly the maximum input token length for the model.
882
944
  */
883
- truncate: import_v44.z.enum(["NONE", "START", "END"]).optional(),
945
+ truncate: import_v45.z.enum(["NONE", "START", "END"]).optional(),
884
946
  /**
885
947
  * The number of dimensions of the output embedding.
886
948
  * Only available for `embed-v4.0` and newer models.
@@ -888,13 +950,13 @@ var cohereEmbeddingModelOptions = (0, import_provider_utils5.lazySchema)(
888
950
  * Embed v4.0 supports `256`, `512`, `1024`, and `1536` (default).
889
951
  * Embed v5.0 Pro and Fast also support `768` and `2048` (default).
890
952
  */
891
- outputDimension: import_v44.z.union([
892
- import_v44.z.literal(256),
893
- import_v44.z.literal(512),
894
- import_v44.z.literal(768),
895
- import_v44.z.literal(1024),
896
- import_v44.z.literal(1536),
897
- import_v44.z.literal(2048)
953
+ outputDimension: import_v45.z.union([
954
+ import_v45.z.literal(256),
955
+ import_v45.z.literal(512),
956
+ import_v45.z.literal(768),
957
+ import_v45.z.literal(1024),
958
+ import_v45.z.literal(1536),
959
+ import_v45.z.literal(2048)
898
960
  ]).optional()
899
961
  })
900
962
  )
@@ -967,13 +1029,13 @@ var CohereEmbeddingModel = class {
967
1029
  };
968
1030
  var cohereTextEmbeddingResponseSchema = (0, import_provider_utils6.lazySchema)(
969
1031
  () => (0, import_provider_utils6.zodSchema)(
970
- import_v45.z.object({
971
- embeddings: import_v45.z.object({
972
- float: import_v45.z.array(import_v45.z.array(import_v45.z.number()))
1032
+ import_v46.z.object({
1033
+ embeddings: import_v46.z.object({
1034
+ float: import_v46.z.array(import_v46.z.array(import_v46.z.number()))
973
1035
  }),
974
- meta: import_v45.z.object({
975
- billed_units: import_v45.z.object({
976
- input_tokens: import_v45.z.number()
1036
+ meta: import_v46.z.object({
1037
+ billed_units: import_v46.z.object({
1038
+ input_tokens: import_v46.z.number()
977
1039
  })
978
1040
  })
979
1041
  })
@@ -985,30 +1047,30 @@ var import_provider_utils9 = require("@ai-sdk/provider-utils");
985
1047
 
986
1048
  // src/reranking/cohere-reranking-api.ts
987
1049
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
988
- var import_v46 = require("zod/v4");
1050
+ var import_v47 = require("zod/v4");
989
1051
  var cohereRerankingResponseSchema = (0, import_provider_utils7.lazySchema)(
990
1052
  () => (0, import_provider_utils7.zodSchema)(
991
- import_v46.z.object({
992
- id: import_v46.z.string().nullish(),
993
- results: import_v46.z.array(
994
- import_v46.z.object({
995
- index: import_v46.z.number(),
996
- relevance_score: import_v46.z.number()
1053
+ import_v47.z.object({
1054
+ id: import_v47.z.string().nullish(),
1055
+ results: import_v47.z.array(
1056
+ import_v47.z.object({
1057
+ index: import_v47.z.number(),
1058
+ relevance_score: import_v47.z.number()
997
1059
  })
998
1060
  ),
999
- meta: import_v46.z.any()
1061
+ meta: import_v47.z.any()
1000
1062
  })
1001
1063
  )
1002
1064
  );
1003
1065
 
1004
1066
  // src/reranking/cohere-reranking-options.ts
1005
1067
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1006
- var import_v47 = require("zod/v4");
1068
+ var import_v48 = require("zod/v4");
1007
1069
  var cohereRerankingModelOptionsSchema = (0, import_provider_utils8.lazySchema)(
1008
1070
  () => (0, import_provider_utils8.zodSchema)(
1009
- import_v47.z.object({
1010
- maxTokensPerDoc: import_v47.z.number().optional(),
1011
- priority: import_v47.z.number().optional()
1071
+ import_v48.z.object({
1072
+ maxTokensPerDoc: import_v48.z.number().optional(),
1073
+ priority: import_v48.z.number().optional()
1012
1074
  })
1013
1075
  )
1014
1076
  );
@@ -1084,7 +1146,7 @@ var CohereRerankingModel = class {
1084
1146
  };
1085
1147
 
1086
1148
  // src/version.ts
1087
- var VERSION = true ? "3.0.74" : "0.0.0-test";
1149
+ var VERSION = true ? "3.0.76" : "0.0.0-test";
1088
1150
 
1089
1151
  // src/cohere-provider.ts
1090
1152
  function createCohere(options = {}) {