@anthropic-ai/sdk 0.5.10 → 0.6.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +49 -21
  3. package/_shims/ReadableStream.d.ts +38 -0
  4. package/_shims/ReadableStream.js +5 -0
  5. package/_shims/ReadableStream.mjs +7 -0
  6. package/_shims/ReadableStream.node.d.ts +6 -0
  7. package/_shims/ReadableStream.node.d.ts.map +1 -0
  8. package/_shims/ReadableStream.node.js +14 -0
  9. package/_shims/ReadableStream.node.js.map +1 -0
  10. package/_shims/ReadableStream.node.mjs +3 -0
  11. package/_shims/ReadableStream.node.mjs.map +1 -0
  12. package/_shims/fetch.d.ts +8 -1
  13. package/_shims/fetch.node.d.ts +11 -1
  14. package/_shims/formdata.js +9 -1
  15. package/_shims/formdata.mjs +10 -1
  16. package/core.d.ts +78 -29
  17. package/core.d.ts.map +1 -1
  18. package/core.js +191 -67
  19. package/core.js.map +1 -1
  20. package/core.mjs +185 -67
  21. package/core.mjs.map +1 -1
  22. package/index.d.mts +17 -1
  23. package/index.d.ts +17 -1
  24. package/index.d.ts.map +1 -1
  25. package/index.js +16 -3
  26. package/index.js.map +1 -1
  27. package/index.mjs +16 -3
  28. package/index.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/resources/completions.d.ts +118 -189
  31. package/resources/completions.d.ts.map +1 -1
  32. package/resources/completions.js.map +1 -1
  33. package/resources/completions.mjs.map +1 -1
  34. package/resources/index.d.ts +7 -1
  35. package/resources/index.d.ts.map +1 -1
  36. package/resources/index.js.map +1 -1
  37. package/resources/index.mjs.map +1 -1
  38. package/src/_shims/ReadableStream.d.ts +38 -0
  39. package/src/_shims/ReadableStream.js +5 -0
  40. package/src/_shims/ReadableStream.mjs +7 -0
  41. package/src/_shims/ReadableStream.node.ts +6 -0
  42. package/src/_shims/fetch.d.ts +8 -1
  43. package/src/_shims/fetch.node.d.ts +11 -1
  44. package/src/_shims/formdata.js +9 -1
  45. package/src/_shims/formdata.mjs +10 -1
  46. package/src/core.ts +254 -89
  47. package/src/index.ts +19 -2
  48. package/src/resources/completions.ts +124 -200
  49. package/src/resources/index.ts +7 -1
  50. package/src/streaming.ts +9 -15
  51. package/src/version.ts +1 -1
  52. package/streaming.d.ts +3 -7
  53. package/streaming.d.ts.map +1 -1
  54. package/streaming.js +8 -5
  55. package/streaming.js.map +1 -1
  56. package/streaming.mjs +7 -4
  57. package/streaming.mjs.map +1 -1
  58. package/version.d.ts +1 -1
  59. package/version.d.ts.map +1 -1
  60. package/version.js +1 -1
  61. package/version.js.map +1 -1
  62. package/version.mjs +1 -1
  63. package/version.mjs.map +1 -1
package/index.mjs CHANGED
@@ -4,10 +4,23 @@ import * as Core from './core.mjs';
4
4
  import * as API from './resources/index.mjs';
5
5
  import * as Errors from './error.mjs';
6
6
  import * as Uploads from './uploads.mjs';
