@ai-sdk/vercel 2.0.0-beta.60 → 2.0.1
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 +62 -163
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @ai-sdk/vercel
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [29264a3]
|
|
8
|
+
- @ai-sdk/provider-utils@4.0.1
|
|
9
|
+
- @ai-sdk/openai-compatible@2.0.1
|
|
10
|
+
|
|
11
|
+
## 2.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- dee8b05: ai SDK 6 beta
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 78928cb: release: start 5.1 beta
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 0c3b58b: fix(provider): add specificationVersion to ProviderV3
|
|
24
|
+
- 8d9e8ad: chore(provider): remove generics from EmbeddingModelV3
|
|
25
|
+
|
|
26
|
+
Before
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
model.textEmbeddingModel('my-model-id');
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
After
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
model.embeddingModel('my-model-id');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- ed329cb: feat: `Provider-V3`
|
|
39
|
+
- 1cad0ab: feat: add provider version to user-agent header
|
|
40
|
+
- 8dac895: feat: `LanguageModelV3`
|
|
41
|
+
- 366f50b: chore(provider): add deprecated textEmbeddingModel and textEmbedding aliases
|
|
42
|
+
- 4616b86: chore: update zod peer depenedency version
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- @ai-sdk/openai-compatible@2.0.0
|
|
45
|
+
- @ai-sdk/provider@3.0.0
|
|
46
|
+
- @ai-sdk/provider-utils@4.0.0
|
|
47
|
+
|
|
3
48
|
## 2.0.0-beta.60
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
|
@@ -437,8 +482,7 @@
|
|
|
437
482
|
|
|
438
483
|
### Patch Changes
|
|
439
484
|
|
|
440
|
-
- Updated dependencies
|
|
441
|
-
- Updated dependencies [95f65c2]
|
|
485
|
+
- Updated dependencies
|
|
442
486
|
- @ai-sdk/openai-compatible@2.0.0-beta.11
|
|
443
487
|
- @ai-sdk/provider-utils@4.0.0-beta.11
|
|
444
488
|
|
|
@@ -475,8 +519,7 @@
|
|
|
475
519
|
|
|
476
520
|
### Patch Changes
|
|
477
521
|
|
|
478
|
-
- Updated dependencies
|
|
479
|
-
- Updated dependencies [e8109d3]
|
|
522
|
+
- Updated dependencies
|
|
480
523
|
- @ai-sdk/provider@2.1.0-beta.5
|
|
481
524
|
- @ai-sdk/openai-compatible@1.1.0-beta.7
|
|
482
525
|
- @ai-sdk/provider-utils@3.1.0-beta.7
|
|
@@ -485,8 +528,7 @@
|
|
|
485
528
|
|
|
486
529
|
### Patch Changes
|
|
487
530
|
|
|
488
|
-
- Updated dependencies
|
|
489
|
-
- Updated dependencies [2b0caef]
|
|
531
|
+
- Updated dependencies
|
|
490
532
|
- @ai-sdk/openai-compatible@1.1.0-beta.6
|
|
491
533
|
- @ai-sdk/provider-utils@3.1.0-beta.6
|
|
492
534
|
- @ai-sdk/provider@2.1.0-beta.4
|
|
@@ -496,8 +538,7 @@
|
|
|
496
538
|
### Patch Changes
|
|
497
539
|
|
|
498
540
|
- 8dac895: feat: `LanguageModelV3`
|
|
499
|
-
- Updated dependencies
|
|
500
|
-
- Updated dependencies [10c1322]
|
|
541
|
+
- Updated dependencies
|
|
501
542
|
- @ai-sdk/openai-compatible@1.1.0-beta.5
|
|
502
543
|
- @ai-sdk/provider-utils@3.1.0-beta.5
|
|
503
544
|
- @ai-sdk/provider@2.1.0-beta.3
|
|
@@ -516,8 +557,7 @@
|
|
|
516
557
|
### Patch Changes
|
|
517
558
|
|
|
518
559
|
- ed329cb: feat: `Provider-V3`
|
|
519
|
-
- Updated dependencies
|
|
520
|
-
- Updated dependencies [522f6b8]
|
|
560
|
+
- Updated dependencies
|
|
521
561
|
- @ai-sdk/openai-compatible@1.1.0-beta.3
|
|
522
562
|
- @ai-sdk/provider@2.1.0-beta.2
|
|
523
563
|
- @ai-sdk/provider-utils@3.1.0-beta.3
|
|
@@ -640,8 +680,7 @@
|
|
|
640
680
|
|
|
641
681
|
### Patch Changes
|
|
642
682
|
|
|
643
|
-
- Updated dependencies
|
|
644
|
-
- Updated dependencies [f25040d]
|
|
683
|
+
- Updated dependencies
|
|
645
684
|
- @ai-sdk/provider-utils@3.0.3
|
|
646
685
|
- @ai-sdk/openai-compatible@1.0.7
|
|
647
686
|
|
|
@@ -657,16 +696,14 @@
|
|
|
657
696
|
|
|
658
697
|
### Patch Changes
|
|
659
698
|
|
|
660
|
-
- Updated dependencies
|
|
661
|
-
- Updated dependencies [e92b78b]
|
|
699
|
+
- Updated dependencies
|
|
662
700
|
- @ai-sdk/openai-compatible@1.0.5
|
|
663
701
|
|
|
664
702
|
## 1.0.4
|
|
665
703
|
|
|
666
704
|
### Patch Changes
|
|
667
705
|
|
|
668
|
-
- Updated dependencies
|
|
669
|
-
- Updated dependencies [da314cd]
|
|
706
|
+
- Updated dependencies
|
|
670
707
|
- @ai-sdk/openai-compatible@1.0.4
|
|
671
708
|
|
|
672
709
|
## 1.0.3
|
|
@@ -680,8 +717,7 @@
|
|
|
680
717
|
|
|
681
718
|
### Patch Changes
|
|
682
719
|
|
|
683
|
-
- Updated dependencies
|
|
684
|
-
- Updated dependencies [90d212f]
|
|
720
|
+
- Updated dependencies
|
|
685
721
|
- @ai-sdk/openai-compatible@1.0.2
|
|
686
722
|
- @ai-sdk/provider-utils@3.0.1
|
|
687
723
|
|
|
@@ -700,120 +736,7 @@
|
|
|
700
736
|
- e2aceaf: feat: add raw chunk support
|
|
701
737
|
- 9eb5417: feat (providers/vercel): initial vercel provider
|
|
702
738
|
- 205077b: fix: improve Zod compatibility
|
|
703
|
-
- Updated dependencies
|
|
704
|
-
- Updated dependencies [742b7be]
|
|
705
|
-
- Updated dependencies [e7fcc86]
|
|
706
|
-
- Updated dependencies [7cddb72]
|
|
707
|
-
- Updated dependencies [ccce59b]
|
|
708
|
-
- Updated dependencies [e2b9e4b]
|
|
709
|
-
- Updated dependencies [95857aa]
|
|
710
|
-
- Updated dependencies [45c1ea2]
|
|
711
|
-
- Updated dependencies [6f6bb89]
|
|
712
|
-
- Updated dependencies [060370c]
|
|
713
|
-
- Updated dependencies [dc714f3]
|
|
714
|
-
- Updated dependencies [b5da06a]
|
|
715
|
-
- Updated dependencies [d1a1aa1]
|
|
716
|
-
- Updated dependencies [63f9e9b]
|
|
717
|
-
- Updated dependencies [5d142ab]
|
|
718
|
-
- Updated dependencies [d5f588f]
|
|
719
|
-
- Updated dependencies [e025824]
|
|
720
|
-
- Updated dependencies [0571b98]
|
|
721
|
-
- Updated dependencies [6db02c9]
|
|
722
|
-
- Updated dependencies [b6b43c7]
|
|
723
|
-
- Updated dependencies [4fef487]
|
|
724
|
-
- Updated dependencies [48d257a]
|
|
725
|
-
- Updated dependencies [0c0c0b3]
|
|
726
|
-
- Updated dependencies [0d2c085]
|
|
727
|
-
- Updated dependencies [fa49207]
|
|
728
|
-
- Updated dependencies [40acf9b]
|
|
729
|
-
- Updated dependencies [cf8280e]
|
|
730
|
-
- Updated dependencies [9222aeb]
|
|
731
|
-
- Updated dependencies [b9a6121]
|
|
732
|
-
- Updated dependencies [e2aceaf]
|
|
733
|
-
- Updated dependencies [411e483]
|
|
734
|
-
- Updated dependencies [8ba77a7]
|
|
735
|
-
- Updated dependencies [db72adc]
|
|
736
|
-
- Updated dependencies [7b3ae3f]
|
|
737
|
-
- Updated dependencies [a166433]
|
|
738
|
-
- Updated dependencies [26735b5]
|
|
739
|
-
- Updated dependencies [443d8ec]
|
|
740
|
-
- Updated dependencies [42e32b0]
|
|
741
|
-
- Updated dependencies [a8c8bd5]
|
|
742
|
-
- Updated dependencies [abf9a79]
|
|
743
|
-
- Updated dependencies [14c9410]
|
|
744
|
-
- Updated dependencies [e86be6f]
|
|
745
|
-
- Updated dependencies [9bf7291]
|
|
746
|
-
- Updated dependencies [2e13791]
|
|
747
|
-
- Updated dependencies [7b069ed]
|
|
748
|
-
- Updated dependencies [9f95b35]
|
|
749
|
-
- Updated dependencies [66962ed]
|
|
750
|
-
- Updated dependencies [0d06df6]
|
|
751
|
-
- Updated dependencies [472524a]
|
|
752
|
-
- Updated dependencies [dd3ff01]
|
|
753
|
-
- Updated dependencies [d9209ca]
|
|
754
|
-
- Updated dependencies [d9c98f4]
|
|
755
|
-
- Updated dependencies [05d2819]
|
|
756
|
-
- Updated dependencies [9301f86]
|
|
757
|
-
- Updated dependencies [0a87932]
|
|
758
|
-
- Updated dependencies [737f1e2]
|
|
759
|
-
- Updated dependencies [c4a2fec]
|
|
760
|
-
- Updated dependencies [957b739]
|
|
761
|
-
- Updated dependencies [79457bd]
|
|
762
|
-
- Updated dependencies [a3f768e]
|
|
763
|
-
- Updated dependencies [7435eb5]
|
|
764
|
-
- Updated dependencies [8aa9e20]
|
|
765
|
-
- Updated dependencies [4617fab]
|
|
766
|
-
- Updated dependencies [516be5b]
|
|
767
|
-
- Updated dependencies [ac34802]
|
|
768
|
-
- Updated dependencies [0054544]
|
|
769
|
-
- Updated dependencies [cb68df0]
|
|
770
|
-
- Updated dependencies [ad80501]
|
|
771
|
-
- Updated dependencies [68ecf2f]
|
|
772
|
-
- Updated dependencies [9e9c809]
|
|
773
|
-
- Updated dependencies [32831c6]
|
|
774
|
-
- Updated dependencies [6dc848c]
|
|
775
|
-
- Updated dependencies [6b98118]
|
|
776
|
-
- Updated dependencies [d0f9495]
|
|
777
|
-
- Updated dependencies [63d791d]
|
|
778
|
-
- Updated dependencies [87b828f]
|
|
779
|
-
- Updated dependencies [3f2f00c]
|
|
780
|
-
- Updated dependencies [bfdca8d]
|
|
781
|
-
- Updated dependencies [0ff02bb]
|
|
782
|
-
- Updated dependencies [7979f7f]
|
|
783
|
-
- Updated dependencies [39a4fab]
|
|
784
|
-
- Updated dependencies [44f4aba]
|
|
785
|
-
- Updated dependencies [9bd5ab5]
|
|
786
|
-
- Updated dependencies [57edfcb]
|
|
787
|
-
- Updated dependencies [faf8446]
|
|
788
|
-
- Updated dependencies [7ea4132]
|
|
789
|
-
- Updated dependencies [d1a034f]
|
|
790
|
-
- Updated dependencies [5c56081]
|
|
791
|
-
- Updated dependencies [fd65bc6]
|
|
792
|
-
- Updated dependencies [023ba40]
|
|
793
|
-
- Updated dependencies [ea7a7c9]
|
|
794
|
-
- Updated dependencies [1b101e1]
|
|
795
|
-
- Updated dependencies [26535e0]
|
|
796
|
-
- Updated dependencies [e030615]
|
|
797
|
-
- Updated dependencies [5e57fae]
|
|
798
|
-
- Updated dependencies [393138b]
|
|
799
|
-
- Updated dependencies [c57e248]
|
|
800
|
-
- Updated dependencies [88a8ee5]
|
|
801
|
-
- Updated dependencies [41fa418]
|
|
802
|
-
- Updated dependencies [205077b]
|
|
803
|
-
- Updated dependencies [71f938d]
|
|
804
|
-
- Updated dependencies [3795467]
|
|
805
|
-
- Updated dependencies [28a5ed5]
|
|
806
|
-
- Updated dependencies [7182d14]
|
|
807
|
-
- Updated dependencies [c1e6647]
|
|
808
|
-
- Updated dependencies [1766ede]
|
|
809
|
-
- Updated dependencies [811dff3]
|
|
810
|
-
- Updated dependencies [f10304b]
|
|
811
|
-
- Updated dependencies [dd5fd43]
|
|
812
|
-
- Updated dependencies [33f4a6a]
|
|
813
|
-
- Updated dependencies [383cbfa]
|
|
814
|
-
- Updated dependencies [27deb4d]
|
|
815
|
-
- Updated dependencies [c4df419]
|
|
816
|
-
- Updated dependencies [281bb1c]
|
|
739
|
+
- Updated dependencies
|
|
817
740
|
- @ai-sdk/provider-utils@3.0.0
|
|
818
741
|
- @ai-sdk/provider@2.0.0
|
|
819
742
|
- @ai-sdk/openai-compatible@1.0.0
|
|
@@ -855,8 +778,7 @@
|
|
|
855
778
|
|
|
856
779
|
### Patch Changes
|
|
857
780
|
|
|
858
|
-
- Updated dependencies
|
|
859
|
-
- Updated dependencies [ac34802]
|
|
781
|
+
- Updated dependencies
|
|
860
782
|
- @ai-sdk/openai-compatible@1.0.0-beta.9
|
|
861
783
|
- @ai-sdk/provider-utils@3.0.0-beta.6
|
|
862
784
|
|
|
@@ -870,8 +792,7 @@
|
|
|
870
792
|
|
|
871
793
|
### Patch Changes
|
|
872
794
|
|
|
873
|
-
- Updated dependencies
|
|
874
|
-
- Updated dependencies [383cbfa]
|
|
795
|
+
- Updated dependencies
|
|
875
796
|
- @ai-sdk/provider-utils@3.0.0-beta.5
|
|
876
797
|
- @ai-sdk/openai-compatible@1.0.0-beta.8
|
|
877
798
|
|
|
@@ -917,9 +838,7 @@
|
|
|
917
838
|
|
|
918
839
|
### Patch Changes
|
|
919
840
|
|
|
920
|
-
- Updated dependencies
|
|
921
|
-
- Updated dependencies [39a4fab]
|
|
922
|
-
- Updated dependencies [d1a034f]
|
|
841
|
+
- Updated dependencies
|
|
923
842
|
- @ai-sdk/provider-utils@3.0.0-beta.2
|
|
924
843
|
- @ai-sdk/openai-compatible@1.0.0-beta.2
|
|
925
844
|
|
|
@@ -927,23 +846,7 @@
|
|
|
927
846
|
|
|
928
847
|
### Patch Changes
|
|
929
848
|
|
|
930
|
-
- Updated dependencies
|
|
931
|
-
- Updated dependencies [7cddb72]
|
|
932
|
-
- Updated dependencies [ccce59b]
|
|
933
|
-
- Updated dependencies [e2b9e4b]
|
|
934
|
-
- Updated dependencies [45c1ea2]
|
|
935
|
-
- Updated dependencies [e025824]
|
|
936
|
-
- Updated dependencies [0d06df6]
|
|
937
|
-
- Updated dependencies [472524a]
|
|
938
|
-
- Updated dependencies [dd3ff01]
|
|
939
|
-
- Updated dependencies [7435eb5]
|
|
940
|
-
- Updated dependencies [cb68df0]
|
|
941
|
-
- Updated dependencies [bfdca8d]
|
|
942
|
-
- Updated dependencies [44f4aba]
|
|
943
|
-
- Updated dependencies [023ba40]
|
|
944
|
-
- Updated dependencies [5e57fae]
|
|
945
|
-
- Updated dependencies [71f938d]
|
|
946
|
-
- Updated dependencies [28a5ed5]
|
|
849
|
+
- Updated dependencies
|
|
947
850
|
- @ai-sdk/provider@2.0.0-beta.1
|
|
948
851
|
- @ai-sdk/provider-utils@3.0.0-beta.1
|
|
949
852
|
- @ai-sdk/openai-compatible@1.0.0-beta.1
|
|
@@ -952,8 +855,7 @@
|
|
|
952
855
|
|
|
953
856
|
### Patch Changes
|
|
954
857
|
|
|
955
|
-
- Updated dependencies
|
|
956
|
-
- Updated dependencies [8ba77a7]
|
|
858
|
+
- Updated dependencies
|
|
957
859
|
- @ai-sdk/provider@2.0.0-alpha.15
|
|
958
860
|
- @ai-sdk/provider-utils@3.0.0-alpha.15
|
|
959
861
|
- @ai-sdk/openai-compatible@1.0.0-alpha.15
|
|
@@ -962,9 +864,7 @@
|
|
|
962
864
|
|
|
963
865
|
### Patch Changes
|
|
964
866
|
|
|
965
|
-
- Updated dependencies
|
|
966
|
-
- Updated dependencies [63f9e9b]
|
|
967
|
-
- Updated dependencies [2e13791]
|
|
867
|
+
- Updated dependencies
|
|
968
868
|
- @ai-sdk/provider@2.0.0-alpha.14
|
|
969
869
|
- @ai-sdk/openai-compatible@1.0.0-alpha.14
|
|
970
870
|
- @ai-sdk/provider-utils@3.0.0-alpha.14
|
|
@@ -1019,8 +919,7 @@
|
|
|
1019
919
|
|
|
1020
920
|
### Patch Changes
|
|
1021
921
|
|
|
1022
|
-
- Updated dependencies
|
|
1023
|
-
- Updated dependencies [9222aeb]
|
|
922
|
+
- Updated dependencies
|
|
1024
923
|
- @ai-sdk/provider-utils@3.0.0-alpha.8
|
|
1025
924
|
- @ai-sdk/provider@2.0.0-alpha.8
|
|
1026
925
|
- @ai-sdk/openai-compatible@1.0.0-alpha.8
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
|
32
32
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "2.0.
|
|
35
|
+
var VERSION = true ? "2.0.1" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/vercel-provider.ts
|
|
38
38
|
function createVercel(options = {}) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["export { createVercel, vercel } from './vercel-provider';\nexport type { VercelProvider, VercelProviderSettings } from './vercel-provider';\nexport type { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';\nexport { VERSION } from './version';\n","import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\nVercel API key.\n*/\n apiKey?: string;\n /**\nBase URL for the API calls.\n*/\n baseURL?: string;\n /**\nCustom headers to include in the requests.\n*/\n headers?: Record<string, string>;\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n*/\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: VercelChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation.\n*/\n languageModel(modelId: VercelChatModelId): LanguageModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAIO;AACP,+BAAkD;AAClD,4BAKO;;;ACTA,IAAM,UACX,OACI,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["export { createVercel, vercel } from './vercel-provider';\nexport type { VercelProvider, VercelProviderSettings } from './vercel-provider';\nexport type { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';\nexport { VERSION } from './version';\n","import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\nVercel API key.\n*/\n apiKey?: string;\n /**\nBase URL for the API calls.\n*/\n baseURL?: string;\n /**\nCustom headers to include in the requests.\n*/\n headers?: Record<string, string>;\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n*/\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: VercelChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation.\n*/\n languageModel(modelId: VercelChatModelId): LanguageModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAIO;AACP,+BAAkD;AAClD,4BAKO;;;ACTA,IAAM,UACX,OACI,UACA;;;AD+CC,SAAS,aACd,UAAkC,CAAC,GACnB;AAtDlB;AAuDE,QAAM,cAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,UACjB;AAAA,IACE;AAAA,MACE,eAAe,cAAU,kCAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,iBAAiB,OAAO;AAAA,EAC1B;AASF,QAAM,uBAAuB,CAAC,eAA0C;AAAA,IACtE,UAAU,UAAU,SAAS;AAAA,IAC7B,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,IACpC,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB;AAEA,QAAM,kBAAkB,CAAC,YAA+B;AACtD,WAAO,IAAI,2DAAkC,SAAS;AAAA,MACpD,GAAG,qBAAqB,MAAM;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA+B,gBAAgB,OAAO;AAExE,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\nVercel API key.\n*/\n apiKey?: string;\n /**\nBase URL for the API calls.\n*/\n baseURL?: string;\n /**\nCustom headers to include in the requests.\n*/\n headers?: Record<string, string>;\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n*/\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: VercelChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation.\n*/\n languageModel(modelId: VercelChatModelId): LanguageModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTA,IAAM,UACX,OACI,
|
|
1
|
+
{"version":3,"sources":["../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\nVercel API key.\n*/\n apiKey?: string;\n /**\nBase URL for the API calls.\n*/\n baseURL?: string;\n /**\nCustom headers to include in the requests.\n*/\n headers?: Record<string, string>;\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n*/\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV3 {\n /**\nCreates a model for text generation.\n*/\n (modelId: VercelChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation.\n*/\n languageModel(modelId: VercelChatModelId): LanguageModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v3' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTA,IAAM,UACX,OACI,UACA;;;AD+CC,SAAS,aACd,UAAkC,CAAC,GACnB;AAtDlB;AAuDE,QAAM,UAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,MACjB;AAAA,IACE;AAAA,MACE,eAAe,UAAU,WAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,iBAAiB,OAAO;AAAA,EAC1B;AASF,QAAM,uBAAuB,CAAC,eAA0C;AAAA,IACtE,UAAU,UAAU,SAAS;AAAA,IAC7B,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,IACpC,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB;AAEA,QAAM,kBAAkB,CAAC,YAA+B;AACtD,WAAO,IAAI,kCAAkC,SAAS;AAAA,MACpD,GAAG,qBAAqB,MAAM;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA+B,gBAAgB,OAAO;AAExE,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/vercel",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@ai-sdk/openai-compatible": "2.0.
|
|
24
|
-
"@ai-sdk/provider": "3.0.0
|
|
25
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
23
|
+
"@ai-sdk/openai-compatible": "2.0.1",
|
|
24
|
+
"@ai-sdk/provider": "3.0.0",
|
|
25
|
+
"@ai-sdk/provider-utils": "4.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "20.17.24",
|