@puku-ai/sdk 4.0.2 → 4.0.4

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 (214) hide show
  1. package/README.md +24 -7
  2. package/dist/index.cjs +85 -0
  3. package/dist/vendor/_vendor/partial-json-parser/parser.cjs +225 -0
  4. package/dist/vendor/api-promise.cjs +18 -0
  5. package/dist/vendor/client.cjs +1013 -0
  6. package/dist/vendor/core/api-promise.cjs +80 -0
  7. package/dist/vendor/core/api.cjs +2 -0
  8. package/dist/vendor/core/credentials.cjs +313 -0
  9. package/dist/vendor/core/error.cjs +156 -0
  10. package/dist/vendor/core/middleware.cjs +173 -0
  11. package/dist/vendor/core/pagination.cjs +215 -0
  12. package/dist/vendor/core/resource.cjs +11 -0
  13. package/dist/vendor/core/streaming.cjs +346 -0
  14. package/dist/vendor/core/uploads.cjs +5 -0
  15. package/dist/vendor/error.cjs +18 -0
  16. package/dist/vendor/helpers/beta/environments.cjs +30 -0
  17. package/dist/vendor/helpers/beta/json-schema.cjs +56 -0
  18. package/dist/vendor/helpers/beta/mcp.cjs +418 -0
  19. package/dist/vendor/helpers/beta/memory.cjs +17 -0
  20. package/dist/vendor/helpers/beta/standard-schema.cjs +57 -0
  21. package/dist/vendor/helpers/beta/zod.cjs +88 -0
  22. package/dist/vendor/helpers/index.cjs +7 -0
  23. package/dist/vendor/helpers/json-schema.cjs +36 -0
  24. package/dist/vendor/helpers/zod.cjs +77 -0
  25. package/dist/vendor/index.cjs +54 -0
  26. package/dist/vendor/internal/builtin-types.cjs +3 -0
  27. package/dist/vendor/internal/constants.cjs +12 -0
  28. package/dist/vendor/internal/decoders/jsonl.cjs +40 -0
  29. package/dist/vendor/internal/decoders/line.cjs +109 -0
  30. package/dist/vendor/internal/detect-platform.cjs +159 -0
  31. package/dist/vendor/internal/errors.cjs +42 -0
  32. package/dist/vendor/internal/file-store.cjs +535 -0
  33. package/dist/vendor/internal/headers.cjs +119 -0
  34. package/dist/vendor/internal/message-stream-utils.cjs +33 -0
  35. package/dist/vendor/internal/node.browser.cjs +21 -0
  36. package/dist/vendor/internal/node.cjs +55 -0
  37. package/dist/vendor/internal/parse.cjs +65 -0
  38. package/dist/vendor/internal/qs/formats.cjs +12 -0
  39. package/dist/vendor/internal/qs/index.cjs +13 -0
  40. package/dist/vendor/internal/qs/stringify.cjs +276 -0
  41. package/dist/vendor/internal/qs/types.cjs +2 -0
  42. package/dist/vendor/internal/qs/utils.cjs +229 -0
  43. package/dist/vendor/internal/request-options.cjs +31 -0
  44. package/dist/vendor/internal/request-signal.cjs +49 -0
  45. package/dist/vendor/internal/shim-types.cjs +3 -0
  46. package/dist/vendor/internal/shims.cjs +91 -0
  47. package/dist/vendor/internal/stainless-helper-header.cjs +90 -0
  48. package/dist/vendor/internal/stream-utils.cjs +37 -0
  49. package/dist/vendor/internal/to-file.cjs +95 -0
  50. package/dist/vendor/internal/types.cjs +3 -0
  51. package/dist/vendor/internal/uploads.cjs +148 -0
  52. package/dist/vendor/internal/utils/abort.cjs +24 -0
  53. package/dist/vendor/internal/utils/async-queue.cjs +69 -0
  54. package/dist/vendor/internal/utils/backoff.cjs +43 -0
  55. package/dist/vendor/internal/utils/base64.cjs +37 -0
  56. package/dist/vendor/internal/utils/bytes.cjs +30 -0
  57. package/dist/vendor/internal/utils/env.cjs +21 -0
  58. package/dist/vendor/internal/utils/log.cjs +111 -0
  59. package/dist/vendor/internal/utils/path.cjs +78 -0
  60. package/dist/vendor/internal/utils/promise.cjs +17 -0
  61. package/dist/vendor/internal/utils/query.cjs +41 -0
  62. package/dist/vendor/internal/utils/sleep.cjs +27 -0
  63. package/dist/vendor/internal/utils/time.cjs +7 -0
  64. package/dist/vendor/internal/utils/uuid.cjs +18 -0
  65. package/dist/vendor/internal/utils/values.cjs +125 -0
  66. package/dist/vendor/internal/utils.cjs +24 -0
  67. package/dist/vendor/lib/BetaMessageStream.cjs +665 -0
  68. package/dist/vendor/lib/MessageStream.cjs +612 -0
  69. package/dist/vendor/lib/beta-parser.cjs +78 -0
  70. package/dist/vendor/lib/credentials/credential-chain.cjs +244 -0
  71. package/dist/vendor/lib/credentials/identity-token.cjs +71 -0
  72. package/dist/vendor/lib/credentials/oidc-federation.cjs +81 -0
  73. package/dist/vendor/lib/credentials/token-cache.cjs +113 -0
  74. package/dist/vendor/lib/credentials/types.cjs +267 -0
  75. package/dist/vendor/lib/credentials/user-oauth.cjs +129 -0
  76. package/dist/vendor/lib/credentials.cjs +7 -0
  77. package/dist/vendor/lib/environments/index.cjs +17 -0
  78. package/dist/vendor/lib/environments/poller.cjs +226 -0
  79. package/dist/vendor/lib/environments/worker.cjs +609 -0
  80. package/dist/vendor/lib/helper-client.cjs +57 -0
  81. package/dist/vendor/lib/middleware.cjs +779 -0
  82. package/dist/vendor/lib/parser.cjs +65 -0
  83. package/dist/vendor/lib/sessions/accumulate.cjs +44 -0
  84. package/dist/vendor/lib/standard-schema.cjs +44 -0
  85. package/dist/vendor/lib/tools/BetaRunnableTool.cjs +30 -0
  86. package/dist/vendor/lib/tools/BetaToolRunner.cjs +500 -0
  87. package/dist/vendor/lib/tools/BetaToolRunner.d.ts +1 -1
  88. package/dist/vendor/lib/tools/CompactionControl.cjs +27 -0
  89. package/dist/vendor/lib/tools/SessionToolRunner.cjs +740 -0
  90. package/dist/vendor/lib/tools/ToolError.cjs +46 -0
  91. package/dist/vendor/lib/transform-json-schema.cjs +113 -0
  92. package/dist/vendor/pagination.cjs +18 -0
  93. package/dist/vendor/resource.cjs +18 -0
  94. package/dist/vendor/resources/beta/agents/agents.cjs +159 -0
  95. package/dist/vendor/resources/beta/agents/agents.d.ts +3 -3
  96. package/dist/vendor/resources/beta/agents/agents.js +1 -1
  97. package/dist/vendor/resources/beta/agents/index.cjs +8 -0
  98. package/dist/vendor/resources/beta/agents/versions.cjs +35 -0
  99. package/dist/vendor/resources/beta/agents.cjs +18 -0
  100. package/dist/vendor/resources/beta/beta.cjs +105 -0
  101. package/dist/vendor/resources/beta/deployment-runs.cjs +54 -0
  102. package/dist/vendor/resources/beta/deployments.cjs +195 -0
  103. package/dist/vendor/resources/beta/dreams.cjs +115 -0
  104. package/dist/vendor/resources/beta/dreams.d.ts +2 -2
  105. package/dist/vendor/resources/beta/environments/environments.cjs +178 -0
  106. package/dist/vendor/resources/beta/environments/index.cjs +8 -0
  107. package/dist/vendor/resources/beta/environments/work.cjs +256 -0
  108. package/dist/vendor/resources/beta/environments.cjs +18 -0
  109. package/dist/vendor/resources/beta/files.cjs +123 -0
  110. package/dist/vendor/resources/beta/index.cjs +38 -0
  111. package/dist/vendor/resources/beta/memory-stores/index.cjs +10 -0
  112. package/dist/vendor/resources/beta/memory-stores/memories.cjs +129 -0
  113. package/dist/vendor/resources/beta/memory-stores/memory-stores.cjs +173 -0
  114. package/dist/vendor/resources/beta/memory-stores/memory-versions.cjs +80 -0
  115. package/dist/vendor/resources/beta/memory-stores.cjs +18 -0
  116. package/dist/vendor/resources/beta/messages/batches.cjs +206 -0
  117. package/dist/vendor/resources/beta/messages/batches.d.ts +3 -3
  118. package/dist/vendor/resources/beta/messages/index.cjs +11 -0
  119. package/dist/vendor/resources/beta/messages/messages.cjs +189 -0
  120. package/dist/vendor/resources/beta/messages/messages.d.ts +5 -5
  121. package/dist/vendor/resources/beta/messages/messages.js +4 -11
  122. package/dist/vendor/resources/beta/messages/messages.js.map +1 -1
  123. package/dist/vendor/resources/beta/messages.cjs +18 -0
  124. package/dist/vendor/resources/beta/models.cjs +59 -0
  125. package/dist/vendor/resources/beta/organization/api-keys.cjs +55 -0
  126. package/dist/vendor/resources/beta/organization/compliance-settings.cjs +51 -0
  127. package/dist/vendor/resources/beta/organization/external-keys.cjs +118 -0
  128. package/dist/vendor/resources/beta/organization/federation/federation.cjs +49 -0
  129. package/dist/vendor/resources/beta/organization/federation/index.cjs +10 -0
  130. package/dist/vendor/resources/beta/organization/federation/issuers.cjs +168 -0
  131. package/dist/vendor/resources/beta/organization/federation/rules/index.cjs +8 -0
  132. package/dist/vendor/resources/beta/organization/federation/rules/rules.cjs +226 -0
  133. package/dist/vendor/resources/beta/organization/federation/rules/workspaces.cjs +113 -0
  134. package/dist/vendor/resources/beta/organization/federation/rules.cjs +18 -0
  135. package/dist/vendor/resources/beta/organization/federation.cjs +18 -0
  136. package/dist/vendor/resources/beta/organization/index.cjs +24 -0
  137. package/dist/vendor/resources/beta/organization/invites.cjs +75 -0
  138. package/dist/vendor/resources/beta/organization/organization.cjs +90 -0
  139. package/dist/vendor/resources/beta/organization/rate-limits.cjs +30 -0
  140. package/dist/vendor/resources/beta/organization/service-accounts/index.cjs +8 -0
  141. package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.cjs +202 -0
  142. package/dist/vendor/resources/beta/organization/service-accounts/workspaces.cjs +124 -0
  143. package/dist/vendor/resources/beta/organization/service-accounts.cjs +18 -0
  144. package/dist/vendor/resources/beta/organization/users.cjs +66 -0
  145. package/dist/vendor/resources/beta/organization/workspaces/index.cjs +12 -0
  146. package/dist/vendor/resources/beta/organization/workspaces/members.cjs +101 -0
  147. package/dist/vendor/resources/beta/organization/workspaces/rate-limits.cjs +33 -0
  148. package/dist/vendor/resources/beta/organization/workspaces/service-accounts.cjs +188 -0
  149. package/dist/vendor/resources/beta/organization/workspaces/workspaces.cjs +140 -0
  150. package/dist/vendor/resources/beta/organization/workspaces.cjs +18 -0
  151. package/dist/vendor/resources/beta/organization.cjs +18 -0
  152. package/dist/vendor/resources/beta/sessions/events.cjs +119 -0
  153. package/dist/vendor/resources/beta/sessions/index.cjs +12 -0
  154. package/dist/vendor/resources/beta/sessions/resources.cjs +131 -0
  155. package/dist/vendor/resources/beta/sessions/sessions.cjs +186 -0
  156. package/dist/vendor/resources/beta/sessions/sessions.d.ts +1 -1
  157. package/dist/vendor/resources/beta/sessions/threads/events.cjs +60 -0
  158. package/dist/vendor/resources/beta/sessions/threads/index.cjs +8 -0
  159. package/dist/vendor/resources/beta/sessions/threads/threads.cjs +116 -0
  160. package/dist/vendor/resources/beta/sessions/threads.cjs +18 -0
  161. package/dist/vendor/resources/beta/sessions.cjs +18 -0
  162. package/dist/vendor/resources/beta/skills/index.cjs +8 -0
  163. package/dist/vendor/resources/beta/skills/skills.cjs +132 -0
  164. package/dist/vendor/resources/beta/skills/versions.cjs +128 -0
  165. package/dist/vendor/resources/beta/skills.cjs +18 -0
  166. package/dist/vendor/resources/beta/tunnels/certificates.cjs +128 -0
  167. package/dist/vendor/resources/beta/tunnels/index.cjs +8 -0
  168. package/dist/vendor/resources/beta/tunnels/tunnels.cjs +209 -0
  169. package/dist/vendor/resources/beta/tunnels.cjs +18 -0
  170. package/dist/vendor/resources/beta/user-profiles.cjs +117 -0
  171. package/dist/vendor/resources/beta/vaults/credentials.cjs +176 -0
  172. package/dist/vendor/resources/beta/vaults/index.cjs +8 -0
  173. package/dist/vendor/resources/beta/vaults/vaults.cjs +177 -0
  174. package/dist/vendor/resources/beta/vaults.cjs +18 -0
  175. package/dist/vendor/resources/beta/webhooks.cjs +32 -0
  176. package/dist/vendor/resources/beta.cjs +18 -0
  177. package/dist/vendor/resources/completions.cjs +22 -0
  178. package/dist/vendor/resources/completions.d.ts +3 -3
  179. package/dist/vendor/resources/files.cjs +51 -0
  180. package/dist/vendor/resources/index.cjs +31 -0
  181. package/dist/vendor/resources/messages/batches.cjs +160 -0
  182. package/dist/vendor/resources/messages/batches.d.ts +1 -1
  183. package/dist/vendor/resources/messages/batches.js +1 -1
  184. package/dist/vendor/resources/messages/index.cjs +8 -0
  185. package/dist/vendor/resources/messages/messages.cjs +159 -0
  186. package/dist/vendor/resources/messages/messages.d.ts +7 -7
  187. package/dist/vendor/resources/messages/messages.js +6 -13
  188. package/dist/vendor/resources/messages/messages.js.map +1 -1
  189. package/dist/vendor/resources/messages.cjs +18 -0
  190. package/dist/vendor/resources/models.cjs +44 -0
  191. package/dist/vendor/resources/shared.cjs +3 -0
  192. package/dist/vendor/resources/skills/index.cjs +8 -0
  193. package/dist/vendor/resources/skills/skills.cjs +72 -0
  194. package/dist/vendor/resources/skills/versions.cjs +40 -0
  195. package/dist/vendor/resources/skills.cjs +18 -0
  196. package/dist/vendor/resources/top-level.cjs +3 -0
  197. package/dist/vendor/resources.cjs +17 -0
  198. package/dist/vendor/streaming.cjs +18 -0
  199. package/dist/vendor/tools/agent-toolset/fs-util.cjs +193 -0
  200. package/dist/vendor/tools/agent-toolset/memories.cjs +916 -0
  201. package/dist/vendor/tools/agent-toolset/node.browser.cjs +147 -0
  202. package/dist/vendor/tools/agent-toolset/node.cjs +939 -0
  203. package/dist/vendor/tools/agent-toolset/skills.cjs +325 -0
  204. package/dist/vendor/tools/agent-toolset/sync-interval.cjs +28 -0
  205. package/dist/vendor/tools/memory/node.browser.cjs +48 -0
  206. package/dist/vendor/tools/memory/node.cjs +364 -0
  207. package/dist/vendor/uploads.cjs +18 -0
  208. package/dist/vendor/version.cjs +4 -0
  209. package/package.json +12 -13
  210. package/sdk.cjs +0 -14293
  211. package/sdk.cjs.map +0 -149
  212. package/sdk.d.ts +0 -10866
  213. package/sdk.mjs +0 -68
  214. package/sdk.mjs.map +0 -149
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Batches = void 0;
5
+ const resource_1 = require("../../core/resource");
6
+ const pagination_1 = require("../../core/pagination");
7
+ const headers_1 = require("../../internal/headers");
8
+ const jsonl_1 = require("../../internal/decoders/jsonl");
9
+ const error_1 = require("../../error");
10
+ const path_1 = require("../../internal/utils/path");
11
+ class Batches extends resource_1.APIResource {
12
+ /**
13
+ * Send a batch of Message creation requests.
14
+ *
15
+ * The Message Batches API can be used to process multiple Messages API requests at
16
+ * once. Once a Message Batch is created, it begins processing immediately. Batches
17
+ * can take up to 24 hours to complete.
18
+ *
19
+ * Learn more about the Message Batches API in our
20
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/batch-processing)
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const messageBatch = await client.messages.batches.create({
25
+ * requests: [
26
+ * {
27
+ * custom_id: 'my-custom-id-1',
28
+ * params: {
29
+ * max_tokens: 1024,
30
+ * messages: [
31
+ * { content: 'Hello, world', role: 'user' },
32
+ * ],
33
+ * model: 'puku-ai-2.8',
34
+ * },
35
+ * },
36
+ * ],
37
+ * });
38
+ * ```
39
+ */
40
+ create(params, options) {
41
+ const { user_profile_id, ...body } = params;
42
+ return this._client.post('/v1/messages/batches', {
43
+ body,
44
+ ...options,
45
+ headers: (0, headers_1.buildHeaders)([
46
+ { ...(user_profile_id != null ? { 'puku-user-profile-id': user_profile_id } : undefined) },
47
+ options?.headers,
48
+ ]),
49
+ });
50
+ }
51
+ /**
52
+ * This endpoint is idempotent and can be used to poll for Message Batch
53
+ * completion. To access the results of a Message Batch, make a request to the
54
+ * `results_url` field in the response.
55
+ *
56
+ * Learn more about the Message Batches API in our
57
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/batch-processing)
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const messageBatch = await client.messages.batches.retrieve(
62
+ * 'message_batch_id',
63
+ * );
64
+ * ```
65
+ */
66
+ retrieve(messageBatchID, options) {
67
+ return this._client.get((0, path_1.path) `/v1/messages/batches/${messageBatchID}`, options);
68
+ }
69
+ /**
70
+ * List all Message Batches within a Workspace. Most recently created batches are
71
+ * returned first.
72
+ *
73
+ * Learn more about the Message Batches API in our
74
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/batch-processing)
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * // Automatically fetches more pages as needed.
79
+ * for await (const messageBatch of client.messages.batches.list()) {
80
+ * // ...
81
+ * }
82
+ * ```
83
+ */
84
+ list(query = {}, options) {
85
+ return this._client.getAPIList('/v1/messages/batches', (pagination_1.Page), { query, ...options });
86
+ }
87
+ /**
88
+ * Delete a Message Batch.
89
+ *
90
+ * Message Batches can only be deleted once they've finished processing. If you'd
91
+ * like to delete an in-progress batch, you must first cancel it.
92
+ *
93
+ * Learn more about the Message Batches API in our
94
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/batch-processing)
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const deletedMessageBatch =
99
+ * await client.messages.batches.delete('message_batch_id');
100
+ * ```
101
+ */
102
+ delete(messageBatchID, options) {
103
+ return this._client.delete((0, path_1.path) `/v1/messages/batches/${messageBatchID}`, options);
104
+ }
105
+ /**
106
+ * Batches may be canceled any time before processing ends. Once cancellation is
107
+ * initiated, the batch enters a `canceling` state, at which time the system may
108
+ * complete any in-progress, non-interruptible requests before finalizing
109
+ * cancellation.
110
+ *
111
+ * The number of canceled requests is specified in `request_counts`. To determine
112
+ * which requests were canceled, check the individual results within the batch.
113
+ * Note that cancellation may not result in any canceled requests if they were
114
+ * non-interruptible.
115
+ *
116
+ * Learn more about the Message Batches API in our
117
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/batch-processing)
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const messageBatch = await client.messages.batches.cancel(
122
+ * 'message_batch_id',
123
+ * );
124
+ * ```
125
+ */
126
+ cancel(messageBatchID, options) {
127
+ return this._client.post((0, path_1.path) `/v1/messages/batches/${messageBatchID}/cancel`, options);
128
+ }
129
+ /**
130
+ * Streams the results of a Message Batch as a `.jsonl` file.
131
+ *
132
+ * Each line in the file is a JSON object containing the result of a single request
133
+ * in the Message Batch. Results are not guaranteed to be in the same order as
134
+ * requests. Use the `custom_id` field to match results to requests.
135
+ *
136
+ * Learn more about the Message Batches API in our
137
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/batch-processing)
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const messageBatchIndividualResponse =
142
+ * await client.messages.batches.results('message_batch_id');
143
+ * ```
144
+ */
145
+ async results(messageBatchID, options) {
146
+ const batch = await this.retrieve(messageBatchID);
147
+ if (!batch.results_url) {
148
+ throw new error_1.PukuError(`No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`);
149
+ }
150
+ return this._client
151
+ .get(batch.results_url, {
152
+ ...options,
153
+ headers: (0, headers_1.buildHeaders)([{ Accept: 'application/binary' }, options?.headers]),
154
+ stream: true,
155
+ __binaryResponse: true,
156
+ })
157
+ ._thenUnwrap((_, props) => jsonl_1.JSONLDecoder.fromResponse(props.response, props.controller));
158
+ }
159
+ }
160
+ exports.Batches = Batches;
@@ -27,7 +27,7 @@ export declare class Batches extends APIResource {
27
27
  * messages: [
28
28
  * { content: 'Hello, world', role: 'user' },
29
29
  * ],
30
- * model: 'puku-opus-5',
30
+ * model: 'puku-ai-2.8',
31
31
  * },