7
- /** Instantiate the API Client. */
7
+ /** API Client for interfacing with the Anthropic API. */
8
8
  export class Anthropic extends Core.APIClient {
9
+ /**
10
+ * API Client for interfacing with the Anthropic API.
11
+ *
12
+ * @param {string | null} [opts.apiKey=process.env['ANTHROPIC_API_KEY']] - The API Key to send to the API.
13
+ * @param {string} [opts.baseURL] - Override the default base URL for the API.
14
+ * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
15
+ * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
16
+ * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
17
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
18
+ * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
19
+ * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
20
+ * @param {string | null} [opts.authToken]
21
+ */
9
22
  constructor(_b) {
10
- var _c, _d;
23
+ var _c, _d, _e;
11
24
  var {
12
25
  apiKey = (_c = Core.readEnv('ANTHROPIC_API_KEY')) !== null && _c !== void 0 ? _c : null,
13
26
  authToken = (_d = Core.readEnv('ANTHROPIC_AUTH_TOKEN')) !== null && _d !== void 0 ? _d : null,
@@ -22,7 +35,7 @@ export class Anthropic extends Core.APIClient {
22
35
  };
23
36
  super({
24
37
  baseURL: options.baseURL,
25
- timeout: options.timeout,
38
+ timeout: (_e = options.timeout) !== null && _e !== void 0 ? _e : 600000 /* 10 minutes */,
26
39
  httpAgent: options.httpAgent,
27
40
  maxRetries: options.maxRetries,
28
41
  fetch: options.fetch,
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;;OAE9C,KAAK,IAAI;OACT,KAAK,GAAG;OACR,KAAK,MAAM;OAEX,KAAK,OAAO;AAiEnB,kCAAkC;AAClC,MAAM,OAAO,SAAU,SAAQ,IAAI,CAAC,SAAS;IAM3C,YAAY,EAIS;;YAJT,EACV,MAAM,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,mCAAI,IAAI,EAClD,SAAS,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,mCAAI,IAAI,EACxD,GAAG,IAAI,qBACU,EAAE;QACnB,SAAS,CAAC;QAEV,MAAM,OAAO,GAAkB;YAC7B,MAAM;YACN,SAAS;YACT,OAAO,EAAE,2BAA2B;YACpC,GAAG,IAAI;SACR,CAAC;QAEF,KAAK,CAAC;YACJ,OAAO,EAAE,OAAO,CAAC,OAAQ;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QAOL,gBAAW,GAAoB,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QANvD,IAAI,CAAC,Q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AO,CAAC,YAAY,CAAC;AAElD,WAAiB,SAAS;IACxB,mBAAmB;IACL,gBAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACxB,sBAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAIpC,qBAAW,GAAG,GAAG,CAAC,WAAW,CAAC;AAK9C,CAAC,EAZgB,SAAS,KAAT,SAAS,QAYzB;AAED,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/sdk",
3
- "version": "0.5.10",
3
+ "version": "0.6.1",
4
4
  "description": "Client library for the Anthropic API",
5
5
  "author": "Anthropic <support@anthropic.com>",
6
6
  "types": "./index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import * as Core from '@anthropic-ai/sdk/core';
2
+ import { APIPromise } from '@anthropic-ai/sdk/core';
2
3
  import { APIResource } from '@anthropic-ai/sdk/resource';
3
4
  import * as API from './index.js';
4
5
  import { Stream } from '@anthropic-ai/sdk/streaming';
@@ -6,14 +7,15 @@ export declare class Completions extends APIResource {
6
7
  /**
7
8
  * Create a completion
8
9
  */
10
+ create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>;
9
11
  create(
10
- body: CompletionCreateParams.CompletionRequestNonStreaming,
12
+ body: CompletionCreateParamsStreaming,
11
13
  options?: Core.RequestOptions,
12
- ): Promise<Core.APIResponse<Completion>>;
14
+ ): APIPromise<Stream<Completion>>;
13
15
  create(
14
- body: CompletionCreateParams.CompletionRequestStreaming,
16
+ body: CompletionCreateParamsBase,
15
17
  options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<Stream<Completion>>>;
18
+ ): APIPromise<Stream<Completion> | Completion>;
17
19
  }
18
20
  export interface Completion {
19
21
  /**
@@ -35,199 +37,126 @@ export interface Completion {
35
37
  */
36
38
  stop_reason: string;
37
39
  }
38
- export type CompletionCreateParams =
39
- | CompletionCreateParams.CompletionRequestNonStreaming
40
- | CompletionCreateParams.CompletionRequestStreaming;
40
+ export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
41
+ export interface CompletionCreateParamsBase {
42
+ /**
43
+ * The maximum number of tokens to generate before stopping.
44
+ *
45
+ * Note that our models may stop _before_ reaching this maximum. This parameter
46
+ * only specifies the absolute maximum number of tokens to generate.
47
+ */
48
+ max_tokens_to_sample: number;
49
+ /**
50
+ * The model that will complete your prompt.
51
+ *
52
+ * As we improve Claude, we develop new versions of it that you can query. This
53
+ * parameter controls which version of Claude answers your request. Right now we
54
+ * are offering two model families: Claude, and Claude Instant. You can use them by
55
+ * setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See
56
+ * [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
57
+ * additional details.
58
+ */
59
+ model: (string & {}) | 'claude-2' | 'claude-instant-1';
60
+ /**
61
+ * The prompt that you want Claude to complete.
62
+ *
63
+ * For proper response generation you will need to format your prompt as follows:
64
+ *
65
+ * ```javascript
66
+ * const userQuestion = r"Why is the sky blue?";
67
+ * const prompt = `\n\nHuman: ${userQuestion}\n\nAssistant:`;
68
+ * ```
69
+ *
70
+ * See our
71
+ * [comments on prompts](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
72
+ * for more context.
73
+ */
74
+ prompt: string;
75
+ /**
76
+ * An object describing metadata about the request.
77
+ */
78
+ metadata?: CompletionCreateParams.Metadata;
79
+ /**
80
+ * Sequences that will cause the model to stop generating completion text.
81
+ *
82
+ * Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
83
+ * sequences in the future. By providing the stop_sequences parameter, you may
84
+ * include additional strings that will cause the model to stop generating.
85
+ */
86
+ stop_sequences?: Array<string>;
87
+ /**
88
+ * Whether to incrementally stream the response using server-sent events.
89
+ *
90
+ * See
91
+ * [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
92
+ * for details.
93
+ */
94
+ stream?: boolean;
95
+ /**
96
+ * Amount of randomness injected into the response.
97
+ *
98
+ * Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
99
+ * multiple choice, and closer to 1 for creative and generative tasks.
100
+ */
101
+ temperature?: number;
102
+ /**
103
+ * Only sample from the top K options for each subsequent token.
104
+ *
105
+ * Used to remove "long tail" low probability responses.
106
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
107
+ */
108
+ top_k?: number;
109
+ /**
110
+ * Use nucleus sampling.
111
+ *
112
+ * In nucleus sampling, we compute the cumulative distribution over all the options
113
+ * for each subsequent token in decreasing probability order and cut it off once it
114
+ * reaches a particular probability specified by `top_p`. You should either alter
115
+ * `temperature` or `top_p`, but not both.
116
+ */
117
+ top_p?: number;
118
+ }
41
119
  export declare namespace CompletionCreateParams {
42
- interface CompletionRequestNonStreaming {
43
- /**
44
- * The maximum number of tokens to generate before stopping.
45
- *
46
- * Note that our models may stop _before_ reaching this maximum. This parameter
47
- * only specifies the absolute maximum number of tokens to generate.
48
- */
49
- max_tokens_to_sample: number;
50
- /**
51
- * The model that will complete your prompt.
52
- *
53
- * As we improve Claude, we develop new versions of it that you can query. This
54
- * parameter controls which version of Claude answers your request. Right now we
55
- * are offering two model families: Claude, and Claude Instant. You can use them by
56
- * setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See
57
- * [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
58
- * additional details.
59
- */
60
- model: (string & {}) | 'claude-2' | 'claude-instant-1';
61
- /**
62
- * The prompt that you want Claude to complete.
63
- *
64
- * For proper response generation you will need to format your prompt as follows:
65
- *
66
- * ```javascript
67
- * const userQuestion = r"Why is the sky blue?";
68
- * const prompt = `\n\nHuman: ${userQuestion}\n\nAssistant:`;
69
- * ```
70
- *
71
- * See our
72
- * [comments on prompts](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
73
- * for more context.
74
- */
75
- prompt: string;
76
- /**
77
- * An object describing metadata about the request.
78
- */
79
- metadata?: CompletionCreateParams.CompletionRequestNonStreaming.Metadata;
80
- /**
81
- * Sequences that will cause the model to stop generating completion text.
82
- *
83
- * Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
84
- * sequences in the future. By providing the stop_sequences parameter, you may
85
- * include additional strings that will cause the model to stop generating.
86
- */
87
- stop_sequences?: Array<string>;
88
- /**
89
- * Whether to incrementally stream the response using server-sent events.
90
- *
91
- * See
92
- * [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
93
- * for details.
94
- */
95
- stream?: false;
96
- /**
97
- * Amount of randomness injected into the response.
98
- *
99
- * Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
100
- * multiple choice, and closer to 1 for creative and generative tasks.
101
- */
102
- temperature?: number;
103
- /**
104
- * Only sample from the top K options for each subsequent token.
105
- *
106
- * Used to remove "long tail" low probability responses.
107
- * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
108
- */
109
- top_k?: number;
110
- /**
111
- * Use nucleus sampling.
112
- *
113
- * In nucleus sampling, we compute the cumulative distribution over all the options
114
- * for each subsequent token in decreasing probability order and cut it off once it
115
- * reaches a particular probability specified by `top_p`. You should either alter
116
- * `temperature` or `top_p`, but not both.
117
- */
118
- top_p?: number;
119
- }
120
- namespace CompletionRequestNonStreaming {
121
- /**
122
- * An object describing metadata about the request.
123
- */
124
- interface Metadata {
125
- /**
126
- * An external identifier for the user who is associated with the request.
127
- *
128
- * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
129
- * this id to help detect abuse. Do not include any identifying information such as
130
- * name, email address, or phone number.
131
- */
132
- user_id?: string;
133
- }
134
- }
135
- interface CompletionRequestStreaming {
136
- /**
137
- * The maximum number of tokens to generate before stopping.
138
- *
139
- * Note that our models may stop _before_ reaching this maximum. This parameter
140
- * only specifies the absolute maximum number of tokens to generate.
141
- */
142
- max_tokens_to_sample: number;
143
- /**
144
- * The model that will complete your prompt.
145
- *
146
- * As we improve Claude, we develop new versions of it that you can query. This
147
- * parameter controls which version of Claude answers your request. Right now we
148
- * are offering two model families: Claude, and Claude Instant. You can use them by
149
- * setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See
150
- * [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
151
- * additional details.
152
- */
153
- model: (string & {}) | 'claude-2' | 'claude-instant-1';
154
- /**
155
- * The prompt that you want Claude to complete.
156
- *
157
- * For proper response generation you will need to format your prompt as follows:
158
- *
159
- * ```javascript
160
- * const userQuestion = r"Why is the sky blue?";
161
- * const prompt = `\n\nHuman: ${userQuestion}\n\nAssistant:`;
162
- * ```
163
- *
164
- * See our
165
- * [comments on prompts](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
166
- * for more context.
167
- */
168
- prompt: string;
169
- /**
170
- * Whether to incrementally stream the response using server-sent events.
171
- *
172
- * See
173
- * [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
174
- * for details.
175
- */
176
- stream: true;
177
- /**
178
- * An object describing metadata about the request.
179
- */
180
- metadata?: CompletionCreateParams.CompletionRequestStreaming.Metadata;
181
- /**
182
- * Sequences that will cause the model to stop generating completion text.
183
- *
184
- * Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
185
- * sequences in the future. By providing the stop_sequences parameter, you may
186
- * include additional strings that will cause the model to stop generating.
187
- */
188
- stop_sequences?: Array<string>;
189
- /**
190
- * Amount of randomness injected into the response.
191
- *
192
- * Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
193
- * multiple choice, and closer to 1 for creative and generative tasks.
194
- */
195
- temperature?: number;
196
- /**
197
- * Only sample from the top K options for each subsequent token.
198
- *
199
- * Used to remove "long tail" low probability responses.
200
- * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
201
- */
202
- top_k?: number;
120
+ /**
121
+ * An object describing metadata about the request.
122
+ */
123
+ interface Metadata {
203
124
  /**
204
- * Use nucleus sampling.
125
+ * An external identifier for the user who is associated with the request.
205
126
  *
206
- * In nucleus sampling, we compute the cumulative distribution over all the options
207
- * for each subsequent token in decreasing probability order and cut it off once it
208
- * reaches a particular probability specified by `top_p`. You should either alter
209
- * `temperature` or `top_p`, but not both.
210
- */
211
- top_p?: number;
212
- }
213
- namespace CompletionRequestStreaming {
214
- /**
215
- * An object describing metadata about the request.
127
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
128
+ * this id to help detect abuse. Do not include any identifying information such as
129
+ * name, email address, or phone number.
216
130
  */
217
- interface Metadata {
218
- /**
219
- * An external identifier for the user who is associated with the request.
220
- *
221
- * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
222
- * this id to help detect abuse. Do not include any identifying information such as
223
- * name, email address, or phone number.
224
- */
225
- user_id?: string;
226
- }
131
+ user_id?: string;
227
132
  }
133
+ type CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
134
+ type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
135
+ }
136
+ export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
137
+ /**
138
+ * Whether to incrementally stream the response using server-sent events.
139
+ *
140
+ * See
141
+ * [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
142
+ * for details.
143
+ */
144
+ stream?: false;
145
+ }
146
+ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
147
+ /**
148
+ * Whether to incrementally stream the response using server-sent events.
149
+ *
150
+ * See
151
+ * [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
152
+ * for details.
153
+ */
154
+ stream: true;
228
155
  }
229
156
  export declare namespace Completions {
230
157
  export import Completion = API.Completion;
231
158
  export import CompletionCreateParams = API.CompletionCreateParams;
159
+ export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
160
+ export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
232
161
  }
233
162
  //# sourceMappingURL=completions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,sBAAsB,CAAC,6BAA6B,EAC1D,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,CACJ,IAAI,EAAE,sBAAsB,CAAC,0BAA0B,EACvD,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;CAOjD;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;OAQG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,sBAAsB,GAC9B,sBAAsB,CAAC,6BAA6B,GACpD,sBAAsB,CAAC,0BAA0B,CAAC;AAEtD,yBAAiB,sBAAsB,CAAC;IACtC,UAAiB,6BAA6B;QAC5C;;;;;WAKG;QACH,oBAAoB,EAAE,MAAM,CAAC;QAE7B;;;;;;;;;WASG;QACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,UAAU,GAAG,kBAAkB,CAAC;QAEvD;;;;;;;;;;;;;WAaG;QACH,MAAM,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,QAAQ,CAAC,EAAE,sBAA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,MAAa,WAAY,SAAQ,sBAAW;IAY1C,MAAM,CACJ,IAA4B,EAC5B,OAA6B;;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,KAAK,EAAE,CAAC,CAAC;IACxG,CAAC;CACF;AAlBD,kCAkBC;AA6OD,WAAiB,WAAW;AAG5B,CAAC,EAHgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAG3B"}
1
+ {"version":3,"file":"completions.js","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAIrD,yDAAyD;AAIzD,MAAa,WAAY,SAAQ,sBAAW;IAa1C,MAAM,CACJ,IAA4B,EAC5B,OAA6B;;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,KAAK,EAAE,CAElE,CAAC;IACrC,CAAC;CACF;AArBD,kCAqBC;AA2JD,WAAiB,WAAW;AAK5B,CAAC,EALgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAK3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"completions.mjs","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,4BAA4B;AAIxD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAY1C,MAAM,CACJ,IAA4B,EAC5B,OAA6B;;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,KAAK,EAAE,CAAC,CAAC;IACxG,CAAC;CACF;AA6OD,WAAiB,WAAW;AAG5B,CAAC,EAHgB,WAAW,KAAX,WAAW,QAG3B"}
1
+ {"version":3,"file":"completions.mjs","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAI9C,EAAE,WAAW,EAAE,MAAM,4BAA4B;AAIxD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAa1C,MAAM,CACJ,IAA4B,EAC5B,OAA6B;;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,KAAK,EAAE,CAElE,CAAC;IACrC,CAAC;CACF;AA2JD,WAAiB,WAAW;AAK5B,CAAC,EALgB,WAAW,KAAX,WAAW,QAK3B"}
@@ -1,3 +1,9 @@
1
1
  export {} from './top-level.js';
2
- export { Completion, CompletionCreateParams, Completions } from './completions.js';
2
+ export {
3
+ Completion,
4
+ CompletionCreateParams,
5
+ CompletionCreateParamsNonStreaming,
6
+ CompletionCreateParamsStreaming,
7
+ Completions,
8
+ } from './completions.js';
3
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,kCAAkC,EAClC,+BAA+B,EAC/B,WAAW,GACZ,MAAM,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,gDAAgF;AAAnC,0GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,gDAMuB;AADrB,0GAAA,WAAW,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAsC,WAAW,EAAE"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAKL,WAAW,GACZ"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+
5
+ /**
6
+ * >>> Confused? <<<
7
+ *
8
+ * If you're getting errors from these types, try adding "lib": ["DOM"]
9
+ * to your tsconfig.json, or otherwise configure the appropriate builtin
10
+ * `ReadableStream` type for your environment.
11
+ */
12
+
13
+ // @ts-ignore
14
+ type _ReadableStream<R = any> = unknown extends ReadableStream ? never : ReadableStream<R>;
15
+ declare const _ReadableStream: {
16
+ prototype: _ReadableStream;
17
+ new (
18
+ underlyingSource: _UnderlyingByteSource,
19
+ strategy?: { highWaterMark?: number },
20
+ ): _ReadableStream<Uint8Array>;
21
+ new <R = any>(
22
+ underlyingSource: _UnderlyingDefaultSource<R>,
23
+ strategy?: _QueuingStrategy<R>,
24
+ ): _ReadableStream<R>;
25
+ new <R = any>(underlyingSource?: _UnderlyingSource<R>, strategy?: _QueuingStrategy<R>): _ReadableStream<R>;
26
+ };
27
+
28
+ // @ts-ignore
29
+ type _UnderlyingSource<R = any> = unknown extends UnderlyingSource ? never : UnderlyingSource<R>;
30
+ // @ts-ignore
31
+ type _UnderlyingByteSource = unknown extends UnderlyingByteSource ? never : UnderlyingByteSource;
32
+ type _UnderlyingDefaultSource<R = any> =
33
+ // @ts-ignore
34
+ unknown extends UnderlyingDefaultSource ? never : UnderlyingDefaultSource<R>;
35
+ // @ts-ignore
36
+ type _QueuingStrategy<R = any> = unknown extends QueuingStrategy ? never : QueuingStrategy<R>;
37
+
38
+ export { _ReadableStream as ReadableStream };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+
5
+ exports.ReadableStream = ReadableStream;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+
5
+ const _ReadableStream = ReadableStream;
6
+
7
+ export { _ReadableStream as ReadableStream };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ import { ReadableStream } from 'web-streams-polyfill';
5
+
6
+ export { ReadableStream };
@@ -26,6 +26,8 @@ type _Response = unknown extends Response ? never : Response;
26
26
  // @ts-ignore
27
27
  type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit;
28
28
  // @ts-ignore
29
+ type _ResponseType = unknown extends ResponseType ? never : ResponseType;
30
+ // @ts-ignore
29
31
  type _BodyInit = unknown extends BodyInit ? never : BodyInit;
30
32
  // @ts-ignore
31
33
  type _Headers = unknown extends Headers ? never : Headers;
@@ -49,4 +51,9 @@ declare const _Headers: {
49
51
  export const isPolyfilled = false;
50
52
 
51
53
  export { _fetch as fetch, _Request as Request, _Response as Response, _Headers as Headers };
52
- export type { _RequestInit as RequestInit, _RequestInfo as RequestInfo, _BodyInit as BodyInit };
54
+ export type {
55
+ _RequestInit as RequestInit,
56
+ _RequestInfo as RequestInfo,
57
+ _ResponseType as ResponseType,
58
+ _BodyInit as BodyInit,
59
+ };
@@ -26,6 +26,11 @@ type _RequestInit = unknown extends RequestInit ? nf.RequestInit : RequestInit;
26
26
  type _Response = unknown extends Response ? nf.Response : Response;
27
27
  // @ts-ignore
28
28
  type _ResponseInit = unknown extends ResponseInit ? nf.ResponseInit : ResponseInit;
29
+ type _ResponseType =
30
+ // @ts-ignore
31
+ unknown extends ResponseType ? 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'
32
+ : // @ts-ignore
33
+ ResponseType;
29
34
  // @ts-ignore
30
35
  type _BodyInit = unknown extends BodyInit ? nf.BodyInit : BodyInit;
31
36
  // @ts-ignore
@@ -50,4 +55,9 @@ declare const _Headers: {
50
55
  export const isPolyfilled = false;
51
56
 
52
57
  export { _fetch as fetch, _Request as Request, _Response as Response, _Headers as Headers };
53
- export type { _RequestInit as RequestInit, _RequestInfo as RequestInfo, _BodyInit as BodyInit };
58
+ export type {
59
+ _RequestInit as RequestInit,
60
+ _RequestInfo as RequestInfo,
61
+ _ResponseType as ResponseType,
62
+ _BodyInit as BodyInit,
63
+ };
@@ -3,7 +3,15 @@
3
3
  */
4
4
 
5
5
  exports.FormData = FormData;
6
- exports.File = File;
7
6
  exports.Blob = Blob;
7
+ exports.File =
8
+ typeof File !== 'undefined' ? File : (
9
+ // Bun doesn't implement File yet, so just make a shim that throws a helpful error message
10
+ class File extends Blob {
11
+ constructor() {
12
+ throw new Error(`file uploads aren't supported in this environment yet as 'File' is not defined`);
13
+ }
14
+ }
15
+ );
8
16
 
9
17
  exports.isPolyfilled = false;
@@ -3,9 +3,18 @@
3
3
  */
4
4
 
5
5
  const _FormData = FormData;
6
- const _File = File;
7
6
  const _Blob = Blob;
8
7
 
8
+ const _File =
9
+ typeof File !== 'undefined' ? File : (
10
+ // Bun doesn't implement File yet, so just make a shim that throws a helpful error message
11
+ class File extends Blob {
12
+ constructor() {
13
+ throw new Error(`file uploads aren't supported in this environment yet as 'File' is not defined`);
14
+ }
15
+ }
16
+ );
17
+
9
18
  export { _FormData as FormData, _File as File, _Blob as Blob };
10
19
 
11
20
  export const isPolyfilled = false;