openlayer 0.11.0 → 0.13.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 (132) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +67 -77
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +17 -3
  7. package/core.d.ts.map +1 -1
  8. package/core.js +32 -18
  9. package/core.js.map +1 -1
  10. package/core.mjs +33 -19
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +8 -5
  13. package/index.d.ts +8 -5
  14. package/index.d.ts.map +1 -1
  15. package/index.js +6 -2
  16. package/index.js.map +1 -1
  17. package/index.mjs +6 -2
  18. package/index.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/resource.d.ts +1 -1
  21. package/resource.d.ts.map +1 -1
  22. package/resource.js.map +1 -1
  23. package/resource.mjs.map +1 -1
  24. package/resources/commits/test-results.d.ts +24 -6
  25. package/resources/commits/test-results.d.ts.map +1 -1
  26. package/resources/commits.d.ts +2 -0
  27. package/resources/commits.d.ts.map +1 -0
  28. package/resources/commits.js +19 -0
  29. package/resources/commits.js.map +1 -0
  30. package/resources/commits.mjs +3 -0
  31. package/resources/commits.mjs.map +1 -0
  32. package/resources/inference-pipelines/data.d.ts +23 -1
  33. package/resources/inference-pipelines/data.d.ts.map +1 -1
  34. package/resources/inference-pipelines/data.js +20 -0
  35. package/resources/inference-pipelines/data.js.map +1 -1
  36. package/resources/inference-pipelines/data.mjs +20 -0
  37. package/resources/inference-pipelines/data.mjs.map +1 -1
  38. package/resources/inference-pipelines/inference-pipelines.d.ts +95 -0
  39. package/resources/inference-pipelines/inference-pipelines.d.ts.map +1 -1
  40. package/resources/inference-pipelines/inference-pipelines.js +7 -0
  41. package/resources/inference-pipelines/inference-pipelines.js.map +1 -1
  42. package/resources/inference-pipelines/inference-pipelines.mjs +7 -0
  43. package/resources/inference-pipelines/inference-pipelines.mjs.map +1 -1
  44. package/resources/inference-pipelines/rows.d.ts +8 -0
  45. package/resources/inference-pipelines/rows.d.ts.map +1 -1
  46. package/resources/inference-pipelines/rows.js +8 -0
  47. package/resources/inference-pipelines/rows.js.map +1 -1
  48. package/resources/inference-pipelines/rows.mjs +8 -0
  49. package/resources/inference-pipelines/rows.mjs.map +1 -1
  50. package/resources/inference-pipelines/test-results.d.ts +31 -5
  51. package/resources/inference-pipelines/test-results.d.ts.map +1 -1
  52. package/resources/inference-pipelines/test-results.js.map +1 -1
  53. package/resources/inference-pipelines/test-results.mjs.map +1 -1
  54. package/resources/inference-pipelines.d.ts +2 -0
  55. package/resources/inference-pipelines.d.ts.map +1 -0
  56. package/resources/inference-pipelines.js +19 -0
  57. package/resources/inference-pipelines.js.map +1 -0
  58. package/resources/inference-pipelines.mjs +3 -0
  59. package/resources/inference-pipelines.mjs.map +1 -0
  60. package/resources/projects/commits.d.ts +18 -0
  61. package/resources/projects/commits.d.ts.map +1 -1
  62. package/resources/projects/commits.js +11 -0
  63. package/resources/projects/commits.js.map +1 -1
  64. package/resources/projects/commits.mjs +11 -0
  65. package/resources/projects/commits.mjs.map +1 -1
  66. package/resources/projects/index.d.ts +1 -0
  67. package/resources/projects/index.d.ts.map +1 -1
  68. package/resources/projects/index.js +3 -1
  69. package/resources/projects/index.js.map +1 -1
  70. package/resources/projects/index.mjs +1 -0
  71. package/resources/projects/index.mjs.map +1 -1
  72. package/resources/projects/inference-pipelines.d.ts +104 -0
  73. package/resources/projects/inference-pipelines.d.ts.map +1 -1
  74. package/resources/projects/inference-pipelines.js +12 -0
  75. package/resources/projects/inference-pipelines.js.map +1 -1
  76. package/resources/projects/inference-pipelines.mjs +12 -0
  77. package/resources/projects/inference-pipelines.mjs.map +1 -1
  78. package/resources/projects/projects.d.ts +17 -0
  79. package/resources/projects/projects.d.ts.map +1 -1
  80. package/resources/projects/projects.js +12 -0
  81. package/resources/projects/projects.js.map +1 -1
  82. package/resources/projects/projects.mjs +12 -0
  83. package/resources/projects/projects.mjs.map +1 -1
  84. package/resources/projects/tests.d.ts +501 -0
  85. package/resources/projects/tests.d.ts.map +1 -0
  86. package/resources/projects/tests.js +55 -0
  87. package/resources/projects/tests.js.map +1 -0
  88. package/resources/projects/tests.mjs +51 -0
  89. package/resources/projects/tests.mjs.map +1 -0
  90. package/resources/projects.d.ts +2 -0
  91. package/resources/projects.d.ts.map +1 -0
  92. package/resources/projects.js +19 -0
  93. package/resources/projects.js.map +1 -0
  94. package/resources/projects.mjs +3 -0
  95. package/resources/projects.mjs.map +1 -0
  96. package/resources/storage.d.ts +2 -0
  97. package/resources/storage.d.ts.map +1 -0
  98. package/resources/storage.js +19 -0
  99. package/resources/storage.js.map +1 -0
  100. package/resources/storage.mjs +3 -0
  101. package/resources/storage.mjs.map +1 -0
  102. package/resources.d.ts +2 -0
  103. package/resources.d.ts.map +1 -0
  104. package/resources.js +18 -0
  105. package/resources.js.map +1 -0
  106. package/resources.mjs +2 -0
  107. package/resources.mjs.map +1 -0
  108. package/src/_shims/index.d.ts +2 -0
  109. package/src/_shims/index.js +5 -1
  110. package/src/_shims/index.mjs +5 -1
  111. package/src/core.ts +51 -17
  112. package/src/index.ts +15 -5
  113. package/src/resource.ts +1 -1
  114. package/src/resources/commits/test-results.ts +102 -6
  115. package/src/resources/commits.ts +3 -0
  116. package/src/resources/inference-pipelines/data.ts +21 -1
  117. package/src/resources/inference-pipelines/inference-pipelines.ts +95 -0
  118. package/src/resources/inference-pipelines/rows.ts +8 -0
  119. package/src/resources/inference-pipelines/test-results.ts +109 -5
  120. package/src/resources/inference-pipelines.ts +3 -0
  121. package/src/resources/projects/commits.ts +18 -0
  122. package/src/resources/projects/index.ts +9 -0
  123. package/src/resources/projects/inference-pipelines.ts +104 -0
  124. package/src/resources/projects/projects.ts +35 -0
  125. package/src/resources/projects/tests.ts +905 -0
  126. package/src/resources/projects.ts +3 -0
  127. package/src/resources/storage.ts +3 -0
  128. package/src/resources.ts +1 -0
  129. package/src/version.ts +1 -1
  130. package/version.d.ts +1 -1
  131. package/version.js +1 -1
  132. package/version.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,100 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0 (2025-07-09)
