openai 4.86.2 → 4.87.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +50 -101
  3. package/core.js +2 -1
  4. package/core.js.map +1 -1
  5. package/core.mjs +2 -1
  6. package/core.mjs.map +1 -1
  7. package/helpers/zod.d.ts +14 -1
  8. package/helpers/zod.d.ts.map +1 -1
  9. package/helpers/zod.js +25 -1
  10. package/helpers/zod.js.map +1 -1
  11. package/helpers/zod.mjs +23 -1
  12. package/helpers/zod.mjs.map +1 -1
  13. package/index.d.mts +14 -3
  14. package/index.d.ts +14 -3
  15. package/index.d.ts.map +1 -1
  16. package/index.js +8 -0
  17. package/index.js.map +1 -1
  18. package/index.mjs +8 -0
  19. package/index.mjs.map +1 -1
  20. package/lib/ResponsesParser.d.ts +33 -0
  21. package/lib/ResponsesParser.d.ts.map +1 -0
  22. package/lib/ResponsesParser.js +171 -0
  23. package/lib/ResponsesParser.js.map +1 -0
  24. package/lib/ResponsesParser.mjs +160 -0
  25. package/lib/ResponsesParser.mjs.map +1 -0
  26. package/lib/parser.d.ts +7 -0
  27. package/lib/parser.d.ts.map +1 -1
  28. package/lib/parser.js +16 -1
  29. package/lib/parser.js.map +1 -1
  30. package/lib/parser.mjs +14 -0
  31. package/lib/parser.mjs.map +1 -1
  32. package/lib/responses/EventTypes.d.ts +9 -0
  33. package/lib/responses/EventTypes.d.ts.map +1 -0
  34. package/lib/responses/EventTypes.js +3 -0
  35. package/lib/responses/EventTypes.js.map +1 -0
  36. package/lib/responses/EventTypes.mjs +2 -0
  37. package/lib/responses/EventTypes.mjs.map +1 -0
  38. package/lib/responses/ResponseStream.d.ts +34 -0
  39. package/lib/responses/ResponseStream.d.ts.map +1 -0
  40. package/lib/responses/ResponseStream.js +238 -0
  41. package/lib/responses/ResponseStream.js.map +1 -0
  42. package/lib/responses/ResponseStream.mjs +234 -0
  43. package/lib/responses/ResponseStream.mjs.map +1 -0
  44. package/package.json +1 -1
  45. package/resources/beta/assistants.d.ts +41 -9
  46. package/resources/beta/assistants.d.ts.map +1 -1
  47. package/resources/beta/assistants.js.map +1 -1
  48. package/resources/beta/assistants.mjs.map +1 -1
  49. package/resources/beta/beta.d.ts +0 -4
  50. package/resources/beta/beta.d.ts.map +1 -1
  51. package/resources/beta/beta.js +0 -5
  52. package/resources/beta/beta.js.map +1 -1
  53. package/resources/beta/beta.mjs +0 -5
  54. package/resources/beta/beta.mjs.map +1 -1
  55. package/resources/beta/index.d.ts +0 -1
  56. package/resources/beta/index.d.ts.map +1 -1
  57. package/resources/beta/index.js +1 -4
  58. package/resources/beta/index.js.map +1 -1
  59. package/resources/beta/index.mjs +0 -1
  60. package/resources/beta/index.mjs.map +1 -1
  61. package/resources/beta/threads/runs/runs.d.ts +3 -4
  62. package/resources/beta/threads/runs/runs.d.ts.map +1 -1
  63. package/resources/beta/threads/runs/runs.js.map +1 -1
  64. package/resources/beta/threads/runs/runs.mjs.map +1 -1
  65. package/resources/beta/threads/threads.d.ts +73 -7
  66. package/resources/beta/threads/threads.d.ts.map +1 -1
  67. package/resources/beta/threads/threads.js.map +1 -1
  68. package/resources/beta/threads/threads.mjs.map +1 -1
  69. package/resources/chat/chat.d.ts +3 -2
  70. package/resources/chat/chat.d.ts.map +1 -1
  71. package/resources/chat/chat.js.map +1 -1
  72. package/resources/chat/chat.mjs.map +1 -1
  73. package/resources/chat/completions/completions.d.ts +200 -64
  74. package/resources/chat/completions/completions.d.ts.map +1 -1
  75. package/resources/chat/completions/completions.js +3 -3
  76. package/resources/chat/completions/completions.js.map +1 -1
  77. package/resources/chat/completions/completions.mjs +3 -3
  78. package/resources/chat/completions/completions.mjs.map +1 -1
  79. package/resources/chat/completions/index.d.ts +1 -1
  80. package/resources/chat/completions/index.d.ts.map +1 -1
  81. package/resources/chat/completions/index.js.map +1 -1
  82. package/resources/chat/completions/index.mjs.map +1 -1
  83. package/resources/chat/completions/messages.d.ts +1 -1
  84. package/resources/chat/index.d.ts +2 -2
  85. package/resources/chat/index.d.ts.map +1 -1
  86. package/resources/chat/index.js.map +1 -1
  87. package/resources/chat/index.mjs.map +1 -1
  88. package/resources/files.d.ts +9 -17
  89. package/resources/files.d.ts.map +1 -1
  90. package/resources/files.js.map +1 -1
  91. package/resources/files.mjs.map +1 -1
  92. package/resources/index.d.ts +2 -0
  93. package/resources/index.d.ts.map +1 -1
  94. package/resources/index.js +7 -1
  95. package/resources/index.js.map +1 -1
  96. package/resources/index.mjs +2 -0
  97. package/resources/index.mjs.map +1 -1
  98. package/resources/responses/index.d.ts +3 -0
  99. package/resources/responses/index.d.ts.map +1 -0
  100. package/resources/responses/index.js +10 -0
  101. package/resources/responses/index.js.map +1 -0
  102. package/resources/responses/index.mjs +4 -0
  103. package/resources/responses/index.mjs.map +1 -0
  104. package/resources/responses/input-items.d.ts +169 -0
  105. package/resources/responses/input-items.d.ts.map +1 -0
  106. package/resources/responses/input-items.js +24 -0
  107. package/resources/responses/input-items.js.map +1 -0
  108. package/resources/responses/input-items.mjs +19 -0
  109. package/resources/responses/input-items.mjs.map +1 -0
  110. package/resources/responses/responses.d.ts +2230 -0
  111. package/resources/responses/responses.d.ts.map +1 -0
  112. package/resources/responses/responses.js +77 -0
  113. package/resources/responses/responses.js.map +1 -0
  114. package/resources/responses/responses.mjs +50 -0
  115. package/resources/responses/responses.mjs.map +1 -0
  116. package/resources/shared.d.ts +99 -4
  117. package/resources/shared.d.ts.map +1 -1
  118. package/resources/uploads/uploads.d.ts +3 -4
  119. package/resources/uploads/uploads.d.ts.map +1 -1
  120. package/resources/uploads/uploads.js +3 -4
  121. package/resources/uploads/uploads.js.map +1 -1
  122. package/resources/uploads/uploads.mjs +3 -4
  123. package/resources/uploads/uploads.mjs.map +1 -1
  124. package/resources/{beta/vector-stores → vector-stores}/file-batches.d.ts +12 -4
  125. package/resources/vector-stores/file-batches.d.ts.map +1 -0
  126. package/resources/{beta/vector-stores → vector-stores}/file-batches.js +4 -4
  127. package/resources/vector-stores/file-batches.js.map +1 -0
  128. package/resources/{beta/vector-stores → vector-stores}/file-batches.mjs +4 -4
  129. package/resources/vector-stores/file-batches.mjs.map +1 -0
  130. package/resources/{beta/vector-stores → vector-stores}/files.d.ts +54 -5
  131. package/resources/vector-stores/files.d.ts.map +1 -0
  132. package/resources/{beta/vector-stores → vector-stores}/files.js +27 -4
  133. package/resources/vector-stores/files.js.map +1 -0
  134. package/resources/{beta/vector-stores → vector-stores}/files.mjs +25 -3
  135. package/resources/vector-stores/files.mjs.map +1 -0
  136. package/resources/vector-stores/index.d.ts +4 -0
  137. package/resources/vector-stores/index.d.ts.map +1 -0
  138. package/resources/{beta/vector-stores → vector-stores}/index.js +3 -1
  139. package/resources/vector-stores/index.js.map +1 -0
  140. package/resources/vector-stores/index.mjs +5 -0
  141. package/resources/vector-stores/index.mjs.map +1 -0
  142. package/resources/{beta/vector-stores → vector-stores}/vector-stores.d.ts +90 -7
  143. package/resources/vector-stores/vector-stores.d.ts.map +1 -0
  144. package/resources/{beta/vector-stores → vector-stores}/vector-stores.js +24 -4
  145. package/resources/vector-stores/vector-stores.js.map +1 -0
  146. package/resources/{beta/vector-stores → vector-stores}/vector-stores.mjs +23 -4
  147. package/resources/vector-stores/vector-stores.mjs.map +1 -0
  148. package/src/core.ts +2 -2
  149. package/src/helpers/zod.ts +46 -0
  150. package/src/index.ts +54 -4
  151. package/src/lib/ResponsesParser.ts +262 -0
  152. package/src/lib/parser.ts +28 -0
  153. package/src/lib/responses/EventTypes.ts +76 -0
  154. package/src/lib/responses/ResponseStream.ts +298 -0
  155. package/src/resources/beta/assistants.ts +46 -9
  156. package/src/resources/beta/beta.ts +0 -37
  157. package/src/resources/beta/index.ts +0 -16
  158. package/src/resources/beta/threads/runs/runs.ts +3 -4
  159. package/src/resources/beta/threads/threads.ts +83 -7
  160. package/src/resources/chat/chat.ts +3 -43
  161. package/src/resources/chat/completions/completions.ts +224 -66
  162. package/src/resources/chat/completions/index.ts +0 -1
  163. package/src/resources/chat/completions/messages.ts +1 -1
  164. package/src/resources/chat/index.ts +1 -2
  165. package/src/resources/files.ts +9 -17
  166. package/src/resources/index.ts +20 -0
  167. package/src/resources/responses/index.ts +9 -0
  168. package/src/resources/responses/input-items.ts +276 -0
  169. package/src/resources/responses/responses.ts +2761 -0
  170. package/src/resources/shared.ts +152 -4
  171. package/src/resources/uploads/uploads.ts +3 -4
  172. package/src/resources/{beta/vector-stores → vector-stores}/file-batches.ts +16 -7
  173. package/src/resources/{beta/vector-stores → vector-stores}/files.ts +85 -4
  174. package/src/resources/{beta/vector-stores → vector-stores}/index.ts +6 -0
  175. package/src/resources/{beta/vector-stores → vector-stores}/vector-stores.ts +125 -5
  176. package/src/streaming.ts +1 -1
  177. package/src/version.ts +1 -1
  178. package/streaming.js +1 -1
  179. package/streaming.js.map +1 -1
  180. package/streaming.mjs +1 -1
  181. package/streaming.mjs.map +1 -1
  182. package/version.d.ts +1 -1
  183. package/version.js +1 -1
  184. package/version.mjs +1 -1
  185. package/resources/beta/vector-stores/file-batches.d.ts.map +0 -1
  186. package/resources/beta/vector-stores/file-batches.js.map +0 -1
  187. package/resources/beta/vector-stores/file-batches.mjs.map +0 -1
  188. package/resources/beta/vector-stores/files.d.ts.map +0 -1
  189. package/resources/beta/vector-stores/files.js.map +0 -1
  190. package/resources/beta/vector-stores/files.mjs.map +0 -1
  191. package/resources/beta/vector-stores/index.d.ts +0 -4
  192. package/resources/beta/vector-stores/index.d.ts.map +0 -1
  193. package/resources/beta/vector-stores/index.js.map +0 -1
  194. package/resources/beta/vector-stores/index.mjs +0 -5
  195. package/resources/beta/vector-stores/index.mjs.map +0 -1
  196. package/resources/beta/vector-stores/vector-stores.d.ts.map +0 -1
  197. package/resources/beta/vector-stores/vector-stores.js.map +0 -1
  198. package/resources/beta/vector-stores/vector-stores.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/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IAC/B;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC;CAC9D;AAED,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAE9D;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAKD,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,oBAAoB,IAAI,oBAAoB,EAC5C,wBAAwB,IAAI,wBAAwB,EACpD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;CACH"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.VectorStoreFilesPage = exports.Files = void 0;