32
32
  * },
33
33
  * ],
@@ -27,7 +27,7 @@ export class Batches extends APIResource {
27
27
  * messages: [
28
28
  * { content: 'Hello, world', role: 'user' },
29
29
  * ],
30
- * model: 'puku-opus-5',
30
+ * model: 'puku-ai-2.8',
31
31
  * },
32
32
  * },
33
33
  * ],
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Messages = exports.Batches = void 0;
5
+ var batches_1 = require("./batches");
6
+ Object.defineProperty(exports, "Batches", { enumerable: true, get: function () { return batches_1.Batches; } });
7
+ var messages_1 = require("./messages");
8
+ Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_1.Messages; } });
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Messages = void 0;
38
+ const resource_1 = require("../../core/resource");
39
+ const headers_1 = require("../../internal/headers");
40
+ const stainless_helper_header_1 = require("../../internal/stainless-helper-header");
41
+ const MessageStream_1 = require("../../lib/MessageStream");
42
+ const parser_1 = require("../../lib/parser");
43
+ const BatchesAPI = __importStar(require("./batches"));
44
+ const batches_1 = require("./batches");
45
+ const constants_1 = require("../../internal/constants");
46
+ class Messages extends resource_1.APIResource {
47
+ batches = new BatchesAPI.Batches(this._client);
48
+ create(params, options) {
49
+ const { user_profile_id, ...body } = params;
50
+ if (body.model in DEPRECATED_MODELS) {
51
+ console.warn(`The Puku SDK model '${body.model}' is deprecated and will reach end-of-life on ${DEPRECATED_MODELS[body.model]}\nPlease migrate to a newer model. Visit https://puku.ai/docs/resources/model-deprecations for more information.`);
52
+ }
53
+ if (MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) &&
54
+ body.thinking &&
55
+ body.thinking.type === 'enabled') {
56
+ console.warn(`Using Puku with ${body.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://puku.ai/docs/en/build-with-puku/adaptive-thinking`);
57
+ }
58
+ let timeout = options?.timeout ?? this._client._options.timeout;
59
+ if (!body.stream && timeout == null) {
60
+ const maxNonstreamingTokens = constants_1.MODEL_NONSTREAMING_TOKENS[body.model] ?? undefined;
61
+ timeout = this._client.calculateNonstreamingTimeout(body.max_tokens, maxNonstreamingTokens);
62
+ }
63
+ // Collect helper info from tools and messages
64
+ const helperHeader = (0, stainless_helper_header_1.stainlessHelperHeader)(body.tools, body.messages);
65
+ return this._client.post('/v1/messages', {
66
+ body,
67
+ timeout: timeout ?? 600000,
68
+ ...options,
69
+ headers: (0, headers_1.buildHeaders)([
70
+ { ...(user_profile_id != null ? { 'puku-user-profile-id': user_profile_id } : undefined) },
71
+ helperHeader,
72
+ options?.headers,
73
+ ]),
74
+ stream: params.stream ?? false,
75
+ });
76
+ }
77
+ /**
78
+ * Send a structured list of input messages with text and/or image content, along with an expected `output_config.format` and
79
+ * the response will be automatically parsed and available in the `parsed_output` property of the message.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const message = await client.messages.parse({
84
+ * model: 'puku-ai-2.8',
85
+ * max_tokens: 1024,
86
+ * messages: [{ role: 'user', content: 'What is 2+2?' }],
87
+ * output_config: {
88
+ * format: zodOutputFormat(z.object({ answer: z.number() })),
89
+ * },
90
+ * });
91
+ *
92
+ * console.log(message.parsed_output?.answer); // 4
93
+ * ```
94
+ */
95
+ parse(params, options) {
96
+ return this.create(params, options).then((message) => (0, parser_1.parseMessage)(message, params, { logger: this._client.logger ?? console }));
97
+ }
98
+ /**
99
+ * Create a Message stream.
100
+ *
101
+ * If `output_config.format` is provided with a parseable format (like `zodOutputFormat()`),
102
+ * the final message will include a `parsed_output` property with the parsed content.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const stream = client.messages.stream({
107
+ * model: 'puku-ai-2.8',
108
+ * max_tokens: 1024,
109
+ * messages: [{ role: 'user', content: 'What is 2+2?' }],
110
+ * output_config: {
111
+ * format: zodOutputFormat(z.object({ answer: z.number() })),
112
+ * },
113
+ * });
114
+ *
115
+ * const message = await stream.finalMessage();
116
+ * console.log(message.parsed_output?.answer); // 4
117
+ * ```
118
+ */
119
+ stream(body, options) {
120
+ return MessageStream_1.MessageStream.createMessage(this, body, options, { logger: this._client.logger ?? console });
121
+ }
122
+ /**
123
+ * Count the number of tokens in a Message.
124
+ *
125
+ * The Token Count API can be used to count the number of tokens in a Message,
126
+ * including tools, images, and documents, without creating it.
127
+ *
128
+ * Learn more about token counting in our
129
+ * [user guide](https://platform.puku.com/docs/en/build-with-puku/token-counting)
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const messageTokensCount =
134
+ * await client.messages.countTokens({
135
+ * messages: [{ content: 'Hello, world', role: 'user' }],
136
+ * model: 'puku-ai-2.8',
137
+ * });
138
+ * ```
139
+ */
140
+ countTokens(params, options) {
141
+ const { user_profile_id, ...body } = params;
142
+ return this._client.post('/v1/messages/count_tokens', {
143
+ body,
144
+ ...options,
145
+ headers: (0, headers_1.buildHeaders)([
146
+ { ...(user_profile_id != null ? { 'puku-user-profile-id': user_profile_id } : undefined) },
147
+ options?.headers,
148
+ ]),
149
+ });
150
+ }
151
+ }
152
+ exports.Messages = Messages;
153
+ const DEPRECATED_MODELS = {
154
+ // Puku AI exposes `puku-ai-2.7`, `puku-ai-2.8`, and `opus-4.8`. None of
155
+ // these are deprecated at this time — extend this map when (and only
156
+ // when) a model is announced for retirement. Date format: 'Month Dth, YYYY'.
157
+ };
158
+ const MODELS_TO_WARN_WITH_THINKING_ENABLED = [];
159
+ Messages.Batches = batches_1.Batches;
@@ -24,7 +24,7 @@ export declare class Messages extends APIResource {
24
24
  * const message = await client.messages.create({
25
25
  * max_tokens: 1024,
26
26
  * messages: [{ content: 'Hello, world', role: 'user' }],
27
- * model: 'puku-opus-5',
27
+ * model: 'puku-ai-2.8',
28
28
  * });
29
29
  * ```
30
30
  */
@@ -38,7 +38,7 @@ export declare class Messages extends APIResource {
38
38
  * @example
39
39
  * ```ts
40
40
  * const message = await client.messages.parse({
41
- * model: 'puku-sonnet-4-5-20250929',
41
+ * model: 'puku-ai-2.8',
42
42
  * max_tokens: 1024,
43
43
  * messages: [{ role: 'user', content: 'What is 2+2?' }],
44
44
  * output_config: {
@@ -59,7 +59,7 @@ export declare class Messages extends APIResource {
59
59
  * @example
60
60
  * ```ts
61
61
  * const stream = client.messages.stream({
62
- * model: 'puku-sonnet-4-5-20250929',
62
+ * model: 'puku-ai-2.8',
63
63
  * max_tokens: 1024,
64
64
  * messages: [{ role: 'user', content: 'What is 2+2?' }],
65
65
  * output_config: {
@@ -86,7 +86,7 @@ export declare class Messages extends APIResource {
86
86
  * const messageTokensCount =
87
87
  * await client.messages.countTokens({
88
88
  * messages: [{ content: 'Hello, world', role: 'user' }],
89
- * model: 'puku-opus-5',
89
+ * model: 'puku-ai-2.8',
90
90
  * });
91
91
  * ```
92
92
  */
@@ -3536,7 +3536,7 @@ export interface MessageCreateParamsBase {
3536
3536
  */
3537
3537
  system?: string | Array<TextBlockParam>;
3538
3538
  /**
3539
- * @deprecated Deprecated. Models released after Puku Opus 4.6 do not support
3539
+ * @deprecated Deprecated. Models released after Puku AI 2.8 do not support
3540
3540
  * setting temperature. A value of 1.0 of will be accepted for backwards
3541
3541
  * compatibility, all other values will be rejected with a 400 error.
3542
3542
  */
@@ -3639,12 +3639,12 @@ export interface MessageCreateParamsBase {
3639
3639
  */
3640
3640
  tools?: Array<ToolUnion>;
3641
3641
  /**
3642
- * @deprecated Deprecated. Models released after Puku Opus 4.6 do not accept
3642
+ * @deprecated Deprecated. Models released after Puku AI 2.8 do not accept
3643
3643
  * top_k; any value will be rejected with a 400 error.
3644
3644
  */
3645
3645
  top_k?: number;
3646
3646
  /**
3647
- * @deprecated Deprecated. Models released after Puku Opus 4.6 do not support
3647
+ * @deprecated Deprecated. Models released after Puku AI 2.8 do not support
3648
3648
  * setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all
3649
3649
  * other values will be rejected with a 400 error.
3650
3650
  */
@@ -45,7 +45,7 @@ export class Messages extends APIResource {
45
45
  * @example
46
46
  * ```ts
47
47
  * const message = await client.messages.parse({
48
- * model: 'puku-sonnet-4-5-20250929',
48
+ * model: 'puku-ai-2.8',
49
49
  * max_tokens: 1024,
50
50
  * messages: [{ role: 'user', content: 'What is 2+2?' }],
51
51
  * output_config: {
@@ -68,7 +68,7 @@ export class Messages extends APIResource {
68
68
  * @example
69
69
  * ```ts
70
70
  * const stream = client.messages.stream({
71
- * model: 'puku-sonnet-4-5-20250929',
71
+ * model: 'puku-ai-2.8',
72
72
  * max_tokens: 1024,
73
73
  * messages: [{ role: 'user', content: 'What is 2+2?' }],
74
74
  * output_config: {
@@ -97,7 +97,7 @@ export class Messages extends APIResource {
97
97
  * const messageTokensCount =
98
98
  * await client.messages.countTokens({
99
99
  * messages: [{ content: 'Hello, world', role: 'user' }],
100
- * model: 'puku-opus-5',
100
+ * model: 'puku-ai-2.8',
101
101
  * });
102
102
  * ```
103
103
  */
@@ -114,16 +114,9 @@ export class Messages extends APIResource {
114
114
  }
115
115
  }
116
116
  const DEPRECATED_MODELS = {
117
- 'puku-1.3': 'November 6th, 2024',
118
- 'puku-1.3-100k': 'November 6th, 2024',
119
- 'puku-instant-1.1': 'November 6th, 2024',
120
- 'puku-instant-1.1-100k': 'November 6th, 2024',
121
- 'puku-instant-1.2': 'November 6th, 2024',
122
- 'puku-3-sonnet-20240229': 'July 21st, 2025',
123
- 'puku-3-opus-20240229': 'January 5th, 2026',
124
- 'puku-2.1': 'July 21st, 2025',
125
- 'puku-2.0': 'July 21st, 2025',
126
- 'puku-3-7-sonnet-latest': 'February 19th, 2026',
117
+ // Puku AI exposes `puku-ai-2.7`, `puku-ai-2.8`, and `opus-4.8`. None of
118
+ // these are deprecated at this time — extend this map when (and only
119
+ // when) a model is announced for retirement. Date format: 'Month Dth, YYYY'.
127
120
  };
128
121
  const MODELS_TO_WARN_WITH_THINKING_ENABLED = [];
129
122
  Messages.Batches = Batches;
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/vendor/resources/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,YAAY,GAIb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AACxC,OAAO,EAGL,OAAO,GAWR,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC,OAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA8BnE,MAAM,CACJ,MAA2B,EAC3B,OAAwB;QAExB,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC5C,IAAI,IAAI,CAAC,KAAK,IAAI,iBAAiB,EAAE,CAAC;YACpC,OAAO,CAAC,IAAI,CACV,uBAAuB,IAAI,CAAC,KAAK,iDAC/B,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAC9B,kHAAkH,CACnH,CAAC;QACJ,CAAC;QACD,IACE,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YACzD,IAAI,CAAC,QAAQ;YACb,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,EAChC,CAAC;YACD,OAAO,CAAC,IAAI,CACV,mBAAmB,IAAI,CAAC,KAAK,sMAAsM,CACpO,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,GAAG,OAAO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;QACpE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE;YACpD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB,EAAE,GAAG,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,sBAAsB,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBAC1F,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AA27ED,MAAM,iBAAiB,GAEnB;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;CAC9E,CAAC;AAEF,MAAM,oCAAoC,GAAY,EAAE,CAAC;AAkzEzD,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./messages/index"), exports);
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Models = void 0;
5
+ const resource_1 = require("../core/resource");
6
+ const pagination_1 = require("../core/pagination");
7
+ const headers_1 = require("../internal/headers");
8
+ const path_1 = require("../internal/utils/path");
9
+ class Models extends resource_1.APIResource {
10
+ /**
11
+ * Get a specific model.
12
+ *
13
+ * The Models API response can be used to determine information about a specific
14
+ * model or resolve a model alias to a model ID.
15
+ */
16
+ retrieve(modelID, params = {}, options) {
17
+ const { betas } = params ?? {};
18
+ return this._client.get((0, path_1.path) `/v1/models/${modelID}`, {
19
+ ...options,
20
+ headers: (0, headers_1.buildHeaders)([
21
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
22
+ options?.headers,
23
+ ]),
24
+ });
25
+ }
26
+ /**
27
+ * List available models.
28
+ *
29
+ * The Models API response can be used to determine which models are available for
30
+ * use in the API. More recently released models are listed first.
31
+ */
32
+ list(params = {}, options) {
33
+ const { betas, ...query } = params ?? {};
34
+ return this._client.getAPIList('/v1/models', (pagination_1.Page), {
35
+ query,
36
+ ...options,
37
+ headers: (0, headers_1.buildHeaders)([
38
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
39
+ options?.headers,
40
+ ]),
41
+ });
42
+ }
43
+ }
44
+ exports.Models = Models;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Versions = exports.Skills = void 0;
5
+ var skills_1 = require("./skills");
6
+ Object.defineProperty(exports, "Skills", { enumerable: true, get: function () { return skills_1.Skills; } });
7
+ var versions_1 = require("./versions");
8
+ Object.defineProperty(exports, "Versions", { enumerable: true, get: function () { return versions_1.Versions; } });
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Skills = void 0;
38
+ const resource_1 = require("../../core/resource");
39
+ const VersionsAPI = __importStar(require("./versions"));
40
+ const versions_1 = require("./versions");
41
+ const pagination_1 = require("../../core/pagination");
42
+ const uploads_1 = require("../../internal/uploads");
43
+ const path_1 = require("../../internal/utils/path");
44
+ class Skills extends resource_1.APIResource {
45
+ versions = new VersionsAPI.Versions(this._client);
46
+ /**
47
+ * Create Skill
48
+ */
49
+ create(body, options) {
50
+ return this._client.post('/v1/skills', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client, false));
51
+ }
52
+ /**
53
+ * Get Skill
54
+ */
55
+ retrieve(skillID, options) {
56
+ return this._client.get((0, path_1.path) `/v1/skills/${skillID}`, options);
57
+ }
58
+ /**
59
+ * List Skills
60
+ */
61
+ list(query = {}, options) {
62
+ return this._client.getAPIList('/v1/skills', (pagination_1.PageCursor), { query, ...options });
63
+ }
64
+ /**
65
+ * Delete Skill
66
+ */
67
+ delete(skillID, options) {
68
+ return this._client.delete((0, path_1.path) `/v1/skills/${skillID}`, options);
69
+ }
70
+ }
71
+ exports.Skills = Skills;
72
+ Skills.Versions = versions_1.Versions;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Versions = void 0;
5
+ const resource_1 = require("../../core/resource");
6
+ const pagination_1 = require("../../core/pagination");
7
+ const uploads_1 = require("../../internal/uploads");
8
+ const path_1 = require("../../internal/utils/path");
9
+ class Versions extends resource_1.APIResource {
10
+ /**
11
+ * Create Skill Version
12
+ */
13
+ create(skillID, body, options) {
14
+ return this._client.post((0, path_1.path) `/v1/skills/${skillID}/versions`, (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client, false));
15
+ }
16
+ /**
17
+ * Get Skill Version
18
+ */
19
+ retrieve(version, params, options) {
20
+ const { skill_id } = params;
21
+ return this._client.get((0, path_1.path) `/v1/skills/${skill_id}/versions/${version}`, options);
22
+ }
23
+ /**
24
+ * List Skill Versions
25
+ */
26
+ list(skillID, query = {}, options) {
27
+ return this._client.getAPIList((0, path_1.path) `/v1/skills/${skillID}/versions`, (pagination_1.PageCursor), {
28
+ query,
29
+ ...options,
30
+ });
31
+ }
32
+ /**
33
+ * Delete Skill Version
34
+ */
35
+ delete(version, params, options) {
36
+ const { skill_id } = params;
37
+ return this._client.delete((0, path_1.path) `/v1/skills/${skill_id}/versions/${version}`, options);
38
+ }
39
+ }
40
+ exports.Versions = Versions;