4
+
5
+ Full Changelog: [v0.12.0...v0.13.0](https://github.com/openlayer-ai/openlayer-ts/compare/v0.12.0...v0.13.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add test creation endpoint ([b5ca558](https://github.com/openlayer-ai/openlayer-ts/commit/b5ca558bd715a2f2a2b4e463c71b8ee74f689fb7))
10
+ * **api:** api update ([c08bc30](https://github.com/openlayer-ai/openlayer-ts/commit/c08bc302d61a2d2dace0348c43fb2a2d9d5e3b43))
11
+ * **api:** api update ([21bf624](https://github.com/openlayer-ai/openlayer-ts/commit/21bf624b29037dec3a0daeda1c578f829da341a3))
12
+ * **api:** api update ([4a2f9f8](https://github.com/openlayer-ai/openlayer-ts/commit/4a2f9f8e180e63e258752de9835697df541c548b))
13
+ * **api:** api update ([631a79a](https://github.com/openlayer-ai/openlayer-ts/commit/631a79a91c55b7f8917e40f952faead29aae3d17))
14
+ * **api:** api update ([b94c7b1](https://github.com/openlayer-ai/openlayer-ts/commit/b94c7b1219ca99ffa26a725c5bca8ca1e11eed64))
15
+ * **api:** api update ([a133305](https://github.com/openlayer-ai/openlayer-ts/commit/a13330509527d784b7f7ca0b1cfc0e16be083ad8))
16
+ * **api:** expose test retrieval endpoint ([8fff7c0](https://github.com/openlayer-ai/openlayer-ts/commit/8fff7c08aef44c5d3a606a5c516b42e422b9bf4a))
17
+ * **api:** expose test retrieval endpoint ([44db29b](https://github.com/openlayer-ai/openlayer-ts/commit/44db29b20db663aa7751d5bd1b6b9db0ea71a0c5))
18
+ * **api:** expose test update endpoint ([7e129a6](https://github.com/openlayer-ai/openlayer-ts/commit/7e129a67b8a1377119928efee912b95cb2c1b1f6))
19
+ * **client:** add support for endpoint-specific base URLs ([2905588](https://github.com/openlayer-ai/openlayer-ts/commit/2905588b52a3a82b8a2cc6500bef798addd07ba3))
20
+ * **client:** send `X-Stainless-Timeout` header ([7019c85](https://github.com/openlayer-ai/openlayer-ts/commit/7019c85f937de8dae8a250d9d10f62fe426b6723))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **api:** improve type resolution when importing as a package ([#119](https://github.com/openlayer-ai/openlayer-ts/issues/119)) ([a758e18](https://github.com/openlayer-ai/openlayer-ts/commit/a758e18aa98963fdbaf606adccb47d8f13b93a7a))
26
+ * avoid type error in certain environments ([#115](https://github.com/openlayer-ai/openlayer-ts/issues/115)) ([f7448d9](https://github.com/openlayer-ai/openlayer-ts/commit/f7448d9f2a2280e2342ff94e7bff8ac6576d517d))
27
+ * **ci:** release-doctor — report correct token name ([e5e5f3b](https://github.com/openlayer-ai/openlayer-ts/commit/e5e5f3b29f0ec33fd4827a48871e3d1a2537c87e))
28
+ * **client:** don't send `Content-Type` for bodyless methods ([ffd0619](https://github.com/openlayer-ai/openlayer-ts/commit/ffd0619398f693322297d7b4e6eec1f864754133))
29
+ * **client:** fix export map for index exports ([3cef27b](https://github.com/openlayer-ai/openlayer-ts/commit/3cef27ba29799388aca98765a42d1b27217ce944))
30
+ * **client:** send `X-Stainless-Timeout` in seconds ([#117](https://github.com/openlayer-ai/openlayer-ts/issues/117)) ([8349fbc](https://github.com/openlayer-ai/openlayer-ts/commit/8349fbc8c942fbedf433ed6babea1ef4ce896ce7))
31
+ * **imports:** update import paths for OpenlayerHandler and traceOpenAI to reflect new module structure ([e57d2be](https://github.com/openlayer-ai/openlayer-ts/commit/e57d2be6b97d29f58baa6374af1cbbb7e85125dc))
32
+ * **internal:** work around https://github.com/vercel/next.js/issues/76881 ([#116](https://github.com/openlayer-ai/openlayer-ts/issues/116)) ([3d750a5](https://github.com/openlayer-ai/openlayer-ts/commit/3d750a52a5a2fc211a1936657b822ad0646e7e7f))
33
+ * **mcp:** remove unused tools.ts ([#120](https://github.com/openlayer-ai/openlayer-ts/issues/120)) ([d00061f](https://github.com/openlayer-ai/openlayer-ts/commit/d00061f9bdf4a7e82d12d79a7a43c9abe6f01bc9))
34
+ * publish script — handle NPM errors correctly ([33f3a0d](https://github.com/openlayer-ai/openlayer-ts/commit/33f3a0d85bbfdc6f3e6f30244722e56bdd4e316c))
35
+
36
+
37
+ ### Chores
38
+
39
+ * **ci:** add timeout thresholds for CI jobs ([fcfa14a](https://github.com/openlayer-ai/openlayer-ts/commit/fcfa14a94bd05fc0e318179e5a6f98478a316a8a))
40
+ * **ci:** bump node version for release workflows ([82ed245](https://github.com/openlayer-ai/openlayer-ts/commit/82ed245e7f356748adda6d2c0c3ca86a31b29cf1))
41
+ * **ci:** enable for pull requests ([0f02451](https://github.com/openlayer-ai/openlayer-ts/commit/0f02451999a6249b05eb07f862f8da8564928379))
42
+ * **ci:** only run for pushes and fork pull requests ([60a3cd5](https://github.com/openlayer-ai/openlayer-ts/commit/60a3cd57bc3d1e3fb5fc4e0b76dd215b93df96a3))
43
+ * **ci:** only use depot for staging repos ([e1cb08a](https://github.com/openlayer-ai/openlayer-ts/commit/e1cb08a3900378b3a2d7e240b657e3a3ee862cee))
44
+ * **client:** minor internal fixes ([8d1e577](https://github.com/openlayer-ai/openlayer-ts/commit/8d1e577c7bd97da21d58a2cb5ee4ee9ac2457f04))
45
+ * **docs:** grammar improvements ([764521c](https://github.com/openlayer-ai/openlayer-ts/commit/764521c36e2b24319ba92d4d9e569ad8894f4ad3))
46
+ * **docs:** use top-level-await in example snippets ([9a627db](https://github.com/openlayer-ai/openlayer-ts/commit/9a627dbdaddb88a83f141c9c25327b977ae2056a))
47
+ * **exports:** cleaner resource index imports ([#113](https://github.com/openlayer-ai/openlayer-ts/issues/113)) ([1647ab7](https://github.com/openlayer-ai/openlayer-ts/commit/1647ab7d2bbb81d81f923f31c0c72a570e4014c8))
48
+ * **exports:** stop using path fallbacks ([#114](https://github.com/openlayer-ai/openlayer-ts/issues/114)) ([39719a5](https://github.com/openlayer-ai/openlayer-ts/commit/39719a5b29432c9a9bb6a168356064019b35250d))
49
+ * improve publish-npm script --latest tag logic ([0292843](https://github.com/openlayer-ai/openlayer-ts/commit/029284308d98b5f42460444906d60d8c10fda9eb))
50
+ * **internal:** add aliases for Record and Array ([#118](https://github.com/openlayer-ai/openlayer-ts/issues/118)) ([6fdf6fa](https://github.com/openlayer-ai/openlayer-ts/commit/6fdf6fa73e56d0be5a37533c2c416438c38d33fa))
51
+ * **internal:** codegen related update ([5d338c6](https://github.com/openlayer-ai/openlayer-ts/commit/5d338c6b15812037d2d18a3751cd3bc7ab41daf8))
52
+ * **internal:** codegen related update ([2b134e4](https://github.com/openlayer-ai/openlayer-ts/commit/2b134e4095619b18e60b5fcb1312698fdb2c7e88))
53
+ * **internal:** codegen related update ([628f5e0](https://github.com/openlayer-ai/openlayer-ts/commit/628f5e00e0c9efdd86cd7af639dfc5ede530fa20))
54
+ * **internal:** codegen related update ([90f7b7c](https://github.com/openlayer-ai/openlayer-ts/commit/90f7b7ca08e4beac2c56215dfe25a58c27d55619))
55
+ * **internal:** codegen related update ([f278cf3](https://github.com/openlayer-ai/openlayer-ts/commit/f278cf329287d9a95e1e95e38fa7dfd4a31c4476))
56
+ * **internal:** codegen related update ([9e02f0b](https://github.com/openlayer-ai/openlayer-ts/commit/9e02f0b737f9f81ef4f845b79f54190fa2d3470a))
57
+ * **internal:** fix devcontainers setup ([163b07d](https://github.com/openlayer-ai/openlayer-ts/commit/163b07d2bec534cd44326bffa028e6c1d627d3d7))
58
+ * **internal:** fix workflows ([3e53c94](https://github.com/openlayer-ai/openlayer-ts/commit/3e53c94cd883482a06ad0eb8268900c872c8d65f))
59
+ * **internal:** make base APIResource abstract ([667b403](https://github.com/openlayer-ai/openlayer-ts/commit/667b403659d18700e89bba1875e7fe58baa6f2a2))
60
+ * **internal:** reduce CI branch coverage ([0cb981b](https://github.com/openlayer-ai/openlayer-ts/commit/0cb981bf6ce8d6ea19dc92c435517acf0daa55b2))
61
+ * **internal:** upload builds and expand CI branch coverage ([9e492b1](https://github.com/openlayer-ai/openlayer-ts/commit/9e492b1ca40b5b7ca46e9f1b0b793572716af1aa))
62
+ * **internal:** version bump ([989e4c6](https://github.com/openlayer-ai/openlayer-ts/commit/989e4c6179d46b06159ed534663032d8fd29bb65))
63
+ * **internal:** version bump ([52cc09a](https://github.com/openlayer-ai/openlayer-ts/commit/52cc09a6663124e4c48353e7f1b651f2760e766a))
64
+ * mention unit type in timeout docs ([55fb773](https://github.com/openlayer-ai/openlayer-ts/commit/55fb7733bf0858555f628c2300f4ea71287f3de5))
65
+ * **tests:** improve enum examples ([#121](https://github.com/openlayer-ai/openlayer-ts/issues/121)) ([78996ac](https://github.com/openlayer-ai/openlayer-ts/commit/78996acba5907a6a2deccf334bc9089a96e8b978))
66
+
67
+
68
+ ### Documentation
69
+
70
+ * add examples to tsdocs ([d3b8142](https://github.com/openlayer-ai/openlayer-ts/commit/d3b81423a7c10f51b6a213da42e596f8f8ff699c))
71
+ * **readme:** fix typo ([274cc42](https://github.com/openlayer-ai/openlayer-ts/commit/274cc42054d2eced24475304724ee191a72a06dd))
72
+ * update URLs from stainlessapi.com to stainless.com ([6c1c6f3](https://github.com/openlayer-ai/openlayer-ts/commit/6c1c6f3de4b9093725a31fa273c9de256ddc3db8))
73
+
74
+
75
+ ### Refactors
76
+
77
+ * **types:** replace Record with mapped types ([8837a96](https://github.com/openlayer-ai/openlayer-ts/commit/8837a966afbc24a8f6455833e3bdb2553ed58ad1))
78
+
79
+ ## 0.12.0 (2025-03-14)
80
+
81
+ Full Changelog: [v0.11.0...v0.12.0](https://github.com/openlayer-ai/openlayer-ts/compare/v0.11.0...v0.12.0)
82
+
83
+ ### Features
84
+
85
+ * **client:** accept RFC6838 JSON content types ([#108](https://github.com/openlayer-ai/openlayer-ts/issues/108)) ([f7acf0d](https://github.com/openlayer-ai/openlayer-ts/commit/f7acf0d19bf08c2ea2286461b99511535ba49b3a))
86
+
87
+
88
+ ### Bug Fixes
89
+
90
+ * **exports:** ensure resource imports don't require /index ([#110](https://github.com/openlayer-ai/openlayer-ts/issues/110)) ([2c80460](https://github.com/openlayer-ai/openlayer-ts/commit/2c804607bc5135c0b5170c6d98e4439b429a6e43))
91
+
92
+
93
+ ### Chores
94
+
95
+ * **internal:** codegen related update ([#106](https://github.com/openlayer-ai/openlayer-ts/issues/106)) ([7089dd9](https://github.com/openlayer-ai/openlayer-ts/commit/7089dd97d1a74d6e2d67e360b7b2db2799aaf98f))
96
+ * **internal:** remove extra empty newlines ([#109](https://github.com/openlayer-ai/openlayer-ts/issues/109)) ([bd6512c](https://github.com/openlayer-ai/openlayer-ts/commit/bd6512c00ee8d1cf2c623ad1de26f56a6c158629))
97
+
3
98
  ## 0.11.0 (2025-03-13)
4
99
 
5
100
  Full Changelog: [v0.10.3...v0.11.0](https://github.com/openlayer-ai/openlayer-ts/compare/v0.10.3...v0.11.0)
package/README.md CHANGED
@@ -6,7 +6,7 @@ This library provides convenient access to the Openlayer REST API from server-si
6
6
 
7
7
  The REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview). The full API of this library can be found in [api.md](api.md).
8
8
 
9
- It is generated with [Stainless](https://www.stainlessapi.com/).
9
+ It is generated with [Stainless](https://www.stainless.com/).
10
10
 
11
11
  ## Installation
12
12
 
@@ -26,30 +26,26 @@ const client = new Openlayer({
26
26
  apiKey: process.env['OPENLAYER_API_KEY'], // This is the default and can be omitted
27
27
  });
28
28
 
29
- async function main() {
30
- const response = await client.inferencePipelines.data.stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
31
- config: {
32
- inputVariableNames: ['user_query'],
33
- outputColumnName: 'output',
34
- numOfTokenColumnName: 'tokens',
35
- costColumnName: 'cost',
36
- timestampColumnName: 'timestamp',
29
+ const response = await client.inferencePipelines.data.stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
30
+ config: {
31
+ inputVariableNames: ['user_query'],
32
+ outputColumnName: 'output',
33
+ numOfTokenColumnName: 'tokens',
34
+ costColumnName: 'cost',
35
+ timestampColumnName: 'timestamp',
36
+ },
37
+ rows: [
38
+ {
39
+ user_query: 'what is the meaning of life?',
40
+ output: '42',
41
+ tokens: 7,
42
+ cost: 0.02,
43
+ timestamp: 1610000000,
37
44
  },
38
- rows: [
39
- {
40
- user_query: 'what is the meaning of life?',
41
- output: '42',
42
- tokens: 7,
43
- cost: 0.02,
44
- timestamp: 1610000000,
45
- },
46
- ],
47
- });
48
-
49
- console.log(response.success);
50
- }
45
+ ],
46
+ });
51
47
 
52
- main();
48
+ console.log(response.success);
53
49
  ```
54
50
 
55
51
  ### Request & Response types
@@ -64,8 +60,42 @@ const client = new Openlayer({
64
60
  apiKey: process.env['OPENLAYER_API_KEY'], // This is the default and can be omitted
65
61
  });
66
62
 
67
- async function main() {
68
- const params: Openlayer.InferencePipelines.DataStreamParams = {
63
+ const params: Openlayer.InferencePipelines.DataStreamParams = {
64
+ config: {
65
+ inputVariableNames: ['user_query'],
66
+ outputColumnName: 'output',
67
+ numOfTokenColumnName: 'tokens',
68
+ costColumnName: 'cost',
69
+ timestampColumnName: 'timestamp',
70
+ },
71
+ rows: [
72
+ {
73
+ user_query: 'what is the meaning of life?',
74
+ output: '42',
75
+ tokens: 7,
76
+ cost: 0.02,
77
+ timestamp: 1610000000,
78
+ },
79
+ ],
80
+ };
81
+ const response: Openlayer.InferencePipelines.DataStreamResponse = await client.inferencePipelines.data.stream(
82
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
83
+ params,
84
+ );
85
+ ```
86
+
87
+ Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
88
+
89
+ ## Handling errors
90
+
91
+ When the library is unable to connect to the API,
92
+ or if the API returns a non-success status code (i.e., 4xx or 5xx response),
93
+ a subclass of `APIError` will be thrown:
94
+
95
+ <!-- prettier-ignore -->
96
+ ```ts
97
+ const response = await client.inferencePipelines.data
98
+ .stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
69
99
  config: {
70
100
  inputVariableNames: ['user_query'],
71
101
  outputColumnName: 'output',
@@ -82,59 +112,19 @@ async function main() {
82
112
  timestamp: 1610000000,
83
113
  },
84
114
  ],
85
- };
86
- const response: Openlayer.InferencePipelines.DataStreamResponse =
87
- await client.inferencePipelines.data.stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', params);
88
- }
89
-
90
- main();
91
- ```
92
-
93
- Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
94
-
95
- ## Handling errors
96
-
97
- When the library is unable to connect to the API,
98
- or if the API returns a non-success status code (i.e., 4xx or 5xx response),
99
- a subclass of `APIError` will be thrown:
100
-
101
- <!-- prettier-ignore -->
102
- ```ts
103
- async function main() {
104
- const response = await client.inferencePipelines.data
105
- .stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
106
- config: {
107
- inputVariableNames: ['user_query'],
108
- outputColumnName: 'output',
109
- numOfTokenColumnName: 'tokens',
110
- costColumnName: 'cost',
111
- timestampColumnName: 'timestamp',
112
- },
113
- rows: [
114
- {
115
- user_query: 'what is the meaning of life?',
116
- output: '42',
117
- tokens: 7,
118
- cost: 0.02,
119
- timestamp: 1610000000,
120
- },
121
- ],
122
- })
123
- .catch(async (err) => {
124
- if (err instanceof Openlayer.APIError) {
125
- console.log(err.status); // 400
126
- console.log(err.name); // BadRequestError
127
- console.log(err.headers); // {server: 'nginx', ...}
128
- } else {
129
- throw err;
130
- }
131
- });
132
- }
133
-
134
- main();
115
+ })
116
+ .catch(async (err) => {
117
+ if (err instanceof Openlayer.APIError) {
118
+ console.log(err.status); // 400
119
+ console.log(err.name); // BadRequestError
120
+ console.log(err.headers); // {server: 'nginx', ...}
121
+ } else {
122
+ throw err;
123
+ }
124
+ });
135
125
  ```
136
126
 
137
- Error codes are as followed:
127
+ Error codes are as follows:
138
128
 
139
129
  | Status Code | Error Type |
140
130
  | ----------- | -------------------------- |
@@ -380,7 +370,7 @@ await client.inferencePipelines.data.stream(
380
370
  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
381
371
 
382
372
  1. Changes that only affect static types, without breaking runtime behavior.
383
- 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
373
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
384
374
  3. Changes that we do not expect to impact the vast majority of users in practice.
385
375
 
386
376
  We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
package/_shims/index.d.ts CHANGED
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
79
79
  export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
80
80
 
81
81
  export function isFsReadStream(value: any): value is FsReadStream;
82
+
83
+ export const init: () => void;
package/_shims/index.js CHANGED
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const shims = require('./registry');
5
5
  const auto = require('openlayer/_shims/auto/runtime');
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ exports.init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  for (const property of Object.keys(shims)) {
8
10
  Object.defineProperty(exports, property, {
9
11
  get() {
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
11
13
  },
12
14
  });
13
15
  }
16
+
17
+ exports.init();
package/_shims/index.mjs CHANGED
@@ -3,5 +3,9 @@
3
3
  */
4
4
  import * as shims from './registry.mjs';
5
5
  import * as auto from 'openlayer/_shims/auto/runtime';
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ export const init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  export * from './registry.mjs';
10
+
11
+ init();
package/core.d.ts CHANGED
@@ -6,6 +6,17 @@ export { type Response };
6
6
  import { BlobLike } from "./uploads.js";
7
7
  export { maybeMultipartFormRequestOptions, multipartFormRequestOptions, createForm, type Uploadable, } from "./uploads.js";
8
8
  export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
9
+ /**
10
+ * An alias to the builtin `Array` type so we can
11
+ * easily alias it in import statements if there are name clashes.
12
+ */
13
+ type _Array<T> = Array<T>;
14
+ /**
15
+ * An alias to the builtin `Record` type so we can
16
+ * easily alias it in import statements if there are name clashes.
17
+ */
18
+ type _Record<K extends keyof any, T> = Record<K, T>;
19
+ export type { _Array as Array, _Record as Record };
9
20
  type PromiseOrValue<T> = T | Promise<T>;
10
21
  type APIResponseProps = {
11
22
  response: Response;
@@ -59,15 +70,17 @@ export declare class APIPromise<T> extends Promise<T> {
59
70
  finally(onfinally?: (() => void) | undefined | null): Promise<T>;
60
71
  }
61
72
  export declare abstract class APIClient {
73
+ #private;
62
74
  baseURL: string;
63
75
  maxRetries: number;
64
76
  timeout: number;
65
77
  httpAgent: Agent | undefined;
66
78
  private fetch;
67
79
  protected idempotencyHeader?: string;
68
- constructor({ baseURL, maxRetries, timeout, // 1 minute
80
+ constructor({ baseURL, baseURLOverridden, maxRetries, timeout, // 1 minute
69
81
  httpAgent, fetch: overriddenFetch, }: {
70
82
  baseURL: string;
83
+ baseURLOverridden: boolean;
71
84
  maxRetries?: number | undefined;
72
85
  timeout: number | undefined;
73
86
  httpAgent: Agent | undefined;
@@ -97,7 +110,7 @@ export declare abstract class APIClient {
97
110
  private methodRequest;
98
111
  getAPIList<Item, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(path: string, Page: new (...args: any[]) => PageClass, opts?: RequestOptions<any>): PagePromise<PageClass, Item>;
99
112
  private calculateContentLength;
100
- buildRequest<Req>(options: FinalRequestOptions<Req>, { retryCount }?: {
113
+ buildRequest<Req>(inputOptions: FinalRequestOptions<Req>, { retryCount }?: {
101
114
  retryCount?: number;
102
115
  }): {
103
116
  req: RequestInit;
@@ -124,7 +137,7 @@ export declare abstract class APIClient {
124
137
  request<Req, Rsp>(options: PromiseOrValue<FinalRequestOptions<Req>>, remainingRetries?: number | null): APIPromise<Rsp>;
125
138
  private makeRequest;
126
139
  requestAPIList<Item = unknown, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass, options: FinalRequestOptions): PagePromise<PageClass, Item>;
127
- buildURL<Req>(path: string, query: Req | null | undefined): string;
140
+ buildURL<Req>(path: string, query: Req | null | undefined, defaultBaseURL?: string | undefined): string;
128
141
  protected stringifyQuery(query: Record<string, unknown>): string;
129
142
  fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
130
143
  private shouldRetry;
@@ -190,6 +203,7 @@ export type RequestOptions<Req = unknown | Record<string, unknown> | Readable |
190
203
  query?: Req | undefined;
191
204
  body?: Req | null | undefined;
192
205
  headers?: Headers | undefined;
206
+ defaultBaseURL?: string | undefined;
193
207
  maxRetries?: number;
194
208
  stream?: boolean | undefined;
195
209
  timeout?: number;
package/core.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";;AACA,OAAO,EAEL,QAAQ,EAIT,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAEV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;AACzB,OAAO,EAAE,QAAQ,EAA+B,MAAM,WAAW,CAAC;AAClE,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,UAAU,EACV,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CA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M,GAAG,SAK1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,OAAO,KAAG,OAAO,GAAG,SAK7D,CAAC;AAGF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAIlE;AAGD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAExD;AAwBD,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,QAInD;AAaD,eAAO,MAAM,kBAAkB,eAS9B,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACpD;AACD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,eAAe,CAAC;AAE1F,eAAO,MAAM,iBAAiB,YAAa,GAAG,+BAE7C,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa,WAAW,GAAG,OAAO,UAAU,MAAM,KAAG,MAMlF,CAAC;AAEF,eAAO,MAAM,SAAS,YAAa,WAAW,GAAG,OAAO,UAAU,MAAM,KAAG,MAAM,GAAG,SA2BnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAS,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAWzD,CAAC;AAEF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAElE"}
package/core.js CHANGED
@@ -10,12 +10,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _AbstractPage_client;
13
+ var _APIClient_baseURLOverridden, _AbstractPage_client;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.isObj = exports.toBase64 = exports.getHeader = exports.getRequiredHeader = exports.isHeadersProtocol = exports.isRunningInBrowser = exports.debug = exports.hasOwn = exports.isEmptyObj = exports.maybeCoerceBoolean = exports.maybeCoerceFloat = exports.maybeCoerceInteger = exports.coerceBoolean = exports.coerceFloat = exports.coerceInteger = exports.readEnv = exports.ensurePresent = exports.castToError = exports.sleep = exports.safeJSON = exports.isRequestOptions = exports.createResponseHeaders = exports.PagePromise = exports.AbstractPage = exports.APIClient = exports.APIPromise = exports.createForm = exports.multipartFormRequestOptions = exports.maybeMultipartFormRequestOptions = void 0;
16
16
  const version_1 = require("./version.js");
17
17
  const error_1 = require("./error.js");
18
18
  const index_1 = require("./_shims/index.js");
19
+ // try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
20
+ (0, index_1.init)();
19
21
  const uploads_1 = require("./uploads.js");
20
22
  var uploads_2 = require("./uploads.js");
21
23
  Object.defineProperty(exports, "maybeMultipartFormRequestOptions", { enumerable: true, get: function () { return uploads_2.maybeMultipartFormRequestOptions; } });
@@ -31,7 +33,8 @@ async function defaultParseResponse(props) {
31
33
  return response;
32
34
  }
33
35
  const contentType = response.headers.get('content-type');
34
- const isJSON = contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
36
+ const mediaType = contentType?.split(';')[0]?.trim();
37
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
35
38
  if (isJSON) {
36
39
  const json = await response.json();
37
40
  debug('response', response.status, response.url, response.headers, json);
@@ -111,9 +114,11 @@ class APIPromise extends Promise {
111
114
  }
112
115
  exports.APIPromise = APIPromise;
113
116
  class APIClient {
114
- constructor({ baseURL, maxRetries = 2, timeout = 60000, // 1 minute
117
+ constructor({ baseURL, baseURLOverridden, maxRetries = 2, timeout = 60000, // 1 minute
115
118
  httpAgent, fetch: overriddenFetch, }) {
119
+ _APIClient_baseURLOverridden.set(this, void 0);
116
120
  this.baseURL = baseURL;
121
+ __classPrivateFieldSet(this, _APIClient_baseURLOverridden, baseURLOverridden, "f");
117
122
  this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
118
123
  this.timeout = validatePositiveInteger('timeout', timeout);
119
124
  this.httpAgent = httpAgent;
@@ -133,7 +138,7 @@ class APIClient {
133
138
  defaultHeaders(opts) {
134
139
  return {
135
140
  Accept: 'application/json',
136
- 'Content-Type': 'application/json',
141
+ ...(['head', 'get'].includes(opts.method) ? {} : { 'Content-Type': 'application/json' }),
137
142
  'User-Agent': this.getUserAgent(),
138
143
  ...getPlatformHeaders(),
139
144
  ...this.authHeaders(opts),
@@ -190,20 +195,21 @@ class APIClient {
190
195
  }
191
196
  return null;
192
197
  }
193
- buildRequest(options, { retryCount = 0 } = {}) {
194
- const { method, path, query, headers: headers = {} } = options;
198
+ buildRequest(inputOptions, { retryCount = 0 } = {}) {
199
+ const options = { ...inputOptions };
200
+ const { method, path, query, defaultBaseURL, headers: headers = {} } = options;
195
201
  const body = ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
196
202
  options.body
197
203
  : (0, uploads_1.isMultipartBody)(options.body) ? options.body.body
198
204
  : options.body ? JSON.stringify(options.body, null, 2)
199
205
  : null;
200
206
  const contentLength = this.calculateContentLength(body);
201
- const url = this.buildURL(path, query);
207
+ const url = this.buildURL(path, query, defaultBaseURL);
202
208
  if ('timeout' in options)
203
209
  validatePositiveInteger('timeout', options.timeout);
204
- const timeout = options.timeout ?? this.timeout;
210
+ options.timeout = options.timeout ?? this.timeout;
205
211
  const httpAgent = options.httpAgent ?? this.httpAgent ?? (0, index_1.getDefaultAgent)(url);
206
- const minAgentTimeout = timeout + 1000;
212
+ const minAgentTimeout = options.timeout + 1000;
207
213
  if (typeof httpAgent?.options?.timeout === 'number' &&
208
214
  minAgentTimeout > (httpAgent.options.timeout ?? 0)) {
209
215
  // Allow any given request to bump our agent active socket timeout.
@@ -213,9 +219,9 @@ class APIClient {
213
219
  httpAgent.options.timeout = minAgentTimeout;
214
220
  }
215
221
  if (this.idempotencyHeader && method !== 'get') {
216
- if (!options.idempotencyKey)
217
- options.idempotencyKey = this.defaultIdempotencyKey();
218
- headers[this.idempotencyHeader] = options.idempotencyKey;
222
+ if (!inputOptions.idempotencyKey)
223
+ inputOptions.idempotencyKey = this.defaultIdempotencyKey();
224
+ headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
219
225
  }
220
226
  const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
221
227
  const req = {
@@ -227,7 +233,7 @@ class APIClient {
227
233
  // not compatible with standard web types
228
234
  signal: options.signal ?? null,
229
235
  };
230
- return { req, url, timeout };
236
+ return { req, url, timeout: options.timeout };
231
237
  }
232
238
  buildHeaders({ options, headers, contentLength, retryCount, }) {
233
239
  const reqHeaders = {};
@@ -241,13 +247,18 @@ class APIClient {
241
247
  if ((0, uploads_1.isMultipartBody)(options.body) && index_1.kind !== 'node') {
242
248
  delete reqHeaders['content-type'];
243
249
  }
244
- // Don't set the retry count header if it was already set or removed through default headers or by the
245
- // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
246
- // account for the removal case.
250
+ // Don't set theses headers if they were already set or removed through default headers or by the caller.
251
+ // We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
252
+ // for the removal case.
247
253
  if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-retry-count') === undefined &&
248
254
  (0, exports.getHeader)(headers, 'x-stainless-retry-count') === undefined) {
249
255
  reqHeaders['x-stainless-retry-count'] = String(retryCount);
250
256
  }
257
+ if ((0, exports.getHeader)(defaultHeaders, 'x-stainless-timeout') === undefined &&
258
+ (0, exports.getHeader)(headers, 'x-stainless-timeout') === undefined &&
259
+ options.timeout) {
260
+ reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
261
+ }
251
262
  this.validateHeaders(reqHeaders, headers);
252
263
  return reqHeaders;
253
264
  }
@@ -322,10 +333,11 @@ class APIClient {
322
333
  const request = this.makeRequest(options, null);
323
334
  return new PagePromise(this, request, Page);
324
335
  }
325
- buildURL(path, query) {
336
+ buildURL(path, query, defaultBaseURL) {
337
+ const baseURL = (!__classPrivateFieldGet(this, _APIClient_baseURLOverridden, "f") && defaultBaseURL) || this.baseURL;
326
338
  const url = isAbsoluteURL(path) ?
327
339
  new URL(path)
328
- : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
340
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
329
341
  const defaultQuery = this.defaultQuery();
330
342
  if (!isEmptyObj(defaultQuery)) {
331
343
  query = { ...defaultQuery, ...query };
@@ -436,6 +448,7 @@ class APIClient {
436
448
  }
437
449
  }
438
450
  exports.APIClient = APIClient;
451
+ _APIClient_baseURLOverridden = new WeakMap();
439
452
  class AbstractPage {
440
453
  constructor(client, response, body, options) {
441
454
  _AbstractPage_client.set(this, void 0);
@@ -535,6 +548,7 @@ const requestOptionsKeys = {
535
548
  query: true,
536
549
  body: true,
537
550
  headers: true,
551
+ defaultBaseURL: true,
538
552
  maxRetries: true,
539
553
  stream: true,
540
554
  timeout: true,