5
- const resource_1 = require("../../../resource.js");
6
- const core_1 = require("../../../core.js");
7
- const pagination_1 = require("../../../pagination.js");
4
+ exports.FileContentResponsesPage = exports.VectorStoreFilesPage = exports.Files = void 0;
5
+ const resource_1 = require("../../resource.js");
6
+ const core_1 = require("../../core.js");
7
+ const pagination_1 = require("../../pagination.js");
8
8
  class Files extends resource_1.APIResource {
9
9
  /**
10
10
  * Create a vector store file by attaching a
@@ -27,6 +27,16 @@ class Files extends resource_1.APIResource {
27
27
  headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
28
28
  });
29
29
  }
30
+ /**
31
+ * Update attributes on a vector store file.
32
+ */
33
+ update(vectorStoreId, fileId, body, options) {
34
+ return this._client.post(`/vector_stores/${vectorStoreId}/files/${fileId}`, {
35
+ body,
36
+ ...options,
37
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
38
+ });
39
+ }
30
40
  list(vectorStoreId, query = {}, options) {
31
41
  if ((0, core_1.isRequestOptions)(query)) {
32
42
  return this.list(vectorStoreId, {}, query);
@@ -113,10 +123,23 @@ class Files extends resource_1.APIResource {
113
123
  const fileInfo = await this.upload(vectorStoreId, file, options);
114
124
  return await this.poll(vectorStoreId, fileInfo.id, options);
115
125
  }
126
+ /**
127
+ * Retrieve the parsed contents of a vector store file.
128
+ */
129
+ content(vectorStoreId, fileId, options) {
130
+ return this._client.getAPIList(`/vector_stores/${vectorStoreId}/files/${fileId}/content`, FileContentResponsesPage, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers } });
131
+ }
116
132
  }
