@anthropic-ai/sdk 0.10.2 → 0.12.0

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 (73) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +51 -86
  3. package/error.d.ts.map +1 -1
  4. package/error.js +2 -1
  5. package/error.js.map +1 -1
  6. package/error.mjs +2 -1
  7. package/error.mjs.map +1 -1
  8. package/index.d.mts +9 -5
  9. package/index.d.ts +9 -5
  10. package/index.d.ts.map +1 -1
  11. package/index.js +7 -5
  12. package/index.js.map +1 -1
  13. package/index.mjs +7 -5
  14. package/index.mjs.map +1 -1
  15. package/lib/MessageStream.d.ts +94 -0
  16. package/lib/MessageStream.d.ts.map +1 -0
  17. package/lib/MessageStream.js +421 -0
  18. package/lib/MessageStream.js.map +1 -0
  19. package/lib/MessageStream.mjs +417 -0
  20. package/lib/MessageStream.mjs.map +1 -0
  21. package/package.json +3 -2
  22. package/resources/beta/beta.d.ts +25 -0
  23. package/resources/beta/beta.d.ts.map +1 -0
  24. package/resources/beta/beta.js +40 -0
  25. package/resources/beta/beta.js.map +1 -0
  26. package/resources/beta/beta.mjs +13 -0
  27. package/resources/beta/beta.mjs.map +1 -0
  28. package/resources/beta/index.d.ts +3 -0
  29. package/resources/beta/index.d.ts.map +1 -0
  30. package/resources/beta/index.js +9 -0
  31. package/resources/beta/index.js.map +1 -0
  32. package/resources/beta/index.mjs +4 -0
  33. package/resources/beta/index.mjs.map +1 -0
  34. package/resources/beta/messages.d.ts +495 -0
  35. package/resources/beta/messages.d.ts.map +1 -0
  36. package/resources/beta/messages.js +29 -0
  37. package/resources/beta/messages.js.map +1 -0
  38. package/resources/beta/messages.mjs +24 -0
  39. package/resources/beta/messages.mjs.map +1 -0
  40. package/resources/completions.d.ts +35 -27
  41. package/resources/completions.d.ts.map +1 -1
  42. package/resources/completions.js.map +1 -1
  43. package/resources/completions.mjs.map +1 -1
  44. package/resources/index.d.ts +1 -0
  45. package/resources/index.d.ts.map +1 -1
  46. package/resources/index.js +3 -1
  47. package/resources/index.js.map +1 -1
  48. package/resources/index.mjs +1 -0
  49. package/resources/index.mjs.map +1 -1
  50. package/src/error.ts +2 -1
  51. package/src/index.ts +11 -5
  52. package/src/lib/MessageStream.ts +515 -0
  53. package/src/resources/beta/beta.ts +28 -0
  54. package/src/resources/beta/index.ts +22 -0
  55. package/src/resources/beta/messages.ts +581 -0
  56. package/src/resources/completions.ts +37 -27
  57. package/src/resources/index.ts +1 -0
  58. package/src/streaming.ts +21 -1
  59. package/src/uploads.ts +2 -3
  60. package/src/version.ts +1 -1
  61. package/streaming.d.ts.map +1 -1
  62. package/streaming.js +15 -0
  63. package/streaming.js.map +1 -1
  64. package/streaming.mjs +15 -0
  65. package/streaming.mjs.map +1 -1
  66. package/uploads.d.ts.map +1 -1
  67. package/uploads.js +2 -1
  68. package/uploads.js.map +1 -1
  69. package/uploads.mjs +2 -1
  70. package/uploads.mjs.map +1 -1
  71. package/version.d.ts +1 -1
  72. package/version.js +1 -1
  73. package/version.mjs +1 -1
