@ai-sdk/cohere 2.0.48 → 2.0.49

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/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @ai-sdk/cohere
2
2
 
3
+ ## 2.0.49
4
+
5
+ ### Patch Changes
6
+
7
+ - 2bde332: fix(cohere): tolerate partial citations and usage in non-streaming responses
8
+
9
+ Cohere citations and usage fields are optional in the API specification, but the
10
+ response schema required `start`, `end`, `text`, every source `document` with
11
+ `text` and `title`, and usage token counts. Responses with untitled documents
12
+ (documents passed without a filename), with tool-sourced citations, or without
13
+ token counts failed with an `AI_TypeValidationError` and discarded the whole
14
+ response.
15
+
16
+ These fields are now validated loosely: citation fields and source `type`/`id`
17
+ are nullish, `document` is a loose object with optional `id`/`text`/`title`, tool
18
+ sources are accepted, and `usage` plus its token counts are nullish. Document
19
+ citations without a title fall back to `"Document"`. Tool-only citations are
20
+ skipped because they have no document to point at; their data stays in the
21
+ response body.
22
+
23
+ `convertCohereUsage` no longer falls back to `billed_units`, which are a
24
+ different measure than `tokens` (e.g. 12 billed vs 507 input tokens in a single
25
+ response) and would go negative when cached tokens are subtracted. A response
26
+ without `tokens` now reports undefined token counts instead of unrelated
27
+ numbers. This usage conversion is shared with streaming.
28
+
29
+ - e51d6ad: fix(cohere): read the response id from v2 chat responses
30
+
31
+ The non-streaming response schema read `generation_id`, which Cohere's v2 chat
32
+ response does not return. As a result, `generateText().response.id` was a locally
33
+ generated fallback instead of the provider's id, while `streamText` returned the
34
+ id from the `message-start` event. `doGenerate` now reads `id` and keeps
35
+ `generation_id` (the v1 field) only for compatibility with proxies and mocks that
36
+ still return it.
37
+
38
+ - 2bde332: fix(cohere): emit `source` stream parts for citations
39
+
40
+ `streamText` did not produce sources for Cohere RAG responses because `citation-start` stream events were ignored, while `generateText` mapped `message.citations` to document sources. Streaming now maps each cited document to the same `source` part as the non-streaming path. Citations that only reference tool output are not emitted as sources, and `citation-start` events without citations are ignored.
41
+
42
+ - Updated dependencies [49c554d]
43
+ - Updated dependencies [b753c03]
44
+ - @ai-sdk/provider-utils@3.0.45
45
+
3
46
  ## 2.0.48
4
47
 
5
48
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider_utils7 = 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, generateId3) {
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: generateId3(),
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
  );
@@ -397,7 +447,7 @@ var CohereChatLanguageModel = class {
397
447
  };
398
448
  }