117
133
  exports.Files = Files;
118
134
  class VectorStoreFilesPage extends pagination_1.CursorPage {
119
135
  }
120
136
  exports.VectorStoreFilesPage = VectorStoreFilesPage;
137
+ /**
138
+ * Note: no pagination actually occurs yet, this is for forwards-compatibility.
139
+ */
140
+ class FileContentResponsesPage extends pagination_1.Page {
141
+ }
142
+ exports.FileContentResponsesPage = FileContentResponsesPage;
121
143
  Files.VectorStoreFilesPage = VectorStoreFilesPage;
144
+ Files.FileContentResponsesPage = FileContentResponsesPage;
122
145
  //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAC7C,wCAAiE;AAGjE,oDAA2E;AAE3E,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;OAIG;IACH,MAAM,CACJ,aAAqB,EACrB,IAAsB,EACtB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC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,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,CACjF,CAAC;IACJ,CAAC;CACF;AAhMD,sBAgMC;AAED,MAAa,oBAAqB,SAAQ,uBAA2B;CAAG;AAAxE,oDAAwE;AAExE;;GAEG;AACH,MAAa,wBAAyB,SAAQ,iBAAyB;CAAG;AAA1E,4DAA0E;AA6J1E,KAAK,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,KAAK,CAAC,wBAAwB,GAAG,wBAAwB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../../resource.mjs";
