@mixedbread/sdk 0.5.0 → 0.7.2

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 (228) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +12 -24
  3. package/bin/migration-config.json +105 -2
  4. package/client.d.mts +12 -28
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +12 -28
  7. package/client.d.ts.map +1 -1
  8. package/client.js +6 -22
  9. package/client.js.map +1 -1
  10. package/client.mjs +6 -22
  11. package/client.mjs.map +1 -1
  12. package/core/pagination.d.mts +1 -1
  13. package/core/pagination.d.mts.map +1 -1
  14. package/core/pagination.d.ts +1 -1
  15. package/core/pagination.d.ts.map +1 -1
  16. package/core/resource.d.mts +1 -1
  17. package/core/resource.d.mts.map +1 -1
  18. package/core/resource.d.ts +1 -1
  19. package/core/resource.d.ts.map +1 -1
  20. package/core/resource.js.map +1 -1
  21. package/core/resource.mjs.map +1 -1
  22. package/internal/detect-platform.js +3 -3
  23. package/internal/detect-platform.js.map +1 -1
  24. package/internal/detect-platform.mjs +3 -3
  25. package/internal/detect-platform.mjs.map +1 -1
  26. package/internal/headers.d.mts.map +1 -1
  27. package/internal/headers.d.ts.map +1 -1
  28. package/internal/headers.js +5 -5
  29. package/internal/headers.js.map +1 -1
  30. package/internal/headers.mjs +5 -5
  31. package/internal/headers.mjs.map +1 -1
  32. package/internal/shim-types.d.mts +11 -22
  33. package/internal/shim-types.d.mts.map +1 -0
  34. package/internal/shim-types.d.ts +11 -22
  35. package/internal/shim-types.d.ts.map +1 -0
  36. package/internal/shim-types.js +4 -0
  37. package/internal/shim-types.js.map +1 -0
  38. package/internal/shim-types.mjs +3 -0
  39. package/internal/shim-types.mjs.map +1 -0
  40. package/internal/shims.d.mts +2 -2
  41. package/internal/shims.d.mts.map +1 -1
  42. package/internal/shims.d.ts +2 -2
  43. package/internal/shims.d.ts.map +1 -1
  44. package/internal/uploads.js +1 -1
  45. package/internal/uploads.js.map +1 -1
  46. package/internal/uploads.mjs +1 -1
  47. package/internal/uploads.mjs.map +1 -1
  48. package/internal/utils/log.js +1 -1
  49. package/internal/utils/log.js.map +1 -1
  50. package/internal/utils/log.mjs +1 -1
  51. package/internal/utils/log.mjs.map +1 -1
  52. package/internal/utils/path.d.mts.map +1 -1
  53. package/internal/utils/path.d.ts.map +1 -1
  54. package/internal/utils/path.js.map +1 -1
  55. package/internal/utils/path.mjs +1 -1
  56. package/internal/utils/path.mjs.map +1 -1
  57. package/internal/utils/values.d.mts +2 -0
  58. package/internal/utils/values.d.mts.map +1 -1
  59. package/internal/utils/values.d.ts +2 -0
  60. package/internal/utils/values.d.ts.map +1 -1
  61. package/internal/utils/values.js +4 -1
  62. package/internal/utils/values.js.map +1 -1
  63. package/internal/utils/values.mjs +2 -0
  64. package/internal/utils/values.mjs.map +1 -1
  65. package/package.json +1 -7
  66. package/resources/api-keys.d.mts +171 -0
  67. package/resources/api-keys.d.mts.map +1 -0
  68. package/resources/api-keys.d.ts +171 -0
  69. package/resources/api-keys.d.ts.map +1 -0
  70. package/resources/api-keys.js +76 -0
  71. package/resources/api-keys.js.map +1 -0
  72. package/resources/api-keys.mjs +72 -0
  73. package/resources/api-keys.mjs.map +1 -0
  74. package/resources/data-sources/connectors.d.mts +203 -0
  75. package/resources/data-sources/connectors.d.mts.map +1 -0
  76. package/resources/data-sources/connectors.d.ts +203 -0
  77. package/resources/data-sources/connectors.d.ts.map +1 -0
  78. package/resources/data-sources/connectors.js +73 -0
  79. package/resources/data-sources/connectors.js.map +1 -0
  80. package/resources/data-sources/connectors.mjs +69 -0
  81. package/resources/data-sources/connectors.mjs.map +1 -0
  82. package/resources/data-sources/data-sources.d.mts +287 -0
  83. package/resources/data-sources/data-sources.d.mts.map +1 -0
  84. package/resources/data-sources/data-sources.d.ts +287 -0
  85. package/resources/data-sources/data-sources.d.ts.map +1 -0
  86. package/resources/data-sources/data-sources.js +66 -0
  87. package/resources/data-sources/data-sources.js.map +1 -0
  88. package/resources/data-sources/data-sources.mjs +61 -0
  89. package/resources/data-sources/data-sources.mjs.map +1 -0
  90. package/resources/data-sources/index.d.mts +3 -0
  91. package/resources/data-sources/index.d.mts.map +1 -0
  92. package/resources/data-sources/index.d.ts +3 -0
  93. package/resources/data-sources/index.d.ts.map +1 -0
  94. package/resources/data-sources/index.js +9 -0
  95. package/resources/data-sources/index.js.map +1 -0
  96. package/resources/data-sources/index.mjs +4 -0
  97. package/resources/data-sources/index.mjs.map +1 -0
  98. package/resources/data-sources.d.mts +2 -0
  99. package/resources/data-sources.d.mts.map +1 -0
  100. package/resources/data-sources.d.ts +2 -0
  101. package/resources/data-sources.d.ts.map +1 -0
  102. package/resources/data-sources.js +6 -0
  103. package/resources/data-sources.js.map +1 -0
  104. package/resources/data-sources.mjs +3 -0
  105. package/resources/data-sources.mjs.map +1 -0
  106. package/resources/embeddings.d.mts +7 -11
  107. package/resources/embeddings.d.mts.map +1 -1
  108. package/resources/embeddings.d.ts +7 -11
  109. package/resources/embeddings.d.ts.map +1 -1
  110. package/resources/embeddings.js +0 -9
  111. package/resources/embeddings.js.map +1 -1
  112. package/resources/embeddings.mjs +0 -9
  113. package/resources/embeddings.mjs.map +1 -1
  114. package/resources/extractions/content.d.mts +44 -42
  115. package/resources/extractions/content.d.mts.map +1 -1
  116. package/resources/extractions/content.d.ts +44 -42
  117. package/resources/extractions/content.d.ts.map +1 -1
  118. package/resources/extractions/extractions.d.mts +2 -2
  119. package/resources/extractions/extractions.d.mts.map +1 -1
  120. package/resources/extractions/extractions.d.ts +2 -2
  121. package/resources/extractions/extractions.d.ts.map +1 -1
  122. package/resources/extractions/extractions.js.map +1 -1
  123. package/resources/extractions/extractions.mjs.map +1 -1
  124. package/resources/extractions/index.d.mts +1 -1
  125. package/resources/extractions/index.d.mts.map +1 -1
  126. package/resources/extractions/index.d.ts +1 -1
  127. package/resources/extractions/index.d.ts.map +1 -1
  128. package/resources/extractions/index.js.map +1 -1
  129. package/resources/extractions/index.mjs +1 -1
  130. package/resources/extractions/index.mjs.map +1 -1
  131. package/resources/extractions/jobs.d.mts +2 -1
  132. package/resources/extractions/jobs.d.mts.map +1 -1
  133. package/resources/extractions/jobs.d.ts +2 -1
  134. package/resources/extractions/jobs.d.ts.map +1 -1
  135. package/resources/extractions/jobs.js.map +1 -1
  136. package/resources/extractions/jobs.mjs.map +1 -1
  137. package/resources/files.d.mts +18 -1
  138. package/resources/files.d.mts.map +1 -1
  139. package/resources/files.d.ts +18 -1
  140. package/resources/files.d.ts.map +1 -1
  141. package/resources/index.d.mts +5 -3
  142. package/resources/index.d.mts.map +1 -1
  143. package/resources/index.d.ts +5 -3
  144. package/resources/index.d.ts.map +1 -1
  145. package/resources/index.js +5 -1
  146. package/resources/index.js.map +1 -1
  147. package/resources/index.mjs +2 -0
  148. package/resources/index.mjs.map +1 -1
  149. package/resources/parsing/index.d.mts +1 -1
  150. package/resources/parsing/index.d.mts.map +1 -1
  151. package/resources/parsing/index.d.ts +1 -1
  152. package/resources/parsing/index.d.ts.map +1 -1
  153. package/resources/parsing/index.js.map +1 -1
  154. package/resources/parsing/index.mjs.map +1 -1
  155. package/resources/parsing/jobs.d.mts +24 -10
  156. package/resources/parsing/jobs.d.mts.map +1 -1
  157. package/resources/parsing/jobs.d.ts +24 -10
  158. package/resources/parsing/jobs.d.ts.map +1 -1
  159. package/resources/parsing/jobs.js.map +1 -1
  160. package/resources/parsing/jobs.mjs.map +1 -1
  161. package/resources/parsing/parsing.d.mts +2 -2
  162. package/resources/parsing/parsing.d.mts.map +1 -1
  163. package/resources/parsing/parsing.d.ts +2 -2
  164. package/resources/parsing/parsing.d.ts.map +1 -1
  165. package/resources/parsing/parsing.js.map +1 -1
  166. package/resources/parsing/parsing.mjs.map +1 -1
  167. package/resources/top-level.d.mts +5 -4
  168. package/resources/top-level.d.mts.map +1 -1
  169. package/resources/top-level.d.ts +5 -4
  170. package/resources/top-level.d.ts.map +1 -1
  171. package/resources/vector-stores/files.d.mts +79 -19
  172. package/resources/vector-stores/files.d.mts.map +1 -1
  173. package/resources/vector-stores/files.d.ts +79 -19
  174. package/resources/vector-stores/files.d.ts.map +1 -1
  175. package/resources/vector-stores/files.js +19 -18
  176. package/resources/vector-stores/files.js.map +1 -1
  177. package/resources/vector-stores/files.mjs +19 -18
  178. package/resources/vector-stores/files.mjs.map +1 -1
  179. package/resources/vector-stores/index.d.mts +1 -1
  180. package/resources/vector-stores/index.d.mts.map +1 -1
  181. package/resources/vector-stores/index.d.ts +1 -1
  182. package/resources/vector-stores/index.d.ts.map +1 -1
  183. package/resources/vector-stores/index.js.map +1 -1
  184. package/resources/vector-stores/index.mjs.map +1 -1
  185. package/resources/vector-stores/vector-stores.d.mts +275 -90
  186. package/resources/vector-stores/vector-stores.d.mts.map +1 -1
  187. package/resources/vector-stores/vector-stores.d.ts +275 -90
  188. package/resources/vector-stores/vector-stores.d.ts.map +1 -1
  189. package/resources/vector-stores/vector-stores.js +18 -15
  190. package/resources/vector-stores/vector-stores.js.map +1 -1
  191. package/resources/vector-stores/vector-stores.mjs +18 -15
  192. package/resources/vector-stores/vector-stores.mjs.map +1 -1
  193. package/src/client.ts +63 -30
  194. package/src/core/pagination.ts +1 -1
  195. package/src/core/resource.ts +1 -1
  196. package/src/internal/detect-platform.ts +3 -3
  197. package/src/internal/headers.ts +6 -6
  198. package/src/internal/shim-types.ts +26 -0
  199. package/src/internal/shims.ts +2 -2
  200. package/src/internal/uploads.ts +2 -2
  201. package/src/internal/utils/log.ts +1 -1
  202. package/src/internal/utils/path.ts +1 -1
  203. package/src/internal/utils/values.ts +3 -0
  204. package/src/resources/api-keys.ts +225 -0
  205. package/src/resources/data-sources/connectors.ts +290 -0
  206. package/src/resources/data-sources/data-sources.ts +404 -0
  207. package/src/resources/data-sources/index.ts +24 -0
  208. package/src/resources/data-sources.ts +3 -0
  209. package/src/resources/embeddings.ts +25 -19
  210. package/src/resources/extractions/content.ts +51 -43
  211. package/src/resources/extractions/extractions.ts +3 -1
  212. package/src/resources/extractions/index.ts +7 -1
  213. package/src/resources/extractions/jobs.ts +2 -1
  214. package/src/resources/files.ts +21 -0
  215. package/src/resources/index.ts +26 -4
  216. package/src/resources/parsing/index.ts +4 -0
  217. package/src/resources/parsing/jobs.ts +42 -44
  218. package/src/resources/parsing/parsing.ts +8 -0
  219. package/src/resources/top-level.ts +5 -44
  220. package/src/resources/vector-stores/files.ts +104 -28
  221. package/src/resources/vector-stores/index.ts +4 -3
  222. package/src/resources/vector-stores/vector-stores.ts +330 -102
  223. package/src/version.ts +1 -1
  224. package/version.d.mts +1 -1
  225. package/version.d.ts +1 -1
  226. package/version.js +1 -1
  227. package/version.mjs +1 -1
  228. package/src/internal/shim-types.d.ts +0 -28