@@ -0,0 +1,495 @@
1
+ import * as Core from '@anthropic-ai/sdk/core';
2
+ import { APIPromise } from '@anthropic-ai/sdk/core';
3
+ import { APIResource } from '@anthropic-ai/sdk/resource';
4
+ import { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';
5
+ export { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';
6
+ import * as MessagesAPI from '@anthropic-ai/sdk/resources/beta/messages';
7
+ import { Stream } from '@anthropic-ai/sdk/streaming';
8
+ export declare class Messages extends APIResource {
9
+ /**
10
+ * Create a Message.
11
+ *
12
+ * The Messages API is currently in beta.
13
+ */
14
+ create(body: MessageCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Message>;
15
+ create(body: MessageCreateParamsStreaming, options?: Core.RequestOptions): APIPromise<Stream<MessageStreamEvent>>;
16
+ create(body: MessageCreateParamsBase, options?: Core.RequestOptions): APIPromise<Stream<MessageStreamEvent> | Message>;
17
+ /**
18
+ * Create a Message stream
19
+ */
20
+ stream(body: MessageStreamParams, options?: Core.RequestOptions): MessageStream;
21
+ }
22
+ export interface ContentBlock {
23
+ text: string;
24
+ type: 'text';
25
+ }
26
+ export interface ContentBlockDeltaEvent {
27
+ delta: TextDelta;
28
+ index: number;
29
+ type: 'content_block_delta';
30
+ }
31
+ export interface ContentBlockStartEvent {
32
+ content_block: ContentBlock;
33
+ index: number;
34
+ type: 'content_block_start';
35
+ }
36
+ export interface ContentBlockStopEvent {
37
+ index: number;
38
+ type: 'content_block_stop';
39
+ }
40
+ export interface Message {
41
+ /**
42
+ * Unique object identifier.
43
+ *
44
+ * The format and length of IDs may change over time.
45
+ */
46
+ id: string;
47
+ /**
48
+ * Content generated by the model.
49
+ *
50
+ * This is an array of content blocks, each of which has a `type` that determines
51
+ * its shape. Currently, the only `type` available is `"text"`.
52
+ *
53
+ * Example:
54
+ *
55
+ * ```json
56
+ * [{ "type": "text", "text": "Hi, I'm Claude." }]
57
+ * ```
58
+ *
59
+ * If the request input `messages` ended with an `assistant` turn, then the
60
+ * response `content` will continue directly from that last turn. You can use this
61
+ * to constrain the model's output.
62
+ *
63
+ * For example, if the input `messages` were:
64
+ *
65
+ * ```json
66
+ * [
67
+ * {
68
+ * "role": "user",
69
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
70
+ * },
71
+ * {
72
+ * "role": "assistant",
73
+ * "content": "The best answer is ("
74
+ * }
75
+ * ]
76
+ * ```
77
+ *
78
+ * Then the response `content` might be:
79
+ *
80
+ * ```json
81
+ * [{ "type": "text", "text": "B)" }]
82
+ * ```
83
+ */
84
+ content: Array<ContentBlock>;
85
+ /**
86
+ * The model that handled the request.
87
+ */
88
+ model: string;
89
+ /**
90
+ * Conversational role of the generated message.
91
+ *
92
+ * This will always be `"assistant"`.
93
+ */
94
+ role: 'assistant';
95
+ /**
96
+ * The reason that we stopped.
97
+ *
98
+ * This may be one the following values:
99
+ *
100
+ * - `"end_turn"`: the model reached a natural stopping point
101
+ * - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
102
+ * - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
103
+ *
104
+ * Note that these values are different than those in `/v1/complete`, where
105
+ * `end_turn` and `stop_sequence` were not differentiated.
106
+ *
107
+ * In non-streaming mode this value is always non-null. In streaming mode, it is
108
+ * null in the `message_start` event and non-null otherwise.
109
+ */
110
+ stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | null;
111
+ /**
112
+ * Which custom stop sequence was generated.
113
+ *
114
+ * This value will be non-null if one of your custom stop sequences was generated.
115
+ */
116
+ stop_sequence: string | null;
117
+ type: 'message';
118
+ }
119
+ export interface MessageDeltaEvent {
120
+ delta: MessageDeltaEvent.Delta;
121
+ type: 'message_delta';
122
+ }
123
+ export declare namespace MessageDeltaEvent {
124
+ interface Delta {
125
+ stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | null;
126
+ stop_sequence: string | null;
127
+ }
128
+ }
129
+ export interface MessageParam {
130
+ content: string | Array<TextBlock>;
131
+ role: 'user' | 'assistant';
132
+ }
133
+ export interface MessageStartEvent {
134
+ message: Message;
135
+ type: 'message_start';
136
+ }
137
+ export interface MessageStopEvent {
138
+ type: 'message_stop';
139
+ }
140
+ export type MessageStreamEvent = MessageStartEvent | MessageDeltaEvent | MessageStopEvent | ContentBlockStartEvent | ContentBlockDeltaEvent | ContentBlockStopEvent;
141
+ export interface TextBlock {
142
+ text: string;
143
+ type?: 'text';
144
+ }
145
+ export interface TextDelta {
146
+ text: string;
147
+ type: 'text_delta';
148
+ }
149
+ export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
150
+ export interface MessageCreateParamsBase {
151
+ /**
152
+ * The maximum number of tokens to generate before stopping.
153
+ *
154
+ * Note that our models may stop _before_ reaching this maximum. This parameter
155
+ * only specifies the absolute maximum number of tokens to generate.
156
+ *
157
+ * Different models have different maximum values for this parameter. See
158
+ * [input and output sizes](https://docs.anthropic.com/claude/reference/input-and-output-sizes)
159
+ * for details.
160
+ */
161
+ max_tokens: number;
162
+ /**
163
+ * Input messages.
164
+ *
165
+ * Our models are trained to operate on alternating `user` and `assistant`
166
+ * conversational turns. When creating a new `Message`, you specify the prior
167
+ * conversational turns with the `messages` parameter, and the model then generates
168
+ * the next `Message` in the conversation.
169
+ *
170
+ * Each input message must be an object with a `role` and `content`. You can
171
+ * specify a single `user`-role message, or you can include multiple `user` and
172
+ * `assistant` messages. The first message must always use the `user` role.
173
+ *
174
+ * If the final message uses the `assistant` role, the response content will
175
+ * continue immediately from the content in that message. This can be used to
176
+ * constrain part of the model's response.
177
+ *
178
+ * Example with a single `user` message:
179
+ *
180
+ * ```json
181
+ * [{ "role": "user", "content": "Hello, Claude" }]
182
+ * ```
183
+ *
184
+ * Example with multiple conversational turns:
185
+ *
186
+ * ```json
187
+ * [
188
+ * { "role": "user", "content": "Hello there." },
189
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
190
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
191
+ * ]
192
+ * ```
193
+ *
194
+ * Example with a partially-filled response from Claude:
195
+ *
196
+ * ```json
197
+ * [
198
+ * { "role": "user", "content": "Please describe yourself using only JSON" },
199
+ * { "role": "assistant", "content": "Here is my JSON description:\n{" }
200
+ * ]
201
+ * ```
202
+ *
203
+ * Each input message `content` may be either a single `string` or an array of
204
+ * content blocks, where each block has a specific `type`. Using a `string` is
205
+ * shorthand for an array of one content block of type `"text"`. The following
206
+ * input messages are equivalent:
207
+ *
208
+ * ```json
209
+ * { "role": "user", "content": "Hello, Claude" }
210
+ * ```
211
+ *
212
+ * ```json
213
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
214
+ * ```
215
+ *
216
+ * During beta, the Messages API only accepts content blocks of type `"text"`, and
217
+ * at most one block per message.
218
+ *
219
+ * See our
220
+ * [guide to prompt design](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
221
+ * for more details on how to best construct prompts.
222
+ */
223
+ messages: Array<MessageParam>;
224
+ /**
225
+ * The model that will complete your prompt.
226
+ *
227
+ * As we improve Claude, we develop new versions of it that you can query. The
228
+ * `model` parameter controls which version of Claude responds to your request.
229
+ * Right now we offer two model families: Claude, and Claude Instant. You can use
230
+ * them by setting `model` to `"claude-2.1"` or `"claude-instant-1.2"`,
231
+ * respectively.
232
+ *
233
+ * See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
234
+ * additional details and options.
235
+ */
236
+ model: string;
237
+ /**
238
+ * An object describing metadata about the request.
239
+ */
240
+ metadata?: MessageCreateParams.Metadata;
241
+ /**
242
+ * Custom text sequences that will cause the model to stop generating.
243
+ *
244
+ * Our models will normally stop when they have naturally completed their turn,
245
+ * which will result in a response `stop_reason` of `"end_turn"`.
246
+ *
247
+ * If you want the model to stop generating when it encounters custom strings of
248
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
249
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
250
+ * and the response `stop_sequence` value will contain the matched stop sequence.
251
+ */
252
+ stop_sequences?: Array<string>;
253
+ /**
254
+ * Whether to incrementally stream the response using server-sent events.
255
+ *
256
+ * See [streaming](https://docs.anthropic.com/claude/reference/streaming) for
257
+ * details.
258
+ */
259
+ stream?: boolean;
260
+ /**
261
+ * System prompt.
262
+ *
263
+ * A system prompt is a way of providing context and instructions to Claude, such
264
+ * as specifying a particular goal or role. See our
265
+ * [guide to system prompts](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts).
266
+ */
267
+ system?: string;
268
+ /**
269
+ * Amount of randomness injected into the response.
270
+ *
271
+ * Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
272
+ * multiple choice, and closer to 1 for creative and generative tasks.
273
+ */
274
+ temperature?: number;
275
+ /**
276
+ * Only sample from the top K options for each subsequent token.
277
+ *
278
+ * Used to remove "long tail" low probability responses.
279
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
280
+ */
281
+ top_k?: number;
282
+ /**
283
+ * Use nucleus sampling.
284
+ *
285
+ * In nucleus sampling, we compute the cumulative distribution over all the options
286
+ * for each subsequent token in decreasing probability order and cut it off once it
287
+ * reaches a particular probability specified by `top_p`. You should either alter
288
+ * `temperature` or `top_p`, but not both.
289
+ */
290
+ top_p?: number;
291
+ }
292
+ export declare namespace MessageCreateParams {
293
+ /**
294
+ * An object describing metadata about the request.
295
+ */
296
+ interface Metadata {
297
+ /**
298
+ * An external identifier for the user who is associated with the request.
299
+ *
300
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
301
+ * this id to help detect abuse. Do not include any identifying information such as
302
+ * name, email address, or phone number.
303
+ */
304
+ user_id?: string;
305
+ }
306
+ type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
307
+ type MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
308
+ }
309
+ export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
310
+ /**
311
+ * Whether to incrementally stream the response using server-sent events.
312
+ *
313
+ * See [streaming](https://docs.anthropic.com/claude/reference/streaming) for
314
+ * details.
315
+ */
316
+ stream?: false;
317
+ }
318
+ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
319
+ /**
320
+ * Whether to incrementally stream the response using server-sent events.
321
+ *
322
+ * See [streaming](https://docs.anthropic.com/claude/reference/streaming) for
323
+ * details.
324
+ */
325
+ stream: true;
326
+ }
327
+ export interface MessageStreamParams {
328
+ /**
329
+ * The maximum number of tokens to generate before stopping.
330
+ *
331
+ * Note that our models may stop _before_ reaching this maximum. This parameter
332
+ * only specifies the absolute maximum number of tokens to generate.
333
+ *
334
+ * Different models have different maximum values for this parameter. See
335
+ * [input and output sizes](https://docs.anthropic.com/claude/reference/input-and-output-sizes)
336
+ * for details.
337
+ */
338
+ max_tokens: number;
339
+ /**
340
+ * Input messages.
341
+ *
342
+ * Our models are trained to operate on alternating `user` and `assistant`
343
+ * conversational turns. When creating a new `Message`, you specify the prior
344
+ * conversational turns with the `messages` parameter, and the model then generates
345
+ * the next `Message` in the conversation.
346
+ *
347
+ * Each input message must be an object with a `role` and `content`. You can
348
+ * specify a single `user`-role message, or you can include multiple `user` and
349
+ * `assistant` messages. The first message must always use the `user` role.
350
+ *
351
+ * If the final message uses the `assistant` role, the response content will
352
+ * continue immediately from the content in that message. This can be used to
353
+ * constrain part of the model's response.
354
+ *
355
+ * Example with a single `user` message:
356
+ *
357
+ * ```json
358
+ * [{ "role": "user", "content": "Hello, Claude" }]
359
+ * ```
360
+ *
361
+ * Example with multiple conversational turns:
362
+ *
363
+ * ```json
364
+ * [
365
+ * { "role": "user", "content": "Hello there." },
366
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
367
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
368
+ * ]
369
+ * ```
370
+ *
371
+ * Example with a partially-filled response from Claude:
372
+ *
373
+ * ```json
374
+ * [
375
+ * { "role": "user", "content": "Please describe yourself using only JSON" },
376
+ * { "role": "assistant", "content": "Here is my JSON description:\n{" }
377
+ * ]
378
+ * ```
379
+ *
380
+ * Each input message `content` may be either a single `string` or an array of
381
+ * content blocks, where each block has a specific `type`. Using a `string` is
382
+ * shorthand for an array of one content block of type `"text"`. The following
383
+ * input messages are equivalent:
384
+ *
385
+ * ```json
386
+ * { "role": "user", "content": "Hello, Claude" }
387
+ * ```
388
+ *
389
+ * ```json
390
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
391
+ * ```
392
+ *
393
+ * During beta, the Messages API only accepts content blocks of type `"text"`, and
394
+ * at most one block per message.
395
+ *
396
+ * See our
397
+ * [guide to prompt design](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
398
+ * for more details on how to best construct prompts.
399
+ */
400
+ messages: Array<MessageParam>;
401
+ /**
402
+ * The model that will complete your prompt.
403
+ *
404
+ * As we improve Claude, we develop new versions of it that you can query. The
405
+ * `model` parameter controls which version of Claude responds to your request.
406
+ * Right now we offer two model families: Claude, and Claude Instant. You can use
407
+ * them by setting `model` to `"claude-2.1"` or `"claude-instant-1.2"`,
408
+ * respectively.
409
+ *
410
+ * See [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
411
+ * additional details and options.
412
+ */
413
+ model: string;
414
+ /**
415
+ * An object describing metadata about the request.
416
+ */
417
+ metadata?: MessageStreamParams.Metadata;
418
+ /**
419
+ * Custom text sequences that will cause the model to stop generating.
420
+ *
421
+ * Our models will normally stop when they have naturally completed their turn,
422
+ * which will result in a response `stop_reason` of `"end_turn"`.
423
+ *
424
+ * If you want the model to stop generating when it encounters custom strings of
425
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
426
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
427
+ * and the response `stop_sequence` value will contain the matched stop sequence.
428
+ */
429
+ stop_sequences?: Array<string>;
430
+ /**
431
+ * System prompt.
432
+ *
433
+ * A system prompt is a way of providing context and instructions to Claude, such
434
+ * as specifying a particular goal or role. See our
435
+ * [guide to system prompts](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts).
436
+ */
437
+ system?: string;
438
+ /**
439
+ * Amount of randomness injected into the response.
440
+ *
441
+ * Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
442
+ * multiple choice, and closer to 1 for creative and generative tasks.
443
+ */
444
+ temperature?: number;
445
+ /**
446
+ * Only sample from the top K options for each subsequent token.
447
+ *
448
+ * Used to remove "long tail" low probability responses.
449
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
450
+ */
451
+ top_k?: number;
452
+ /**
453
+ * Use nucleus sampling.
454
+ *
455
+ * In nucleus sampling, we compute the cumulative distribution over all the options
456
+ * for each subsequent token in decreasing probability order and cut it off once it
457
+ * reaches a particular probability specified by `top_p`. You should either alter
458
+ * `temperature` or `top_p`, but not both.
459
+ */
460
+ top_p?: number;
461
+ }
462
+ export declare namespace MessageStreamParams {
463
+ /**
464
+ * An object describing metadata about the request.
465
+ */
466
+ interface Metadata {
467
+ /**
468
+ * An external identifier for the user who is associated with the request.
469
+ *
470
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
471
+ * this id to help detect abuse. Do not include any identifying information such as
472
+ * name, email address, or phone number.
473
+ */
474
+ user_id?: string;
475
+ }
476
+ }
477
+ export declare namespace Messages {
478
+ export import ContentBlock = MessagesAPI.ContentBlock;
479
+ export import ContentBlockDeltaEvent = MessagesAPI.ContentBlockDeltaEvent;
480
+ export import ContentBlockStartEvent = MessagesAPI.ContentBlockStartEvent;
481
+ export import ContentBlockStopEvent = MessagesAPI.ContentBlockStopEvent;
482
+ export import Message = MessagesAPI.Message;
483
+ export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent;
484
+ export import MessageParam = MessagesAPI.MessageParam;
485
+ export import MessageStartEvent = MessagesAPI.MessageStartEvent;
486
+ export import MessageStopEvent = MessagesAPI.MessageStopEvent;
487
+ export import MessageStreamEvent = MessagesAPI.MessageStreamEvent;
488
+ export import TextBlock = MessagesAPI.TextBlock;
489
+ export import TextDelta = MessagesAPI.TextDelta;
490
+ export import MessageCreateParams = MessagesAPI.MessageCreateParams;
491
+ export import MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
492
+ export import MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
493
+ export import MessageStreamParams = MessagesAPI.MessageStreamParams;
494
+ }
495
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/resources/beta/messages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE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AAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC;IAClE,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;IAChD,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;IAChD,MAAM,QAAQ,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC;IACpE,MAAM,QAAQ,+BAA+B,GAAG,WAAW,CAAC,+BAA+B,CAAC;IAC5F,MAAM,QAAQ,4BAA4B,GAAG,WAAW,CAAC,4BAA4B,CAAC;IACtF,MAAM,QAAQ,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC;CACrE"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Messages = exports.MessageStream = void 0;
5
+ const resource_1 = require("@anthropic-ai/sdk/resource");
6
+ const MessageStream_1 = require("@anthropic-ai/sdk/lib/MessageStream");
7
+ var MessageStream_2 = require("@anthropic-ai/sdk/lib/MessageStream");
8
+ Object.defineProperty(exports, "MessageStream", { enumerable: true, get: function () { return MessageStream_2.MessageStream; } });
9
+ class Messages extends resource_1.APIResource {
10
+ create(body, options) {
11
+ return this._client.post('/v1/messages', {
12
+ body,
13
+ timeout: 600000,
14
+ ...options,
15
+ headers: { 'Anthropic-Beta': 'messages-2023-12-15', ...options?.headers },
16
+ stream: body.stream ?? false,
17
+ });
18
+ }
19
+ /**
20
+ * Create a Message stream
21
+ */
22
+ stream(body, options) {
23
+ return MessageStream_1.MessageStream.createMessage(this._client.beta.messages, body, options);
24
+ }
25
+ }
26
+ exports.Messages = Messages;
27
+ (function (Messages) {
28
+ })(Messages = exports.Messages || (exports.Messages = {}));
29
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/resources/beta/messages.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAIrD,yDAAyD;AACzD,uEAAoE;AACpE,qEAAoE;AAA3D,8GAAA,aAAa,OAAA;AAItB,MAAa,QAAS,SAAQ,sBAAW;IAevC,MAAM,CACJ,IAAyB,EACzB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,OAAO,EAAE,MAAM;YACf,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;YACzE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;SAC7B,CAAiE,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAA6B;QAC7D,OAAO,6BAAa,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;CACF;AAlCD,4BAkCC;AAugBD,WAAiB,QAAQ;AAiBzB,CAAC,EAjBgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAiBxB"}
@@ -0,0 +1,24 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+ import { APIResource } from '@anthropic-ai/sdk/resource';
3
+ import { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';
4
+ export { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';
5
+ export class Messages extends APIResource {
6
+ create(body, options) {
7
+ return this._client.post('/v1/messages', {
8
+ body,
9
+ timeout: 600000,
10
+ ...options,
11
+ headers: { 'Anthropic-Beta': 'messages-2023-12-15', ...options?.headers },
12
+ stream: body.stream ?? false,
13
+ });
14
+ }
15
+ /**
16
+ * Create a Message stream
17
+ */
18
+ stream(body, options) {
19
+ return MessageStream.createMessage(this._client.beta.messages, body, options);
20
+ }
21
+ }
22
+ (function (Messages) {
23
+ })(Messages || (Messages = {}));
24
+ //# sourceMappingURL=messages.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../src/resources/beta/messages.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAI9C,EAAE,WAAW,EAAE,MAAM,4BAA4B;OACjD,EAAE,aAAa,EAAE,MAAM,qCAAqC;OAC5D,EAAE,aAAa,EAAE,MAAM,qCAAqC;AAInE,MAAM,OAAO,QAAS,SAAQ,WAAW;IAevC,MAAM,CACJ,IAAyB,EACzB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,OAAO,EAAE,MAAM;YACf,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;YACzE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;SAC7B,CAAiE,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAA6B;QAC7D,OAAO,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;CACF;AAugBD,WAAiB,QAAQ;AAiBzB,CAAC,EAjBgB,QAAQ,KAAR,QAAQ,QAiBxB"}