3
- import { sleep, isRequestOptions } from "../../../core.mjs";
4
- import { CursorPage } from "../../../pagination.mjs";
2
+ import { APIResource } from "../../resource.mjs";
3
+ import { sleep, isRequestOptions } from "../../core.mjs";
4
+ import { CursorPage, Page } from "../../pagination.mjs";
5
5
  export class Files extends APIResource {
6
6
  /**
7
7
  * Create a vector store file by attaching a
@@ -24,6 +24,16 @@ export class Files extends APIResource {
24
24
  headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
25
25
  });
26
26
  }
27
+ /**
28
+ * Update attributes on a vector store file.
29
+ */
30
+ update(vectorStoreId, fileId, body, options) {
31
+ return this._client.post(`/vector_stores/${vectorStoreId}/files/${fileId}`, {
32
+ body,
33
+ ...options,
34
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
35
+ });
36
+ }
27
37
  list(vectorStoreId, query = {}, options) {
28
38
  if (isRequestOptions(query)) {
29
39
  return this.list(vectorStoreId, {}, query);
@@ -110,8 +120,20 @@ export class Files extends APIResource {
110
120
  const fileInfo = await this.upload(vectorStoreId, file, options);
111
121
  return await this.poll(vectorStoreId, fileInfo.id, options);
112
122
  }
123
+ /**
124
+ * Retrieve the parsed contents of a vector store file.
125
+ */
126
+ content(vectorStoreId, fileId, options) {
127
+ return this._client.getAPIList(`/vector_stores/${vectorStoreId}/files/${fileId}/content`, FileContentResponsesPage, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers } });
128
+ }
113
129
  }
114
130
  export class VectorStoreFilesPage extends CursorPage {
115
131
  }
132
+ /**
133
+ * Note: no pagination actually occurs yet, this is for forwards-compatibility.
134
+ */
135
+ export class FileContentResponsesPage extends Page {
136
+ }
116
137
  Files.VectorStoreFilesPage = VectorStoreFilesPage;
138
+ Files.FileContentResponsesPage = FileContentResponsesPage;
117
139
  //# sourceMappingURL=files.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,KAAK,EAAc,gBAAgB,EAAE;OAGvC,EAAE,UAAU,EAAyB,IAAI,EAAE;AAElD,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;OAIG;IACH,MAAM,CACJ,aAAqB,EACrB,IAAsB,EACtB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,aAAa,QAAQ,EAAE;YAChE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACjE,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,aAAqB,EACrB,MAAc,EACd,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,aAAa,UAAU,MAAM,EAAE,EAAE;YACzE,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACjE,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CACJ,aAAqB,EACrB,MAAc,EACd,IAAsB,EACtB,OAA6B;QAE7B,OAAO,IAAI,CA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,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CACjB,aAAqB,EACrB,IAAgB,EAChB,OAA2D;QAE3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACjE,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,OAAO,CACL,aAAqB,EACrB,MAAc,EACd,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,kBAAkB,aAAa,UAAU,MAAM,UAAU,EACzD,wBAAwB,EACxB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,CACjF,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,UAA2B;CAAG;AAExE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,IAAyB;CAAG;AA6J1E,KAAK,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,KAAK,CAAC,wBAAwB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { FileBatches, type VectorStoreFileBatch, type FileBatchCreateParams, type FileBatchListFilesParams, } from "./file-batches.js";
