@ai-sdk/open-responses 0.0.0-b66d09a8-20260328011513
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 +149 -0
- package/LICENSE +13 -0
- package/README.md +57 -0
- package/dist/index.d.mts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +642 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +628 -0
- package/dist/index.mjs.map +1 -0
- package/docs/06-open-responses.mdx +99 -0
- package/package.json +74 -0
- package/src/index.ts +2 -0
- package/src/open-responses-provider.ts +100 -0
- package/src/responses/convert-to-open-responses-input.ts +206 -0
- package/src/responses/map-open-responses-finish-reason.ts +21 -0
- package/src/responses/open-responses-api.ts +1239 -0
- package/src/responses/open-responses-config.ts +9 -0
- package/src/responses/open-responses-language-model.ts +523 -0
- package/src/version.ts +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# @ai-sdk/open-responses
|
|
2
|
+
|
|
3
|
+
## 0.0.0-b66d09a8-20260328011513
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 8359612: Start v7 pre-release
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
12
|
+
- 8831e80: chore(provider/open-responses): update provider to use v4 types
|
|
13
|
+
- Updated dependencies [531251e]
|
|
14
|
+
- Updated dependencies [1f509d4]
|
|
15
|
+
- Updated dependencies [5c2a5a2]
|
|
16
|
+
- Updated dependencies [f7d4f01]
|
|
17
|
+
- Updated dependencies [776b617]
|
|
18
|
+
- Updated dependencies [3887c70]
|
|
19
|
+
- Updated dependencies [61753c3]
|
|
20
|
+
- Updated dependencies [8359612]
|
|
21
|
+
- @ai-sdk/provider-utils@0.0.0-b66d09a8-20260328011513
|
|
22
|
+
- @ai-sdk/provider@0.0.0-b66d09a8-20260328011513
|
|
23
|
+
|
|
24
|
+
## 2.0.0-beta.9
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [1f509d4]
|
|
29
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
30
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
31
|
+
|
|
32
|
+
## 2.0.0-beta.8
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
|
|
37
|
+
|
|
38
|
+
## 2.0.0-beta.7
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [3887c70]
|
|
43
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
44
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
45
|
+
|
|
46
|
+
## 2.0.0-beta.6
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [776b617]
|
|
51
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
52
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
53
|
+
|
|
54
|
+
## 2.0.0-beta.5
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [61753c3]
|
|
59
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
60
|
+
|
|
61
|
+
## 2.0.0-beta.4
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [f7d4f01]
|
|
66
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
67
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
68
|
+
|
|
69
|
+
## 2.0.0-beta.3
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [5c2a5a2]
|
|
74
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
75
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
76
|
+
|
|
77
|
+
## 2.0.0-beta.2
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- 8831e80: chore(provider/open-responses): update provider to use v4 types
|
|
82
|
+
|
|
83
|
+
## 2.0.0-beta.1
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [531251e]
|
|
88
|
+
- @ai-sdk/provider-utils@5.0.0-beta.1
|
|
89
|
+
|
|
90
|
+
## 2.0.0-beta.0
|
|
91
|
+
|
|
92
|
+
### Major Changes
|
|
93
|
+
|
|
94
|
+
- 8359612: Start v7 pre-release
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [8359612]
|
|
99
|
+
- @ai-sdk/provider@4.0.0-beta.0
|
|
100
|
+
- @ai-sdk/provider-utils@5.0.0-beta.0
|
|
101
|
+
|
|
102
|
+
## 1.0.6
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [ad4cfc2]
|
|
107
|
+
- @ai-sdk/provider-utils@4.0.19
|
|
108
|
+
|
|
109
|
+
## 1.0.5
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [824b295]
|
|
114
|
+
- @ai-sdk/provider-utils@4.0.18
|
|
115
|
+
|
|
116
|
+
## 1.0.4
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- Updated dependencies [08336f1]
|
|
121
|
+
- @ai-sdk/provider-utils@4.0.17
|
|
122
|
+
|
|
123
|
+
## 1.0.3
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [58bc42d]
|
|
128
|
+
- @ai-sdk/provider-utils@4.0.16
|
|
129
|
+
|
|
130
|
+
## 1.0.2
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [4024a3a]
|
|
135
|
+
- @ai-sdk/provider-utils@4.0.15
|
|
136
|
+
|
|
137
|
+
## 1.0.1
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [7168375]
|
|
142
|
+
- @ai-sdk/provider@3.0.8
|
|
143
|
+
- @ai-sdk/provider-utils@4.0.14
|
|
144
|
+
|
|
145
|
+
## 1.0.0
|
|
146
|
+
|
|
147
|
+
### Major Changes
|
|
148
|
+
|
|
149
|
+
- 8a4f19d: feat(open-responses): add Open Responses provider
|
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2023 Vercel, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# AI SDK - Open Responses Provider
|
|
2
|
+
|
|
3
|
+
The **[Open Responses provider](https://ai-sdk.dev/providers/ai-sdk-providers/open-responses)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
|
+
contains language model support for [Open Responses](https://www.openresponses.org/) compatible APIs.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
The Open Responses provider is available in the `@ai-sdk/open-responses` module. You can install it with
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i @ai-sdk/open-responses
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Skill for Coding Agents
|
|
15
|
+
|
|
16
|
+
If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
npx skills add vercel/ai
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Provider Instance
|
|
23
|
+
|
|
24
|
+
Create an Open Responses provider instance using `createOpenResponses`:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { createOpenResponses } from '@ai-sdk/open-responses';
|
|
28
|
+
|
|
29
|
+
const openResponses = createOpenResponses({
|
|
30
|
+
name: 'aProvider',
|
|
31
|
+
url: 'http://localhost:1234/v1/responses',
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You can use this instance to access models served by any Open Responses compatible endpoint.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { createOpenResponses } from '@ai-sdk/open-responses';
|
|
41
|
+
import { generateText } from 'ai';
|
|
42
|
+
|
|
43
|
+
const openResponses = createOpenResponses({
|
|
44
|
+
name: 'aProvider',
|
|
45
|
+
url: 'http://localhost:1234/v1/responses',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { text } = await generateText({
|
|
49
|
+
model: openResponses('mistralai/ministral-3-14b-reasoning'),
|
|
50
|
+
prompt: 'Invent a new holiday and describe its traditions.',
|
|
51
|
+
maxOutputTokens: 100,
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Please check out the **[Open Responses provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/open-responses)** for more information.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
|
|
4
|
+
declare const VERSION: string;
|
|
5
|
+
|
|
6
|
+
interface OpenResponsesProvider extends ProviderV4 {
|
|
7
|
+
(modelId: string): LanguageModelV4;
|
|
8
|
+
}
|
|
9
|
+
interface OpenResponsesProviderSettings {
|
|
10
|
+
/**
|
|
11
|
+
* URL for the Open Responses API POST endpoint.
|
|
12
|
+
*/
|
|
13
|
+
url: string;
|
|
14
|
+
/**
|
|
15
|
+
* Provider name. Used as key for provider options and metadata.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* API key for authenticating requests.
|
|
20
|
+
*/
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Custom headers to include in the requests.
|
|
24
|
+
*/
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
28
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
29
|
+
*/
|
|
30
|
+
fetch?: FetchFunction;
|
|
31
|
+
}
|
|
32
|
+
declare function createOpenResponses(options: OpenResponsesProviderSettings): OpenResponsesProvider;
|
|
33
|
+
|
|
34
|
+
export { VERSION, createOpenResponses };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
|
|
4
|
+
declare const VERSION: string;
|
|
5
|
+
|
|
6
|
+
interface OpenResponsesProvider extends ProviderV4 {
|
|
7
|
+
(modelId: string): LanguageModelV4;
|
|
8
|
+
}
|
|
9
|
+
interface OpenResponsesProviderSettings {
|
|
10
|
+
/**
|
|
11
|
+
* URL for the Open Responses API POST endpoint.
|
|
12
|
+
*/
|
|
13
|
+
url: string;
|
|
14
|
+
/**
|
|
15
|
+
* Provider name. Used as key for provider options and metadata.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* API key for authenticating requests.
|
|
20
|
+
*/
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Custom headers to include in the requests.
|
|
24
|
+
*/
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
28
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
29
|
+
*/
|
|
30
|
+
fetch?: FetchFunction;
|
|
31
|
+
}
|
|
32
|
+
declare function createOpenResponses(options: OpenResponsesProviderSettings): OpenResponsesProvider;
|
|
33
|
+
|
|
34
|
+
export { VERSION, createOpenResponses };
|