@@ -21,31 +21,32 @@ export class VectorStores extends APIResource {
21
21
  return this._client.post('/v1/vector_stores', { body, ...options });
22
22
  }
23
23
  /**
24
- * Get a vector store by ID.
24
+ * Get a vector store by ID or name.
25
25
  *
26
- * Args: vector_store_id: The ID of the vector store to retrieve.
26
+ * Args: vector_store_identifier: The ID or name of the vector store to retrieve.
27
27
  *
28
28
  * Returns: VectorStore: The response containing the vector store details.
29
29
  */
30
- retrieve(vectorStoreID, options) {
31
- return this._client.get(path `/v1/vector_stores/${vectorStoreID}`, options);
30
+ retrieve(vectorStoreIdentifier, options) {
31
+ return this._client.get(path `/v1/vector_stores/${vectorStoreIdentifier}`, options);
32
32
  }
33
33
  /**
34
- * Update a vector store by ID.
34
+ * Update a vector store by ID or name.
35
35
  *
36
- * Args: vector_store_id: The ID of the vector store to update.
36
+ * Args: vector_store_identifier: The ID or name of the vector store to update.
37
37
  * vector_store_update: VectorStoreCreate object containing the name, description,
38
38
  * and metadata.
39
39
  *
40
40
  * Returns: VectorStore: The response containing the updated vector store details.
41
41
  */
42
- update(vectorStoreID, body, options) {
43
- return this._client.put(path `/v1/vector_stores/${vectorStoreID}`, { body, ...options });
42
+ update(vectorStoreIdentifier, body, options) {
43
+ return this._client.put(path `/v1/vector_stores/${vectorStoreIdentifier}`, { body, ...options });
44
44
  }
45
45
  /**
46
- * List all vector stores.
46
+ * List all vector stores with optional search.
47
47
  *
48
- * Args: pagination: The pagination options.
48
+ * Args: pagination: The pagination options. q: Optional search query to filter
49
+ * vector stores.
49
50
  *
50
51
  * Returns: VectorStoreListResponse: The list of vector stores.
51
52
  */
@@ -53,14 +54,14 @@ export class VectorStores extends APIResource {
53
54
  return this._client.getAPIList('/v1/vector_stores', (LimitOffset), { query, ...options });
54
55
  }
55
56
  /**
56
- * Delete a vector store by ID.
57
+ * Delete a vector store by ID or name.
57
58
  *
58
- * Args: vector_store_id: The ID of the vector store to delete.
59
+ * Args: vector_store_identifier: The ID or name of the vector store to delete.
59
60
  *
60
61
  * Returns: VectorStore: The response containing the deleted vector store details.
61
62
  */
62
- delete(vectorStoreID, options) {
63
- return this._client.delete(path `/v1/vector_stores/${vectorStoreID}`, options);
63
+ delete(vectorStoreIdentifier, options) {
64
+ return this._client.delete(path `/v1/vector_stores/${vectorStoreIdentifier}`, options);
64
65
  }
65
66
  /**
66
67
  * Question answering
@@ -76,7 +77,9 @@ export class VectorStores extends APIResource {
76
77
  * relevance-scored results.
77
78
  *
78
79
  * Args: search_params: Search configuration including: - query text or
79
- * embeddings - metadata filters - pagination parameters - sorting preferences
80
+ * embeddings - vector_store_ids: List of vector stores to search - file_ids:
81
+ * Optional list of file IDs to filter chunks by (or tuple of list and condition
82
+ * operator) - metadata filters - pagination parameters - sorting preferences
80
83
  * \_state: API state dependency \_ctx: Service context dependency
81
84
  *
82
85
  * Returns: VectorStoreSearchChunkResponse containing: - List of matched chunks
@@ -1 +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;OAEf,KAAK,QAAQ;OACb,EAQL,KAAK,GAIN;OAEM,EAAE,WAAW,EAAuC;OAEpD,EAAE,IAAI,EAAE;AAEf,MAA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,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA,WAAwB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvG,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,qBAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,qBAAqB,qBAAqB,EAAE,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;OAEG;IACH,iBAAiB,CACf,IAAwC,EACxC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;AA8pBD,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC"}
package/src/client.ts CHANGED
@@ -32,7 +32,16 @@ import { APIPromise } from './core/api-promise';
32
32
  import { type Fetch } from './internal/builtin-types';
33
33
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
34
34
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
35
- import { EmbeddingCreateParams, Embeddings } from './resources/embeddings';
35
+ import {
36
+ APIKey,
37
+ APIKeyCreateParams,
38
+ APIKeyCreated,
39
+ APIKeyDeleteResponse,
40
+ APIKeyListParams,
41
+ APIKeys,
42
+ APIKeysLimitOffset,
43
+ } from './resources/api-keys';
44
+ import { EmbeddingCreateParams, Embeddings, EncodingFormat, ObjectType } from './resources/embeddings';
36
45
  import {
37
46
  FileCreateParams,
38
47
  FileDeleteResponse,
@@ -41,21 +50,34 @@ import {
41
50
  FileObjectsLimitOffset,
42
51
  FileUpdateParams,
43
52
  Files,
53
+ PaginationWithTotal,
44
54
  } from './resources/files';
45
55
  import { readEnv } from './internal/utils/env';
46
56
  import { formatRequestDetails, loggerFor } from './internal/utils/log';
47
57
  import { isEmptyObj } from './internal/utils/values';
58
+ import {
59
+ DataSource,
60
+ DataSourceCreateParams,
61
+ DataSourceDeleteResponse,
62
+ DataSourceListParams,
63
+ DataSourceOauth2Params,
64
+ DataSourceType,
65
+ DataSourceUpdateParams,
66
+ DataSources,
67
+ DataSourcesLimitOffset,
68
+ } from './resources/data-sources/data-sources';
48
69
  import { Extractions } from './resources/extractions/extractions';
49
70
  import { Parsing } from './resources/parsing/parsing';
50
71
  import {
51
72
  ExpiresAfter,
52
- FileCounts,
53
- ScoredVectorStoreChunk,
73
+ ScoredAudioURLInputChunk,
74
+ ScoredImageURLInputChunk,
75
+ ScoredTextInputChunk,
76
+ ScoredVideoURLInputChunk,
54
77
  VectorStore,
55
78
  VectorStoreChunkSearchOptions,
56
79
  VectorStoreCreateParams,
57
80
  VectorStoreDeleteResponse,
58
- VectorStoreFileSearchOptions,
59
81
  VectorStoreListParams,
60
82
  VectorStoreQuestionAnsweringParams,
61
83
  VectorStoreQuestionAnsweringResponse,
@@ -254,14 +276,6 @@ export class Mixedbread {
254
276
  * Args: params: The parameters for creating embeddings.
255
277
  *
256
278
  * Returns: EmbeddingCreateResponse: The response containing the embeddings.
257
- *
258
- * @example
259
- * ```ts
260
- * const embeddingCreateResponse = await client.embed({
261
- * model: 'mixedbread-ai/mxbai-embed-large-v1',
262
- * input: 'x',
263
- * });
264
- * ```
265
279
  */
266
280
  embed(
267
281
  body: TopLevelAPI.EmbedParams,
@@ -274,11 +288,6 @@ export class Mixedbread {
274
288
  * Returns service information, including name and version.
275
289
  *
276
290
  * Returns: InfoResponse: A response containing the service name and version.
277
- *
278
- * @example
279
- * ```ts
280
- * const response = await client.info();
281
- * ```
282
291
  */
283
292
  info(options?: RequestOptions): APIPromise<TopLevelAPI.InfoResponse> {
284
293
  return this.get('/', options);
@@ -290,15 +299,6 @@ export class Mixedbread {
290
299
  * Args: params: RerankParams: The parameters for reranking.
291
300
  *
292
301
  * Returns: RerankResponse: The reranked documents for the input query.
293
- *
294
- * @example
295
- * ```ts
296
- * const response = await client.rerank({
297
- * query:
298
- * 'What are the key features of the Mixedbread embedding model?',
299
- * input: ['Document 1', 'Document 2'],
300
- * });
301
- * ```
302
302
  */
303
303
  rerank(body: TopLevelAPI.RerankParams, options?: RequestOptions): APIPromise<TopLevelAPI.RerankResponse> {
304
304
  return this.post('/v1/reranking', { body, ...options });
@@ -837,12 +837,16 @@ export class Mixedbread {
837
837
  files: API.Files = new API.Files(this);
838
838
  extractions: API.Extractions = new API.Extractions(this);
839
839
  embeddings: API.Embeddings = new API.Embeddings(this);
840
+ dataSources: API.DataSources = new API.DataSources(this);
841
+ apiKeys: API.APIKeys = new API.APIKeys(this);
840
842
  }
841
843
  Mixedbread.VectorStores = VectorStores;
842
844
  Mixedbread.Parsing = Parsing;
843
845
  Mixedbread.Files = Files;
844
846
  Mixedbread.Extractions = Extractions;
845
847
  Mixedbread.Embeddings = Embeddings;
848
+ Mixedbread.DataSources = DataSources;
849
+ Mixedbread.APIKeys = APIKeys;
846
850
  export declare namespace Mixedbread {
847
851
  export type RequestOptions = Opts.RequestOptions;
848
852
 
@@ -862,11 +866,12 @@ export declare namespace Mixedbread {
862
866
  export {
863
867
  VectorStores as VectorStores,
864
868
  type ExpiresAfter as ExpiresAfter,
865
- type FileCounts as FileCounts,
866
- type ScoredVectorStoreChunk as ScoredVectorStoreChunk,
869
+ type ScoredAudioURLInputChunk as ScoredAudioURLInputChunk,
870
+ type ScoredImageURLInputChunk as ScoredImageURLInputChunk,
871
+ type ScoredTextInputChunk as ScoredTextInputChunk,
872
+ type ScoredVideoURLInputChunk as ScoredVideoURLInputChunk,
867
873
  type VectorStore as VectorStore,
868
874
  type VectorStoreChunkSearchOptions as VectorStoreChunkSearchOptions,
869
- type VectorStoreFileSearchOptions as VectorStoreFileSearchOptions,
870
875
  type VectorStoreDeleteResponse as VectorStoreDeleteResponse,
871
876
  type VectorStoreQuestionAnsweringResponse as VectorStoreQuestionAnsweringResponse,
872
877
  type VectorStoreSearchResponse as VectorStoreSearchResponse,
@@ -883,6 +888,7 @@ export declare namespace Mixedbread {
883
888
  export {
884
889
  Files as Files,
885
890
  type FileObject as FileObject,
891
+ type PaginationWithTotal as PaginationWithTotal,
886
892
  type FileDeleteResponse as FileDeleteResponse,
887
893
  type FileObjectsLimitOffset as FileObjectsLimitOffset,
888
894
  type FileCreateParams as FileCreateParams,
@@ -892,7 +898,34 @@ export declare namespace Mixedbread {
892
898
 
893
899
  export { Extractions as Extractions };
894
900
 
895
- export { Embeddings as Embeddings, type EmbeddingCreateParams as EmbeddingCreateParams };
901
+ export {
902
+ Embeddings as Embeddings,
903
+ type EncodingFormat as EncodingFormat,
904
+ type ObjectType as ObjectType,
905
+ type EmbeddingCreateParams as EmbeddingCreateParams,
906
+ };
907
+
908
+ export {
909
+ DataSources as DataSources,
910
+ type DataSource as DataSource,
911
+ type DataSourceOauth2Params as DataSourceOauth2Params,
912
+ type DataSourceType as DataSourceType,
913
+ type DataSourceDeleteResponse as DataSourceDeleteResponse,
914
+ type DataSourcesLimitOffset as DataSourcesLimitOffset,
915
+ type DataSourceCreateParams as DataSourceCreateParams,
916
+ type DataSourceUpdateParams as DataSourceUpdateParams,
917
+ type DataSourceListParams as DataSourceListParams,
918
+ };
919
+
920
+ export {
921
+ APIKeys as APIKeys,
922
+ type APIKey as APIKey,
923
+ type APIKeyCreated as APIKeyCreated,
924
+ type APIKeyDeleteResponse as APIKeyDeleteResponse,
925
+ type APIKeysLimitOffset as APIKeysLimitOffset,
926
+ type APIKeyCreateParams as APIKeyCreateParams,
927
+ type APIKeyListParams as APIKeyListParams,
928
+ };
896
929
 
897
930
  export type SearchFilter = API.SearchFilter;
898
931
  export type SearchFilterCondition = API.SearchFilterCondition;
@@ -99,7 +99,7 @@ export class PagePromise<
99
99
  * console.log(item)
100
100
  * }
101
101
  */
102
- async *[Symbol.asyncIterator]() {
102
+ async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
103
103
  const page = await this;
104
104
  for await (const item of page) {
105
105
  yield item;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type { Mixedbread } from '../client';
4
4
 
5
- export class APIResource {
5
+ export abstract class APIResource {
6
6
  protected _client: Mixedbread;
7
7
 
8
8
  constructor(client: Mixedbread) {
@@ -85,10 +85,10 @@ const getPlatformProperties = (): PlatformProperties => {
85
85
  return {
86
86
  'X-Stainless-Lang': 'js',
87
87
  'X-Stainless-Package-Version': VERSION,
88
- 'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform),
89
- 'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch),
88
+ 'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform ?? 'unknown'),
89
+ 'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch ?? 'unknown'),
90
90
  'X-Stainless-Runtime': 'node',
91
- 'X-Stainless-Runtime-Version': (globalThis as any).process.version,
91
+ 'X-Stainless-Runtime-Version': (globalThis as any).process.version ?? 'unknown',
92
92
  };
93
93
  }
94
94
 
@@ -1,5 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ import { isReadonlyArray } from './utils/values';
4
+
3
5
  type HeaderValue = string | undefined | null;
4
6
  export type HeadersLike =
5
7
  | Headers
@@ -9,7 +11,7 @@ export type HeadersLike =
9
11
  | null
10
12
  | NullableHeaders;
11
13
 
12
- const brand_privateNullableHeaders = Symbol('brand.privateNullableHeaders');
14
+ const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
13
15
 
14
16
  /**
15
17
  * @internal
@@ -25,8 +27,6 @@ export type NullableHeaders = {
25
27
  nulls: Set<string>;
26
28
  };
27
29
 
28
- const isArray = Array.isArray as (val: unknown) => val is readonly unknown[];
29
-
30
30
  function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [string, string | null]> {
31
31
  if (!headers) return;
32
32
 
@@ -43,7 +43,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
43
43
  let iter: Iterable<readonly (HeaderValue | readonly HeaderValue[])[]>;
44
44
  if (headers instanceof Headers) {
45
45
  iter = headers.entries();
46
- } else if (isArray(headers)) {
46
+ } else if (isReadonlyArray(headers)) {
47
47
  iter = headers;
48
48
  } else {
49
49
  shouldClear = true;
@@ -52,7 +52,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
52
52
  for (let row of iter) {
53
53
  const name = row[0];
54
54
  if (typeof name !== 'string') throw new TypeError('expected header name to be a string');
55
- const values = isArray(row[1]) ? row[1] : [row[1]];
55
+ const values = isReadonlyArray(row[1]) ? row[1] : [row[1]];
56
56
  let didClear = false;
57
57
  for (const value of values) {
58
58
  if (value === undefined) continue;
@@ -71,8 +71,8 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
71
71
  export const buildHeaders = (newHeaders: HeadersLike[]): NullableHeaders => {
72
72
  const targetHeaders = new Headers();
73
73
  const nullHeaders = new Set<string>();
74
- const seenHeaders = new Set<string>();
75
74
  for (const headers of newHeaders) {
75
+ const seenHeaders = new Set<string>();
76
76
  for (const [name, value] of iterateHeaders(headers)) {
77
77
  const lowerName = name.toLowerCase();
78
78
  if (!seenHeaders.has(lowerName)) {
@@ -0,0 +1,26 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ /**
4
+ * Shims for types that we can't always rely on being available globally.
5
+ *
6
+ * Note: these only exist at the type-level, there is no corresponding runtime
7
+ * version for any of these symbols.
8
+ */
9
+
10
+ type NeverToAny<T> = T extends never ? any : T;
11
+
12
+ /** @ts-ignore */
13
+ type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
14
+
15
+ /** @ts-ignore */
16
+ type _NodeReadableStream<R = any> = import('stream/web').ReadableStream<R>;
17
+
18
+ type _ConditionalNodeReadableStream<R = any> =
19
+ typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream<R>;
20
+
21
+ type _ReadableStream<R = any> = NeverToAny<
22
+ | ([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>)
23
+ | ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)
24
+ >;
25
+
26
+ export type { _ReadableStream as ReadableStream };
@@ -7,8 +7,8 @@
7
7
  * messages in cases where an environment isn't fully supported.
8
8
  */
9
9
 
10
- import { type Fetch } from './builtin-types';
11
- import { type ReadableStream } from './shim-types';
10
+ import type { Fetch } from './builtin-types';
11
+ import type { ReadableStream } from './shim-types';
12
12
 
13
13
  export function getDefaultFetch(): Fetch {
14
14
  if (typeof fetch !== 'undefined') {
@@ -90,7 +90,7 @@ export const multipartFormRequestOptions = async (
90
90
  return { ...opts, body: await createForm(opts.body, fetch) };
91
91
  };
92
92
 
93
- const supportsFormDataMap = new WeakMap<Fetch, Promise<boolean>>();
93
+ const supportsFormDataMap = /** @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>();
94
94
 
95
95
  /**
96
96
  * node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
@@ -138,7 +138,7 @@ export const createForm = async <T = Record<string, unknown>>(
138
138
 
139
139
  // We check for Blob not File because Bun.File doesn't inherit from File,
140
140
  // but they both inherit from Blob and have a `name` property at runtime.
141
- const isNamedBlob = (value: object) => value instanceof Blob && 'name' in value;
141
+ const isNamedBlob = (value: unknown) => value instanceof Blob && 'name' in value;
142
142
 
143
143
  const isUploadable = (value: unknown) =>
144
144
  typeof value === 'object' &&
@@ -58,7 +58,7 @@ const noopLogger = {
58
58
  debug: noop,
59
59
  };
60
60
 
61
- let cachedLoggers = new WeakMap<Logger, [LogLevel, Logger]>();
61
+ let cachedLoggers = /** @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
63
  export function loggerFor(client: Mixedbread): Logger {
64
64
  const logger = client.logger;
@@ -62,4 +62,4 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
62
62
  /**
63
63
  * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
64
64
  */
65
- export const path = createPathTagFunction(encodeURIPath);
65
+ export const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
@@ -9,6 +9,9 @@ export const isAbsoluteURL = (url: string): boolean => {
9
9
  return startsWithSchemeRegexp.test(url);
10
10
  };
11
11
 
12
+ export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
13
+ export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];
14
+
12
15
  /** Returns an object if the given value isn't an object, otherwise returns as-is */
13
16
  export function maybeObj(x: unknown): object {
14
17
  if (typeof x !== 'object') {
@@ -0,0 +1,225 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { LimitOffset, type LimitOffsetParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class APIKeys extends APIResource {
10
+ /**
11
+ * Create a new API key.
12
+ *
13
+ * Args: params: The parameters for creating the API key.
14
+ *
15
+ * Returns: ApiKeyCreated: The response containing the details of the created API
16
+ * key.
17
+ */
18
+ create(body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKeyCreated> {
19
+ return this._client.post('/v1/api-keys', { body, ...options });
20
+ }
21
+
22
+ /**
23
+ * Retrieve details of a specific API key by its ID.
24
+ *
25
+ * Args: api_key_id: The ID of the API key to retrieve.
26
+ *
27
+ * Returns: ApiKey: The response containing the API key details.
28
+ */
29
+ retrieve(apiKeyID: string, options?: RequestOptions): APIPromise<APIKey> {
30
+ return this._client.get(path`/v1/api-keys/${apiKeyID}`, options);
31
+ }
32
+
33
+ /**
34
+ * List all API keys for the authenticated user.
35
+ *
36
+ * Args: pagination: The pagination options
37
+ *
38
+ * Returns: A list of API keys belonging to the user.
39
+ */
40
+ list(
41
+ query: APIKeyListParams | null | undefined = {},
42
+ options?: RequestOptions,
43
+ ): PagePromise<APIKeysLimitOffset, APIKey> {
44
+ return this._client.getAPIList('/v1/api-keys', LimitOffset<APIKey>, { query, ...options });
45
+ }
46
+
47
+ /**
48
+ * Delete a specific API key by its ID.
49
+ *
50
+ * Args: api_key_id: The ID of the API key to delete.
51
+ *
52
+ * Returns: ApiKeyDeleted: The response containing the details of the deleted API
53
+ * key.
54
+ */
55
+ delete(apiKeyID: string, options?: RequestOptions): APIPromise<APIKeyDeleteResponse> {
56
+ return this._client.delete(path`/v1/api-keys/${apiKeyID}`, options);
57
+ }
58
+
59
+ /**
60
+ * Reroll the secret for a specific API key by its ID.
61
+ *
62
+ * This generates a new secret key, invalidating the old one.
63
+ *
64
+ * Args: api_key_id: The ID of the API key to reroll.
65
+ *
66
+ * Returns: ApiKeyCreated: The response containing the API key details with the new
67
+ * secret key.
68
+ */
69
+ reroll(apiKeyID: string, options?: RequestOptions): APIPromise<APIKeyCreated> {
70
+ return this._client.post(path`/v1/api-keys/${apiKeyID}/reroll`, options);
71
+ }
72
+
73
+ /**
74
+ * Revoke a specific API key by its ID.
75
+ *
76
+ * Args: api_key_id: The ID of the API key to revoke.
77
+ *
78
+ * Returns: ApiKey: The response containing the details of the revoked API key.
79
+ */
80
+ revoke(apiKeyID: string, options?: RequestOptions): APIPromise<APIKey> {
81
+ return this._client.post(path`/v1/api-keys/${apiKeyID}/revoke`, options);
82
+ }
83
+ }
84
+
85
+ export type APIKeysLimitOffset = LimitOffset<APIKey>;
86
+
87
+ /**
88
+ * Response model for an API key.
89
+ */
90
+ export interface APIKey {
91
+ /**
92
+ * The ID of the API key
93
+ */
94
+ id: string;
95
+
96
+ /**
97
+ * The name of the API key
98
+ */
99
+ name: string;
100
+
101
+ /**
102
+ * The redacted value of the API key
103
+ */
104
+ redacted_value: string;
105
+
106
+ /**
107
+ * The expiration datetime of the API key
108
+ */
109
+ expires_at?: string | null;
110
+
111
+ /**
112
+ * The creation datetime of the API key
113
+ */
114
+ created_at: string;
115
+
116
+ /**
117
+ * The last update datetime of the API key
118
+ */
119
+ updated_at: string;
120
+
121
+ /**
122
+ * The last active datetime of the API key
123
+ */
124
+ last_active_at?: string | null;
125
+
126
+ /**
127
+ * The type of the object
128
+ */
129
+ object?: 'api_key';
130
+ }
131
+
132
+ /**
133
+ * Response model for creating an API key.
134
+ */
135
+ export interface APIKeyCreated {
136
+ /**
137
+ * The ID of the API key
138
+ */
139
+ id: string;
140
+
141
+ /**
142
+ * The name of the API key
143
+ */
144
+ name: string;
145
+
146
+ /**
147
+ * The redacted value of the API key
148
+ */
149
+ redacted_value: string;
150
+
151
+ /**
152
+ * The expiration datetime of the API key
153
+ */
154
+ expires_at?: string | null;
155
+
156
+ /**
157
+ * The creation datetime of the API key
158
+ */
159
+ created_at: string;
160
+
161
+ /**
162
+ * The last update datetime of the API key
163
+ */
164
+ updated_at: string;
165
+
166
+ /**
167
+ * The last active datetime of the API key
168
+ */
169
+ last_active_at?: string | null;
170
+
171
+ /**
172
+ * The type of the object
173
+ */
174
+ object?: 'api_key';
175
+
176
+ /**
177
+ * The value of the API key
178
+ */
179
+ value: string;
180
+ }
181
+
182
+ /**
183
+ * Response model for deleting an API key.
184
+ */
185
+ export interface APIKeyDeleteResponse {
186
+ /**
187
+ * The ID of the deleted API key
188
+ */
189
+ id: string;
190
+
191
+ /**
192
+ * Whether the API key was deleted
193
+ */
194
+ deleted: boolean;
195
+
196
+ /**
197
+ * The type of the object deleted
198
+ */
199
+ object?: 'api_key';
200
+ }
201
+
202
+ export interface APIKeyCreateParams {
203
+ /**
204
+ * A name/description for the API key
205
+ */
206
+ name?: string;
207
+
208
+ /**
209
+ * Optional expiration datetime
210
+ */
211
+ expires_at?: string | null;
212
+ }
213
+
214
+ export interface APIKeyListParams extends LimitOffsetParams {}
215
+
216
+ export declare namespace APIKeys {
217
+ export {
218
+ type APIKey as APIKey,
219
+ type APIKeyCreated as APIKeyCreated,
220
+ type APIKeyDeleteResponse as APIKeyDeleteResponse,
221
+ type APIKeysLimitOffset as APIKeysLimitOffset,
222
+ type APIKeyCreateParams as APIKeyCreateParams,
223
+ type APIKeyListParams as APIKeyListParams,
224
+ };
225
+ }