2
+ export { VectorStoreFilesPage, FileContentResponsesPage, Files, type VectorStoreFile, type VectorStoreFileDeleted, type FileContentResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, } from "./files.js";
3
+ export { VectorStoresPage, VectorStoreSearchResponsesPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, type VectorStoreSearchParams, } from "./vector-stores.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,qCAAqC,EAC1C,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAC"}
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.VectorStores = exports.VectorStoresPage = exports.Files = exports.VectorStoreFilesPage = exports.FileBatches = void 0;
4
+ exports.VectorStores = exports.VectorStoreSearchResponsesPage = exports.VectorStoresPage = exports.Files = exports.FileContentResponsesPage = exports.VectorStoreFilesPage = exports.FileBatches = void 0;
5
5
  var file_batches_1 = require("./file-batches.js");
6
6
  Object.defineProperty(exports, "FileBatches", { enumerable: true, get: function () { return file_batches_1.FileBatches; } });
7
7
  var files_1 = require("./files.js");
8
8
  Object.defineProperty(exports, "VectorStoreFilesPage", { enumerable: true, get: function () { return files_1.VectorStoreFilesPage; } });
9
+ Object.defineProperty(exports, "FileContentResponsesPage", { enumerable: true, get: function () { return files_1.FileContentResponsesPage; } });
9
10
  Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
10
11
  var vector_stores_1 = require("./vector-stores.js");
11
12
  Object.defineProperty(exports, "VectorStoresPage", { enumerable: true, get: function () { return vector_stores_1.VectorStoresPage; } });
13
+ Object.defineProperty(exports, "VectorStoreSearchResponsesPage", { enumerable: true, get: function () { return vector_stores_1.VectorStoreSearchResponsesPage; } });
12
14
  Object.defineProperty(exports, "VectorStores", { enumerable: true, get: function () { return vector_stores_1.VectorStores; } });
13
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAKwB;AAJtB,2GAAA,WAAW,OAAA;AAKb,oCAUiB;AATf,6GAAA,oBAAoB,OAAA;AACpB,iHAAA,wBAAwB,OAAA;AACxB,8FAAA,KAAK,OAAA;AAQP,oDAkByB;AAjBvB,iHAAA,gBAAgB,OAAA;AAChB,+HAAA,8BAA8B,OAAA;AAC9B,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export { FileBatches, } from "./file-batches.mjs";
3
+ export { VectorStoreFilesPage, FileContentResponsesPage, Files, } from "./files.mjs";
4
+ export { VectorStoresPage, VectorStoreSearchResponsesPage, VectorStores, } from "./vector-stores.mjs";
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,WAAW,GAIZ;OACM,EACL,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,GAON;OACM,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,YAAY,GAeb"}
@@ -1,11 +1,11 @@
1
- import { APIResource } from "../../../resource.js";
2
- import * as Core from "../../../core.js";
3
- import * as Shared from "../../shared.js";
1
+ import { APIResource } from "../../resource.js";
2
+ import * as Core from "../../core.js";
3
+ import * as Shared from "../shared.js";
4
4
  import * as FileBatchesAPI from "./file-batches.js";
5
5
  import { FileBatchCreateParams, FileBatchListFilesParams, FileBatches, VectorStoreFileBatch } from "./file-batches.js";
6
6
  import * as FilesAPI from "./files.js";
7
- import { FileCreateParams, FileListParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage } from "./files.js";
8
- import { CursorPage, type CursorPageParams } from "../../../pagination.js";
7
+ import { FileContentResponse, FileContentResponsesPage, FileCreateParams, FileListParams, FileUpdateParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage } from "./files.js";
8
+ import { CursorPage, type CursorPageParams, Page } from "../../pagination.js";
9
9
  export declare class VectorStores extends APIResource {
10
10
  files: FilesAPI.Files;
11
11
  fileBatches: FileBatchesAPI.FileBatches;
@@ -30,9 +30,19 @@ export declare class VectorStores extends APIResource {
30
30
  * Delete a vector store.
31
31
  */
32
32
  del(vectorStoreId: string, options?: Core.RequestOptions): Core.APIPromise<VectorStoreDeleted>;
33
+ /**
34
+ * Search a vector store for relevant chunks based on a query and file attributes
35
+ * filter.
36
+ */
37
+ search(vectorStoreId: string, body: VectorStoreSearchParams, options?: Core.RequestOptions): Core.PagePromise<VectorStoreSearchResponsesPage, VectorStoreSearchResponse>;
33
38
  }
34
39
  export declare class VectorStoresPage extends CursorPage<VectorStore> {
35
40
  }
41
+ /**
42
+ * Note: no pagination actually occurs yet, this is for forwards-compatibility.
43
+ */
44
+ export declare class VectorStoreSearchResponsesPage extends Page<VectorStoreSearchResponse> {
45
+ }
36
46
  /**
37
47
  * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
38
48
  * `800` and `chunk_overlap_tokens` of `400`.
@@ -83,6 +93,9 @@ export interface StaticFileChunkingStrategyObject {
83
93
  */
84
94
  type: 'static';
85
95
  }