399
449
  async doGenerate(options) {
400
- var _a, _b, _c, _d, _e, _f;
450
+ var _a, _b, _c, _d, _e;
401
451
  const { args, warnings } = await this.getArgs(options);
402
452
  const {
403
453
  responseHeaders,
@@ -426,24 +476,15 @@ var CohereChatLanguageModel = class {
426
476
  }
427
477
  }
428
478
  for (const citation of (_b = response.message.citations) != null ? _b : []) {
429
- content.push({
430
- type: "source",
431
- sourceType: "document",
432
- id: this.config.generateId(),
433
- mediaType: "text/plain",
434
- title: ((_d = (_c = citation.sources[0]) == null ? void 0 : _c.document) == null ? void 0 : _d.title) || "Document",
435
- providerMetadata: {
436
- cohere: {
437
- start: citation.start,
438
- end: citation.end,
439
- text: citation.text,
440
- sources: citation.sources,
441
- ...citation.type && { citationType: citation.type }
442
- }
443
- }
444
- });
479
+ const source = mapCohereCitationToSource(
480
+ citation,
481
+ () => this.config.generateId()
482
+ );
483
+ if (source != null) {
484
+ content.push(source);
485
+ }
445
486
  }
446
- for (const toolCall of (_e = response.message.tool_calls) != null ? _e : []) {
487
+ for (const toolCall of (_c = response.message.tool_calls) != null ? _c : []) {
447
488
  content.push({
448
489
  type: "tool-call",
449
490
  toolCallId: toolCall.id,
@@ -456,15 +497,13 @@ var CohereChatLanguageModel = class {
456
497
  return {
457
498
  content,
458
499
  finishReason: mapCohereFinishReason(response.finish_reason),
459
- usage: {
460
- inputTokens: response.usage.tokens.input_tokens,
461
- outputTokens: response.usage.tokens.output_tokens,
462
- totalTokens: response.usage.tokens.input_tokens + response.usage.tokens.output_tokens
463
- },
500
+ usage: convertCohereUsage(response.usage),
464
501
  request: { body: args },
465
502
  response: {
466
503
  // TODO timestamp, model id
467
- id: (_f = response.generation_id) != null ? _f : void 0,
504
+ // Cohere v2 returns `id`; `generation_id` is the v1 field, kept only
505
+ // for compatibility with proxies/mocks that still return it.
506
+ id: (_e = (_d = response.id) != null ? _d : response.generation_id) != null ? _e : void 0,
468
507
  headers: responseHeaders,
469
508
  body: rawResponse
470
509
  },
@@ -485,13 +524,10 @@ var CohereChatLanguageModel = class {
485
524
  fetch: this.config.fetch
486
525
  });
487
526
  let finishReason = "unknown";
488
- const usage = {
489
- inputTokens: void 0,
490
- outputTokens: void 0,
491
- totalTokens: void 0
492
- };
527
+ let rawUsage = void 0;
493
528
  let pendingToolCall = null;
494
529
  let isActiveReasoning = false;
530
+ const generateId3 = this.config.generateId;
495
531
  return {
496
532
  stream: response.pipeThrough(
497
533
  new TransformStream({
@@ -499,7 +535,7 @@ var CohereChatLanguageModel = class {
499
535
  controller.enqueue({ type: "stream-start", warnings });
500
536
  },
501
537
  transform(chunk, controller) {
502
- var _a, _b;
538
+ var _a, _b, _c, _d, _e;
503
539
  if (options.includeRawChunks) {
504
540
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
505
541
  }
@@ -557,6 +593,22 @@ var CohereChatLanguageModel = class {
557
593
  });
558
594
  return;
559
595
  }
596
+ case "citation-start": {
597
+ const citations = (_b = (_a = value.delta) == null ? void 0 : _a.message) == null ? void 0 : _b.citations;
598
+ if (citations == null) {
599
+ return;
600
+ }
601
+ for (const citation of Array.isArray(citations) ? citations : [citations]) {
602
+ const source = mapCohereCitationToSource(
603
+ citation,
604
+ generateId3
605
+ );
606
+ if (source != null) {
607
+ controller.enqueue(source);
608
+ }
609
+ }
610
+ return;
611
+ }
560
612
  case "tool-call-start": {
561
613
  const toolId = value.delta.message.tool_calls.id;
562
614
  const toolName = value.delta.message.tool_calls.function.name;
@@ -604,7 +656,7 @@ var CohereChatLanguageModel = class {
604
656
  toolCallId: pendingToolCall.id,
605
657
  toolName: pendingToolCall.name,
606
658
  input: JSON.stringify(
607
- JSON.parse(((_a = pendingToolCall.arguments) == null ? void 0 : _a.trim()) || "{}")
659
+ JSON.parse(((_c = pendingToolCall.arguments) == null ? void 0 : _c.trim()) || "{}")
608
660
  )
609
661
  });
610
662
  pendingToolCall.hasFinished = true;
@@ -615,16 +667,13 @@ var CohereChatLanguageModel = class {
615
667
  case "message-start": {
616
668
  controller.enqueue({
617
669
  type: "response-metadata",
618
- id: (_b = value.id) != null ? _b : void 0
670
+ id: (_d = value.id) != null ? _d : void 0
619
671
  });
620
672
  return;
621
673
  }
622
674
  case "message-end": {
623
675
  finishReason = mapCohereFinishReason(value.delta.finish_reason);
624
- const tokens = value.delta.usage.tokens;
625
- usage.inputTokens = tokens.input_tokens;
626
- usage.outputTokens = tokens.output_tokens;
627
- usage.totalTokens = tokens.input_tokens + tokens.output_tokens;
676
+ rawUsage = (_e = value.delta.usage) != null ? _e : void 0;
628
677
  return;
629
678
  }
630
679
  default: {
@@ -635,7 +684,7 @@ var CohereChatLanguageModel = class {
635
684
  controller.enqueue({
636
685
  type: "finish",
637
686
  finishReason,
638
- usage
687
+ usage: convertCohereUsage(rawUsage)
639
688
  });
640
689
  }
641
690
  })
@@ -645,151 +694,148 @@ var CohereChatLanguageModel = class {
645
694
  };
646
695
  }
647
696
  };
697
+ var cohereUsageSchema = () => import_v44.z.looseObject({
698
+ billed_units: import_v44.z.looseObject({
699
+ input_tokens: import_v44.z.number().nullish(),
700
+ output_tokens: import_v44.z.number().nullish()
701
+ }).nullish(),
702
+ tokens: import_v44.z.looseObject({
703
+ input_tokens: import_v44.z.number().nullish(),
704
+ output_tokens: import_v44.z.number().nullish()
705
+ }).nullish()
706
+ });
707
+ function convertCohereUsage(usage) {
708
+ var _a, _b, _c, _d;
709
+ const inputTokens = (_b = (_a = usage == null ? void 0 : usage.tokens) == null ? void 0 : _a.input_tokens) != null ? _b : void 0;
710
+ const outputTokens = (_d = (_c = usage == null ? void 0 : usage.tokens) == null ? void 0 : _c.output_tokens) != null ? _d : void 0;
711
+ return {
712
+ inputTokens,
713
+ outputTokens,
714
+ totalTokens: inputTokens != null && outputTokens != null ? inputTokens + outputTokens : void 0
715
+ };
716
+ }
648
717
  var cohereChatResponseSchema = (0, import_provider_utils4.lazySchema)(
649
718
  () => (0, import_provider_utils4.zodSchema)(
650
- import_v43.z.object({
651
- generation_id: import_v43.z.string().nullish(),
652
- message: import_v43.z.object({
653
- role: import_v43.z.string(),
654
- content: import_v43.z.array(
655
- import_v43.z.union([
656
- import_v43.z.object({
657
- type: import_v43.z.literal("text"),
658
- text: import_v43.z.string()
719
+ import_v44.z.object({
720
+ id: import_v44.z.string().nullish(),
721
+ generation_id: import_v44.z.string().nullish(),
722
+ message: import_v44.z.object({
723
+ role: import_v44.z.string(),
724
+ content: import_v44.z.array(
725
+ import_v44.z.union([
726
+ import_v44.z.object({
727
+ type: import_v44.z.literal("text"),
728
+ text: import_v44.z.string()
659
729
  }),
660
- import_v43.z.object({
661
- type: import_v43.z.literal("thinking"),
662
- thinking: import_v43.z.string()
730
+ import_v44.z.object({
731
+ type: import_v44.z.literal("thinking"),
732
+ thinking: import_v44.z.string()
663
733
  })
664
734
  ])
665
735
  ).nullish(),
666
- tool_plan: import_v43.z.string().nullish(),
667
- tool_calls: import_v43.z.array(
668
- import_v43.z.object({
669
- id: import_v43.z.string(),
670
- type: import_v43.z.literal("function"),
671
- function: import_v43.z.object({
672
- name: import_v43.z.string(),
673
- arguments: import_v43.z.string()
736
+ tool_plan: import_v44.z.string().nullish(),
737
+ tool_calls: import_v44.z.array(
738
+ import_v44.z.object({
739
+ id: import_v44.z.string(),
740
+ type: import_v44.z.literal("function"),
741
+ function: import_v44.z.object({
742
+ name: import_v44.z.string(),
743
+ arguments: import_v44.z.string()
674
744
  })
675
745
  })
676
746
  ).nullish(),
677
- citations: import_v43.z.array(
678
- import_v43.z.object({
679
- start: import_v43.z.number(),
680
- end: import_v43.z.number(),
681
- text: import_v43.z.string(),
682
- sources: import_v43.z.array(
683
- import_v43.z.object({
684
- type: import_v43.z.string().optional(),
685
- id: import_v43.z.string().optional(),
686
- document: import_v43.z.object({
687
- id: import_v43.z.string().optional(),
688
- text: import_v43.z.string(),
689
- title: import_v43.z.string()
690
- })
691
- })
692
- ),
693
- type: import_v43.z.string().optional()
694
- })
695
- ).nullish()
747
+ citations: import_v44.z.array(cohereCitationSchema).nullish()
696
748
  }),
697
- finish_reason: import_v43.z.string(),
698
- usage: import_v43.z.object({
699
- billed_units: import_v43.z.object({
700
- input_tokens: import_v43.z.number(),
701
- output_tokens: import_v43.z.number()
702
- }),
703
- tokens: import_v43.z.object({
704
- input_tokens: import_v43.z.number(),
705
- output_tokens: import_v43.z.number()
706
- })
707
- })
749
+ finish_reason: import_v44.z.string(),
750
+ usage: cohereUsageSchema().nullish()
708
751
  })
709
752
  )
710
753
  );
711
754
  var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
712
755
  () => (0, import_provider_utils4.zodSchema)(
713
- import_v43.z.discriminatedUnion("type", [
714
- import_v43.z.object({
715
- type: import_v43.z.literal("citation-start")
756
+ import_v44.z.discriminatedUnion("type", [
757
+ // `citation-start` events can arrive without citations, and a single
758
+ // citation may be sent instead of an array.
759
+ import_v44.z.object({
760
+ type: import_v44.z.literal("citation-start"),
761
+ index: import_v44.z.number().nullish(),
762
+ delta: import_v44.z.object({
763
+ message: import_v44.z.object({
764
+ citations: import_v44.z.union([cohereCitationSchema, import_v44.z.array(cohereCitationSchema)]).nullish()
765
+ }).nullish()
766
+ }).nullish()
716
767
  }),
717
- import_v43.z.object({
718
- type: import_v43.z.literal("citation-end")
768
+ import_v44.z.object({
769
+ type: import_v44.z.literal("citation-end")
719
770
  }),
720
- import_v43.z.object({
721
- type: import_v43.z.literal("content-start"),
722
- index: import_v43.z.number(),
723
- delta: import_v43.z.object({
724
- message: import_v43.z.object({
725
- content: import_v43.z.union([
726
- import_v43.z.object({
727
- type: import_v43.z.literal("text"),
728
- text: import_v43.z.string()
771
+ import_v44.z.object({
772
+ type: import_v44.z.literal("content-start"),
773
+ index: import_v44.z.number(),
774
+ delta: import_v44.z.object({
775
+ message: import_v44.z.object({
776
+ content: import_v44.z.union([
777
+ import_v44.z.object({
778
+ type: import_v44.z.literal("text"),
779
+ text: import_v44.z.string()
729
780
  }),
730
- import_v43.z.object({
731
- type: import_v43.z.literal("thinking"),
732
- thinking: import_v43.z.string()
781
+ import_v44.z.object({
782
+ type: import_v44.z.literal("thinking"),
783
+ thinking: import_v44.z.string()
733
784
  })
734
785
  ])
735
786
  })
736
787
  })
737
788
  }),
738
- import_v43.z.object({
739
- type: import_v43.z.literal("content-delta"),
740
- index: import_v43.z.number(),
741
- delta: import_v43.z.object({
742
- message: import_v43.z.object({
743
- content: import_v43.z.union([
744
- import_v43.z.object({
745
- text: import_v43.z.string()
789
+ import_v44.z.object({
790
+ type: import_v44.z.literal("content-delta"),
791
+ index: import_v44.z.number(),
792
+ delta: import_v44.z.object({
793
+ message: import_v44.z.object({
794
+ content: import_v44.z.union([
795
+ import_v44.z.object({
796
+ text: import_v44.z.string()
746
797
  }),
747
- import_v43.z.object({
748
- thinking: import_v43.z.string()
798
+ import_v44.z.object({
799
+ thinking: import_v44.z.string()
749
800
  })
750
801
  ])
751
802
  })
752
803
  })
753
804
  }),
754
- import_v43.z.object({
755
- type: import_v43.z.literal("content-end"),
756
- index: import_v43.z.number()
805
+ import_v44.z.object({
806
+ type: import_v44.z.literal("content-end"),
807
+ index: import_v44.z.number()
757
808
  }),
758
- import_v43.z.object({
759
- type: import_v43.z.literal("message-start"),
760
- id: import_v43.z.string().nullish()
809
+ import_v44.z.object({
810
+ type: import_v44.z.literal("message-start"),
811
+ id: import_v44.z.string().nullish()
761
812
  }),
762
- import_v43.z.object({
763
- type: import_v43.z.literal("message-end"),
764
- delta: import_v43.z.object({
765
- finish_reason: import_v43.z.string(),
766
- usage: import_v43.z.object({
767
- tokens: import_v43.z.object({
768
- input_tokens: import_v43.z.number(),
769
- output_tokens: import_v43.z.number()
770
- })
771
- })
813
+ import_v44.z.object({
814
+ type: import_v44.z.literal("message-end"),
815
+ delta: import_v44.z.object({
816
+ finish_reason: import_v44.z.string(),
817
+ usage: cohereUsageSchema().nullish()
772
818
  })
773
819
  }),
774
820
  // https://docs.cohere.com/v2/docs/streaming#tool-use-stream-events-for-tool-calling
775
- import_v43.z.object({
776
- type: import_v43.z.literal("tool-plan-delta"),
777
- delta: import_v43.z.object({
778
- message: import_v43.z.object({
779
- tool_plan: import_v43.z.string()
821
+ import_v44.z.object({
822
+ type: import_v44.z.literal("tool-plan-delta"),
823
+ delta: import_v44.z.object({
824
+ message: import_v44.z.object({
825
+ tool_plan: import_v44.z.string()
780
826
  })
781
827
  })
782
828
  }),
783
- import_v43.z.object({
784
- type: import_v43.z.literal("tool-call-start"),
785
- delta: import_v43.z.object({
786
- message: import_v43.z.object({
787
- tool_calls: import_v43.z.object({
788
- id: import_v43.z.string(),
789
- type: import_v43.z.literal("function"),
790
- function: import_v43.z.object({
791
- name: import_v43.z.string(),
792
- arguments: import_v43.z.string()
829
+ import_v44.z.object({
830
+ type: import_v44.z.literal("tool-call-start"),
831
+ delta: import_v44.z.object({
832
+ message: import_v44.z.object({
833
+ tool_calls: import_v44.z.object({
834
+ id: import_v44.z.string(),
835
+ type: import_v44.z.literal("function"),
836
+ function: import_v44.z.object({
837
+ name: import_v44.z.string(),
838
+ arguments: import_v44.z.string()
793
839
  })
794
840
  })
795
841
  })
@@ -798,20 +844,20 @@ var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
798
844
  // A single tool call's `arguments` stream in chunks and must be accumulated
799
845
  // in a string and so the full tool object info can only be parsed once we see
800
846
  // `tool-call-end`.
801
- import_v43.z.object({
802
- type: import_v43.z.literal("tool-call-delta"),
803
- delta: import_v43.z.object({
804
- message: import_v43.z.object({
805
- tool_calls: import_v43.z.object({
806
- function: import_v43.z.object({
807
- arguments: import_v43.z.string()
847
+ import_v44.z.object({
848
+ type: import_v44.z.literal("tool-call-delta"),
849
+ delta: import_v44.z.object({
850
+ message: import_v44.z.object({
851
+ tool_calls: import_v44.z.object({
852
+ function: import_v44.z.object({
853
+ arguments: import_v44.z.string()
808
854
  })
809
855
  })
810
856
  })
811
857
  })
812
858
  }),
813
- import_v43.z.object({
814
- type: import_v43.z.literal("tool-call-end")
859
+ import_v44.z.object({
860
+ type: import_v44.z.literal("tool-call-end")
815
861
  })
816
862
  ])
817
863
  )
@@ -820,14 +866,14 @@ var cohereChatChunkSchema = (0, import_provider_utils4.lazySchema)(
820
866
  // src/cohere-embedding-model.ts
821
867
  var import_provider3 = require("@ai-sdk/provider");
822
868
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
823
- var import_v45 = require("zod/v4");
869
+ var import_v46 = require("zod/v4");
824
870
 
825
871
  // src/cohere-embedding-options.ts
826
872
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
827
- var import_v44 = require("zod/v4");
873
+ var import_v45 = require("zod/v4");
828
874
  var cohereEmbeddingOptions = (0, import_provider_utils5.lazySchema)(
829
875
  () => (0, import_provider_utils5.zodSchema)(
830
- import_v44.z.object({
876
+ import_v45.z.object({
831
877
  /**
832
878
  * Specifies the type of input passed to the model. Default is `search_query`.
833
879
  *
@@ -836,7 +882,7 @@ var cohereEmbeddingOptions = (0, import_provider_utils5.lazySchema)(
836
882
  * - "classification": Used for embeddings passed through a text classifier.
837
883
  * - "clustering": Used for embeddings run through a clustering algorithm.
838
884
  */
839
- inputType: import_v44.z.enum([
885
+ inputType: import_v45.z.enum([
840
886
  "search_document",
841
887
  "search_query",
842
888
  "classification",
@@ -850,7 +896,7 @@ var cohereEmbeddingOptions = (0, import_provider_utils5.lazySchema)(
850
896
  * - "START": Will discard the start of the input until the remaining input is exactly the maximum input token length for the model.
851
897
  * - "END": Will discard the end of the input until the remaining input is exactly the maximum input token length for the model.
852
898
  */
853
- truncate: import_v44.z.enum(["NONE", "START", "END"]).optional()
899
+ truncate: import_v45.z.enum(["NONE", "START", "END"]).optional()
854
900
  })
855
901
  )
856
902
  );
@@ -920,13 +966,13 @@ var CohereEmbeddingModel = class {
920
966
  };
921
967
  var cohereTextEmbeddingResponseSchema = (0, import_provider_utils6.lazySchema)(
922
968
  () => (0, import_provider_utils6.zodSchema)(
923
- import_v45.z.object({
924
- embeddings: import_v45.z.object({
925
- float: import_v45.z.array(import_v45.z.array(import_v45.z.number()))
969
+ import_v46.z.object({
970
+ embeddings: import_v46.z.object({
971
+ float: import_v46.z.array(import_v46.z.array(import_v46.z.number()))
926
972
  }),
927
- meta: import_v45.z.object({
928
- billed_units: import_v45.z.object({
929
- input_tokens: import_v45.z.number()
973
+ meta: import_v46.z.object({
974
+ billed_units: import_v46.z.object({
975
+ input_tokens: import_v46.z.number()
930
976
  })
931
977
  })
932
978
  })
@@ -934,7 +980,7 @@ var cohereTextEmbeddingResponseSchema = (0, import_provider_utils6.lazySchema)(
934
980
  );
935
981
 
936
982
  // src/version.ts
937
- var VERSION = true ? "2.0.48" : "0.0.0-test";
983
+ var VERSION = true ? "2.0.49" : "0.0.0-test";
938
984
 
939
985
  // src/cohere-provider.ts
940
986
  function createCohere(options = {}) {