96
+ /**
97
+ * Customize your own chunking strategy by setting chunk size and chunk overlap.
98
+ */
86
99
  export interface StaticFileChunkingStrategyObjectParam {
87
100
  static: StaticFileChunkingStrategy;
88
101
  /**
@@ -187,6 +200,44 @@ export interface VectorStoreDeleted {
187
200
  deleted: boolean;
188
201
  object: 'vector_store.deleted';
189
202
  }
203
+ export interface VectorStoreSearchResponse {
204
+ /**
205
+ * Set of 16 key-value pairs that can be attached to an object. This can be useful
206
+ * for storing additional information about the object in a structured format, and
207
+ * querying for objects via API or the dashboard. Keys are strings with a maximum
208
+ * length of 64 characters. Values are strings with a maximum length of 512
209
+ * characters, booleans, or numbers.
210
+ */
211
+ attributes: Record<string, string | number | boolean> | null;
212
+ /**
213
+ * Content chunks from the file.
214
+ */
215
+ content: Array<VectorStoreSearchResponse.Content>;
216
+ /**
217
+ * The ID of the vector store file.
218
+ */
219
+ file_id: string;
220
+ /**
221
+ * The name of the vector store file.
222
+ */
223
+ filename: string;
224
+ /**
225
+ * The similarity score for the result.
226
+ */
227
+ score: number;
228
+ }
229
+ export declare namespace VectorStoreSearchResponse {
230
+ interface Content {
231
+ /**
232
+ * The text content returned from search.
233
+ */
234
+ text: string;
235
+ /**
236
+ * The type of content.
237
+ */
238
+ type: 'text';
239
+ }
240
+ }
190
241
  export interface VectorStoreCreateParams {
191
242
  /**
192
243
  * The chunking strategy used to chunk the file(s). If not set, will use the `auto`
@@ -282,9 +333,41 @@ export interface VectorStoreListParams extends CursorPageParams {
282
333
  */
283
334
  order?: 'asc' | 'desc';
284
335
  }
336
+ export interface VectorStoreSearchParams {
337
+ /**
338
+ * A query string for a search
339
+ */
340
+ query: string | Array<string>;
341
+ /**
342
+ * A filter to apply based on file attributes.
343
+ */
344
+ filters?: Shared.ComparisonFilter | Shared.CompoundFilter;
345
+ /**
346
+ * The maximum number of results to return. This number should be between 1 and 50
347
+ * inclusive.
348
+ */
349
+ max_num_results?: number;
350
+ /**
351
+ * Ranking options for search.
352
+ */
353
+ ranking_options?: VectorStoreSearchParams.RankingOptions;
354
+ /**
355
+ * Whether to rewrite the natural language query for vector search.
356
+ */
357
+ rewrite_query?: boolean;
358
+ }
359
+ export declare namespace VectorStoreSearchParams {
360
+ /**
361
+ * Ranking options for search.
362
+ */
363
+ interface RankingOptions {
364
+ ranker?: 'auto' | 'default-2024-11-15';
365
+ score_threshold?: number;
366
+ }
367
+ }
285
368
  export declare namespace VectorStores {
286
- export { type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, };
287
- export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, VectorStoreFilesPage as VectorStoreFilesPage, type FileCreateParams as FileCreateParams, type FileListParams as FileListParams, };
369
+ export { type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, type VectorStoreSearchResponse as VectorStoreSearchResponse, VectorStoresPage as VectorStoresPage, VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, type VectorStoreSearchParams as VectorStoreSearchParams, };
370
+ export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, type FileContentResponse as FileContentResponse, VectorStoreFilesPage as VectorStoreFilesPage, FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, };
288
371
  export { FileBatches as FileBatches, type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, type FileBatchListFilesParams as FileBatchListFilesParams, };
289
372
  }
290
373
  //# sourceMappingURL=vector-stores.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-stores.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/vector-stores.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,cAAc,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,QA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D,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,oBAAoB,IAAI,oBAAoB,EAC5C,wBAAwB,IAAI,wBAAwB,EACpD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -24,14 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  return result;
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.VectorStoresPage = exports.VectorStores = void 0;
28
- const resource_1 = require("../../../resource.js");
29
- const core_1 = require("../../../core.js");
27
+ exports.VectorStoreSearchResponsesPage = exports.VectorStoresPage = exports.VectorStores = void 0;
28
+ const resource_1 = require("../../resource.js");
29
+ const core_1 = require("../../core.js");
30
30
  const FileBatchesAPI = __importStar(require("./file-batches.js"));
31
31
  const file_batches_1 = require("./file-batches.js");
32
32
  const FilesAPI = __importStar(require("./files.js"));
33
33
  const files_1 = require("./files.js");
34
- const pagination_1 = require("../../../pagination.js");
34
+ const pagination_1 = require("../../pagination.js");
35
35
  class VectorStores extends resource_1.APIResource {
36
36
  constructor() {
37
37
  super(...arguments);
@@ -86,13 +86,33 @@ class VectorStores extends resource_1.APIResource {
86
86
  headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
87
87
  });
88
88
  }
89
+ /**
90
+ * Search a vector store for relevant chunks based on a query and file attributes
91
+ * filter.
92
+ */
93
+ search(vectorStoreId, body, options) {
94
+ return this._client.getAPIList(`/vector_stores/${vectorStoreId}/search`, VectorStoreSearchResponsesPage, {
95
+ body,
96
+ method: 'post',
97
+ ...options,
98
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
99
+ });
100
+ }
89
101
  }
90
102
  exports.VectorStores = VectorStores;
91
103
  class VectorStoresPage extends pagination_1.CursorPage {
92
104
  }
93
105
  exports.VectorStoresPage = VectorStoresPage;
106
+ /**
107
+ * Note: no pagination actually occurs yet, this is for forwards-compatibility.
108
+ */
109
+ class VectorStoreSearchResponsesPage extends pagination_1.Page {
110
+ }
111
+ exports.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage;
94
112
  VectorStores.VectorStoresPage = VectorStoresPage;
113
+ VectorStores.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage;
95
114
  VectorStores.Files = files_1.Files;
96
115
  VectorStores.VectorStoreFilesPage = files_1.VectorStoreFilesPage;
116
+ VectorStores.FileContentResponsesPage = files_1.FileContentResponsesPage;
97
117
  VectorStores.FileBatches = file_batches_1.FileBatches;
98
118
  //# sourceMappingURL=vector-stores.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-stores.js","sourceRoot":"","sources":["../../src/resources/vector-stores/vector-stores.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAG9C,kEAAiD;AACjD,oDAKwB;AACxB,qDAAoC;AACpC,sCAUiB;AACjB,oDAA2E;AAE3E,MAAa,YAAa,SAAQ,sBAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,gBAAW,GAA+B,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAsFzF,CAAC;IApFC;;OAEG;IACH,MAAM,CAAC,IAA6B,EAAE,OAA6B;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACzC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;S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B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,aAAa,SAAS,EAAE,8BAA8B,EAAE;YACvG,IAAI;YACJ,MAAM,EAAE,MAAM;YACd,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACjE,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,oCAwFC;AAED,MAAa,gBAAiB,SAAQ,uBAAuB;CAAG;AAAhE,4CAAgE;AAEhE;;GAEG;AACH,MAAa,8BAA+B,SAAQ,iBAA+B;CAAG;AAAtF,wEAAsF;AA+XtF,YAAY,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACjD,YAAY,CAAC,8BAA8B,GAAG,8BAA8B,CAAC;AAC7E,YAAY,CAAC,KAAK,GAAG,aAAK,CAAC;AAC3B,YAAY,CAAC,oBAAoB,GAAG,4BAAoB,CAAC;AACzD,YAAY,CAAC,wBAAwB,GAAG,gCAAwB,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,0BAAW,CAAC"}
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../../resource.mjs";
3
- import { isRequestOptions } from "../../../core.mjs";
2
+ import { APIResource } from "../../resource.mjs";
3
+ import { isRequestOptions } from "../../core.mjs";
4
4
  import * as FileBatchesAPI from "./file-batches.mjs";
5
5
  import { FileBatches, } from "./file-batches.mjs";
6
6
  import * as FilesAPI from "./files.mjs";
7
- import { Files, VectorStoreFilesPage, } from "./files.mjs";
8
- import { CursorPage } from "../../../pagination.mjs";
7
+ import { FileContentResponsesPage, Files, VectorStoreFilesPage, } from "./files.mjs";
8
+ import { CursorPage, Page } from "../../pagination.mjs";
9
9
  export class VectorStores extends APIResource {
10
10
  constructor() {
11
11
  super(...arguments);
@@ -60,11 +60,30 @@ export class VectorStores extends APIResource {
60
60
  headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
61
61
  });
62
62
  }
63
+ /**
64
+ * Search a vector store for relevant chunks based on a query and file attributes
65
+ * filter.
66
+ */
67
+ search(vectorStoreId, body, options) {
68
+ return this._client.getAPIList(`/vector_stores/${vectorStoreId}/search`, VectorStoreSearchResponsesPage, {
69
+ body,
70
+ method: 'post',
71
+ ...options,
72
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
73
+ });
74
+ }
63
75
  }
64
76
  export class VectorStoresPage extends CursorPage {
65
77
  }
78
+ /**
79
+ * Note: no pagination actually occurs yet, this is for forwards-compatibility.
80
+ */
81
+ export class VectorStoreSearchResponsesPage extends Page {
82
+ }
66
83
  VectorStores.VectorStoresPage = VectorStoresPage;
84
+ VectorStores.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage;
67
85
  VectorStores.Files = Files;
68
86
  VectorStores.VectorStoreFilesPage = VectorStoreFilesPage;
87
+ VectorStores.FileContentResponsesPage = FileContentResponsesPage;
69
88
  VectorStores.FileBatches = FileBatches;
70
89
  //# sourceMappingURL=vector-stores.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-stores.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/vector-stores.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAGpB,KAAK,cAAc;OACnB,EAGL,WAAW,GAEZ;OACM,KAAK,QAAQ;OACb,EAEL,wBAAwB,EAIxB,KAAK,EAGL,oBAAoB,GACrB;OACM,EAAE,UAAU,EAAyB,IAAI,EAAE;AAElD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,gBAAW,GAA+B,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAsFzF,CAAC;IApFC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AAM,CAAC,kBAAkB,aAAa,EAAE,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACjE,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,MAAM,CACJ,aAAqB,EACrB,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,aAAa,SAAS,EAAE,8BAA8B,EAAE;YACvG,IAAI;YACJ,MAAM,EAAE,MAAM;YACd,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACjE,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,UAAuB;CAAG;AAEhE;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,IAA+B;CAAG;AA+XtF,YAAY,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACjD,YAAY,CAAC,8BAA8B,GAAG,8BAA8B,CAAC;AAC7E,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,YAAY,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,YAAY,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC"}
package/src/core.ts CHANGED
@@ -62,8 +62,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<WithReq
62
62
  }
63
63
 
64
64
  const contentType = response.headers.get('content-type');
65
- const isJSON =
66
- contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
65
+ const mediaType = contentType?.split(';')[0]?.trim();
66
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
67
67
  if (isJSON) {
68
68
  const json = await response.json();
69
69
 
@@ -2,11 +2,15 @@ import { ResponseFormatJSONSchema } from '../resources/index';
2
2
  import type { infer as zodInfer, ZodType } from 'zod';
3
3
  import {
4
4
  AutoParseableResponseFormat,
5
+ AutoParseableTextFormat,
5
6
  AutoParseableTool,
6
7
  makeParseableResponseFormat,
8
+ makeParseableTextFormat,
7
9
  makeParseableTool,
8
10
  } from '../lib/parser';
9
11
  import { zodToJsonSchema as _zodToJsonSchema } from '../_vendor/zod-to-json-schema';
12
+ import { AutoParseableResponseTool, makeParseableResponseTool } from '../lib/ResponsesParser';
13
+ import { type ResponseFormatTextJSONSchemaConfig } from '../resources/responses/responses';
10
14
 
11
15
  function zodToJsonSchema(schema: ZodType, options: { name: string }): Record<string, unknown> {
12
16
  return _zodToJsonSchema(schema, {
@@ -74,6 +78,23 @@ export function zodResponseFormat<ZodInput extends ZodType>(
74
78
  );
75
79
  }
76
80
 
81
+ export function zodTextFormat<ZodInput extends ZodType>(
82
+ zodObject: ZodInput,
83
+ name: string,
84
+ props?: Omit<ResponseFormatTextJSONSchemaConfig, 'schema' | 'type' | 'strict' | 'name'>,
85
+ ): AutoParseableTextFormat<zodInfer<ZodInput>> {
86
+ return makeParseableTextFormat(
87
+ {
88
+ type: 'json_schema',
89
+ ...props,
90
+ name,
91
+ strict: true,
92
+ schema: zodToJsonSchema(zodObject, { name }),
93
+ },
94
+ (content) => zodObject.parse(JSON.parse(content)),
95
+ );
96
+ }
97
+
77
98
  /**
78
99
  * Creates a chat completion `function` tool that can be invoked
79
100
  * automatically by the chat completion `.runTools()` method or automatically
@@ -106,3 +127,28 @@ export function zodFunction<Parameters extends ZodType>(options: {
106
127
  },
107
128
  );
108
129
  }
130
+
131
+ export function zodResponsesFunction<Parameters extends ZodType>(options: {
132
+ name: string;
133
+ parameters: Parameters;
134
+ function?: ((args: zodInfer<Parameters>) => unknown | Promise<unknown>) | undefined;
135
+ description?: string | undefined;
136
+ }): AutoParseableResponseTool<{
137
+ arguments: Parameters;
138
+ name: string;
139
+ function: (args: zodInfer<Parameters>) => unknown;
140
+ }> {
141
+ return makeParseableResponseTool<any>(
142
+ {
143
+ type: 'function',
144
+ name: options.name,
145
+ parameters: zodToJsonSchema(options.parameters, { name: options.name }),
146
+ strict: true,
147
+ ...(options.description ? { description: options.description } : undefined),
148
+ },
149
+ {
150
+ callback: options.function,
151
+ parser: (args) => options.parameters.parse(JSON.parse(args)),
152
+ },
153
+ );
154
+ }