mindee 5.7.2 → 5.9.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 (264) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/package.json +104 -95
  3. package/src/geometry/bbox.js +1 -1
  4. package/src/image/extractedImages.d.ts +1 -1
  5. package/src/image/imageExtractor.d.ts +1 -1
  6. package/src/image/imageExtractor.js +2 -2
  7. package/src/input/localInputSource.d.ts +1 -1
  8. package/src/parsing/baseLocalResponse.d.ts +1 -1
  9. package/src/pdf/extractedPdfs.d.ts +1 -1
  10. package/src/pdf/pdfExtractor.d.ts +1 -1
  11. package/src/pdf/pdfExtractor.js +2 -2
  12. package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts +2 -2
  13. package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +2 -2
  14. package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.d.ts +2 -2
  15. package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +1 -1
  16. package/src/v1/http/baseEndpoint.d.ts +1 -1
  17. package/src/v1/http/endpoint.d.ts +1 -1
  18. package/src/v1/http/endpoint.js +1 -1
  19. package/src/v1/http/httpParams.d.ts +1 -1
  20. package/src/v1/http/workflowEndpoint.d.ts +2 -2
  21. package/src/v1/http/workflowEndpoint.js +1 -1
  22. package/src/v1/parsing/common/execution.d.ts +1 -1
  23. package/src/v1/parsing/common/execution.js +1 -1
  24. package/src/v1/parsing/common/extras/cropperExtra.d.ts +1 -1
  25. package/src/v1/parsing/common/extras/cropperExtra.js +1 -1
  26. package/src/v1/parsing/common/ocrPage.d.ts +1 -1
  27. package/src/v1/parsing/common/ocrPage.js +1 -1
  28. package/src/v1/parsing/common/orientation.d.ts +1 -1
  29. package/src/v1/parsing/common/orientation.js +1 -1
  30. package/src/v1/parsing/generated/generatedList.d.ts +1 -1
  31. package/src/v1/parsing/generated/generatedList.js +1 -1
  32. package/src/v1/parsing/generated/generatedObject.d.ts +1 -1
  33. package/src/v1/parsing/generated/generatedObject.js +1 -1
  34. package/src/v1/parsing/localResponse.d.ts +1 -1
  35. package/src/v1/parsing/localResponse.js +1 -1
  36. package/src/v1/parsing/standard/amount.js +1 -1
  37. package/src/v1/parsing/standard/companyRegistration.js +1 -1
  38. package/src/v1/parsing/standard/tax.d.ts +1 -1
  39. package/src/v1/parsing/standard/tax.js +1 -1
  40. package/src/v1/product/barcodeReader/barcodeReaderV1.d.ts +1 -1
  41. package/src/v1/product/barcodeReader/barcodeReaderV1.js +1 -1
  42. package/src/v1/product/barcodeReader/barcodeReaderV1Document.d.ts +2 -2
  43. package/src/v1/product/barcodeReader/barcodeReaderV1Document.js +2 -2
  44. package/src/v1/product/cliProducts.d.ts +2 -2
  45. package/src/v1/product/cliProducts.js +1 -1
  46. package/src/v1/product/cropper/cropperV1.d.ts +1 -1
  47. package/src/v1/product/cropper/cropperV1.js +1 -1
  48. package/src/v1/product/cropper/cropperV1Document.d.ts +1 -1
  49. package/src/v1/product/cropper/cropperV1Page.d.ts +2 -2
  50. package/src/v1/product/cropper/cropperV1Page.js +2 -2
  51. package/src/v1/product/driverLicense/driverLicenseV1.d.ts +1 -1
  52. package/src/v1/product/driverLicense/driverLicenseV1.js +1 -1
  53. package/src/v1/product/driverLicense/driverLicenseV1Document.d.ts +2 -2
  54. package/src/v1/product/driverLicense/driverLicenseV1Document.js +2 -2
  55. package/src/v1/product/financialDocument/financialDocumentV1.d.ts +1 -1
  56. package/src/v1/product/financialDocument/financialDocumentV1.js +1 -1
  57. package/src/v1/product/financialDocument/financialDocumentV1Document.d.ts +2 -2
  58. package/src/v1/product/financialDocument/financialDocumentV1Document.js +2 -2
  59. package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +1 -1
  60. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +1 -1
  61. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.js +1 -1
  62. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +2 -2
  63. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.js +2 -2
  64. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +1 -1
  65. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.js +1 -1
  66. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts +2 -2
  67. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.js +2 -2
  68. package/src/v1/product/fr/carteGrise/carteGriseV1.d.ts +1 -1
  69. package/src/v1/product/fr/carteGrise/carteGriseV1.js +1 -1
  70. package/src/v1/product/fr/carteGrise/carteGriseV1Document.d.ts +2 -2
  71. package/src/v1/product/fr/carteGrise/carteGriseV1Document.js +2 -2
  72. package/src/v1/product/fr/idCard/idCardV2.d.ts +1 -1
  73. package/src/v1/product/fr/idCard/idCardV2.js +1 -1
  74. package/src/v1/product/fr/idCard/idCardV2Document.d.ts +2 -2
  75. package/src/v1/product/fr/idCard/idCardV2Document.js +2 -2
  76. package/src/v1/product/fr/idCard/idCardV2Page.d.ts +2 -2
  77. package/src/v1/product/fr/idCard/idCardV2Page.js +2 -2
  78. package/src/v1/product/generated/generatedV1.d.ts +1 -1
  79. package/src/v1/product/generated/generatedV1.js +1 -1
  80. package/src/v1/product/generated/generatedV1Document.js +2 -2
  81. package/src/v1/product/generated/generatedV1Page.js +2 -2
  82. package/src/v1/product/generated/generatedV1Prediction.d.ts +3 -3
  83. package/src/v1/product/generated/generatedV1Prediction.js +3 -3
  84. package/src/v1/product/internationalId/internationalIdV2.d.ts +1 -1
  85. package/src/v1/product/internationalId/internationalIdV2.js +1 -1
  86. package/src/v1/product/internationalId/internationalIdV2Document.d.ts +2 -2
  87. package/src/v1/product/internationalId/internationalIdV2Document.js +2 -2
  88. package/src/v1/product/invoice/invoiceV4.d.ts +1 -1
  89. package/src/v1/product/invoice/invoiceV4.js +1 -1
  90. package/src/v1/product/invoice/invoiceV4Document.d.ts +2 -2
  91. package/src/v1/product/invoice/invoiceV4Document.js +2 -2
  92. package/src/v1/product/invoice/invoiceV4LineItem.js +1 -1
  93. package/src/v1/product/invoiceSplitter/invoiceSplitterV1.d.ts +1 -1
  94. package/src/v1/product/invoiceSplitter/invoiceSplitterV1.js +1 -1
  95. package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +1 -1
  96. package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.js +1 -1
  97. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.d.ts +1 -1
  98. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +1 -1
  99. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +2 -2
  100. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +2 -2
  101. package/src/v1/product/passport/passportV1.d.ts +1 -1
  102. package/src/v1/product/passport/passportV1.js +1 -1
  103. package/src/v1/product/passport/passportV1Document.d.ts +2 -2
  104. package/src/v1/product/passport/passportV1Document.js +2 -2
  105. package/src/v1/product/receipt/receiptV5.d.ts +1 -1
  106. package/src/v1/product/receipt/receiptV5.js +1 -1
  107. package/src/v1/product/receipt/receiptV5Document.d.ts +2 -2
  108. package/src/v1/product/receipt/receiptV5Document.js +2 -2
  109. package/src/v1/product/receipt/receiptV5LineItem.js +1 -1
  110. package/src/v1/product/resume/resumeV1.d.ts +1 -1
  111. package/src/v1/product/resume/resumeV1.js +1 -1
  112. package/src/v1/product/resume/resumeV1Certificate.js +1 -1
  113. package/src/v1/product/resume/resumeV1Document.d.ts +2 -2
  114. package/src/v1/product/resume/resumeV1Document.js +2 -2
  115. package/src/v1/product/resume/resumeV1Education.js +1 -1
  116. package/src/v1/product/resume/resumeV1Language.js +1 -1
  117. package/src/v1/product/resume/resumeV1ProfessionalExperience.js +1 -1
  118. package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +1 -1
  119. package/src/v1/product/us/bankCheck/bankCheckV1.d.ts +1 -1
  120. package/src/v1/product/us/bankCheck/bankCheckV1.js +1 -1
  121. package/src/v1/product/us/bankCheck/bankCheckV1Document.d.ts +2 -2
  122. package/src/v1/product/us/bankCheck/bankCheckV1Document.js +2 -2
  123. package/src/v1/product/us/bankCheck/bankCheckV1Page.d.ts +2 -2
  124. package/src/v1/product/us/bankCheck/bankCheckV1Page.js +2 -2
  125. package/src/v2/cli.js +1 -1
  126. package/src/v2/client.d.ts +94 -18
  127. package/src/v2/client.js +171 -27
  128. package/src/v2/clientOptions/baseAnnotationParameters.d.ts +23 -0
  129. package/src/v2/clientOptions/baseAnnotationParameters.js +17 -0
  130. package/src/v2/clientOptions/baseProductParameters.js +3 -2
  131. package/src/v2/clientOptions/baseRagDocumentUploadParameters.d.ts +23 -0
  132. package/src/v2/clientOptions/baseRagDocumentUploadParameters.js +24 -0
  133. package/src/v2/clientOptions/index.d.ts +2 -0
  134. package/src/v2/clientOptions/index.js +2 -0
  135. package/src/v2/fileOperations/crop.d.ts +1 -1
  136. package/src/v2/http/errors.d.ts +1 -1
  137. package/src/v2/http/mindeeApiV2.d.ts +35 -6
  138. package/src/v2/http/mindeeApiV2.js +91 -10
  139. package/src/v2/index.d.ts +1 -1
  140. package/src/v2/index.js +1 -1
  141. package/src/v2/parsing/baseRagAnnotationResponse.d.ts +28 -0
  142. package/src/v2/parsing/baseRagAnnotationResponse.js +14 -0
  143. package/src/v2/parsing/baseResponse.d.ts +6 -2
  144. package/src/v2/parsing/baseResponse.js +3 -1
  145. package/src/v2/parsing/error/errorItem.d.ts +1 -1
  146. package/src/v2/parsing/error/errorItem.js +1 -3
  147. package/src/v2/parsing/error/errorResponse.d.ts +5 -1
  148. package/src/v2/parsing/error/errorResponse.js +27 -1
  149. package/src/v2/parsing/index.d.ts +3 -1
  150. package/src/v2/parsing/index.js +2 -1
  151. package/src/v2/parsing/inference/failedInferenceResponse.d.ts +2 -2
  152. package/src/v2/parsing/inference/failedInferenceResponse.js +2 -2
  153. package/src/v2/parsing/inference/field/inferenceFields.d.ts +9 -3
  154. package/src/v2/parsing/inference/field/inferenceFields.js +9 -3
  155. package/src/v2/parsing/inference/field/objectField.d.ts +13 -9
  156. package/src/v2/parsing/inference/field/objectField.js +19 -33
  157. package/src/v2/parsing/inference/index.d.ts +1 -0
  158. package/src/v2/parsing/inference/index.js +1 -0
  159. package/src/v2/parsing/job/job.d.ts +8 -8
  160. package/src/v2/parsing/job/job.js +1 -1
  161. package/src/v2/parsing/job/jobResponse.d.ts +1 -1
  162. package/src/v2/parsing/job/jobResponse.js +1 -1
  163. package/src/v2/parsing/job/jobWebhook.d.ts +1 -1
  164. package/src/v2/parsing/job/jobWebhook.js +1 -1
  165. package/src/v2/parsing/search/baseSearchResponse.d.ts +1 -1
  166. package/src/v2/parsing/search/baseSearchResponse.js +1 -1
  167. package/src/v2/parsing/search/searchModels.d.ts +1 -1
  168. package/src/v2/parsing/search/searchModels.js +1 -1
  169. package/src/v2/parsing/search/searchRagDocuments.d.ts +1 -1
  170. package/src/v2/parsing/search/searchRagDocuments.js +1 -1
  171. package/src/v2/parsing/search/searchResponse.d.ts +1 -1
  172. package/src/v2/parsing/search/searchResponse.js +1 -1
  173. package/src/v2/product/baseProduct.d.ts +26 -6
  174. package/src/v2/product/baseProduct.js +31 -7
  175. package/src/v2/product/classification/classification.d.ts +1 -1
  176. package/src/v2/product/classification/classification.js +1 -1
  177. package/src/v2/product/classification/classificationClassifier.d.ts +1 -1
  178. package/src/v2/product/classification/classificationClassifier.js +1 -1
  179. package/src/v2/product/classification/classificationInference.d.ts +1 -1
  180. package/src/v2/product/classification/classificationInference.js +1 -1
  181. package/src/v2/product/classification/classificationResponse.d.ts +1 -1
  182. package/src/v2/product/classification/classificationResponse.js +1 -1
  183. package/src/v2/product/classification/params/classificationParameters.d.ts +1 -1
  184. package/src/v2/product/classification/params/classificationParameters.js +1 -1
  185. package/src/v2/product/crop/crop.d.ts +1 -1
  186. package/src/v2/product/crop/crop.js +1 -1
  187. package/src/v2/product/crop/cropInference.d.ts +2 -2
  188. package/src/v2/product/crop/cropInference.js +2 -2
  189. package/src/v2/product/crop/cropItem.d.ts +2 -2
  190. package/src/v2/product/crop/cropItem.js +3 -3
  191. package/src/v2/product/crop/cropResponse.d.ts +1 -1
  192. package/src/v2/product/crop/cropResponse.js +1 -1
  193. package/src/v2/product/crop/cropResult.d.ts +1 -1
  194. package/src/v2/product/crop/cropResult.js +2 -2
  195. package/src/v2/product/crop/params/cropParameters.d.ts +1 -1
  196. package/src/v2/product/crop/params/cropParameters.js +1 -1
  197. package/src/v2/product/extraction/extraction.d.ts +10 -2
  198. package/src/v2/product/extraction/extraction.js +17 -3
  199. package/src/v2/product/extraction/extractionInference.d.ts +1 -1
  200. package/src/v2/product/extraction/extractionInference.js +1 -1
  201. package/src/v2/product/extraction/extractionResponse.d.ts +1 -1
  202. package/src/v2/product/extraction/extractionResponse.js +1 -1
  203. package/src/v2/product/extraction/extractionResult.d.ts +3 -3
  204. package/src/v2/product/extraction/extractionResult.js +3 -3
  205. package/src/v2/product/extraction/index.d.ts +1 -0
  206. package/src/v2/product/extraction/index.js +1 -0
  207. package/src/v2/product/extraction/params/extractionParameters.d.ts +1 -1
  208. package/src/v2/product/extraction/params/extractionParameters.js +1 -1
  209. package/src/v2/product/extraction/ragDocuments/annotatedBaseField.d.ts +20 -0
  210. package/src/v2/product/extraction/ragDocuments/annotatedBaseField.js +15 -0
  211. package/src/v2/product/extraction/ragDocuments/annotatedFields.d.ts +27 -0
  212. package/src/v2/product/extraction/ragDocuments/annotatedFields.js +57 -0
  213. package/src/v2/product/extraction/ragDocuments/annotatedListField.d.ts +24 -0
  214. package/src/v2/product/extraction/ragDocuments/annotatedListField.js +67 -0
  215. package/src/v2/product/extraction/ragDocuments/annotatedObjectField.d.ts +43 -0
  216. package/src/v2/product/extraction/ragDocuments/annotatedObjectField.js +47 -0
  217. package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.d.ts +15 -0
  218. package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.js +13 -0
  219. package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.d.ts +25 -0
  220. package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.js +17 -0
  221. package/src/v2/product/extraction/ragDocuments/fieldFactory.d.ts +12 -0
  222. package/src/v2/product/extraction/ragDocuments/fieldFactory.js +23 -0
  223. package/src/v2/product/extraction/ragDocuments/index.d.ts +7 -0
  224. package/src/v2/product/extraction/ragDocuments/index.js +7 -0
  225. package/src/v2/product/extraction/ragDocuments/params/index.d.ts +2 -0
  226. package/src/v2/product/extraction/ragDocuments/params/index.js +2 -0
  227. package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.d.ts +27 -0
  228. package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.js +43 -0
  229. package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.d.ts +7 -0
  230. package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.js +9 -0
  231. package/src/v2/product/extraction/ragDocuments/ragAnnotation.d.ts +12 -0
  232. package/src/v2/product/extraction/ragDocuments/ragAnnotation.js +9 -0
  233. package/src/v2/product/ocr/ocr.d.ts +1 -1
  234. package/src/v2/product/ocr/ocr.js +1 -1
  235. package/src/v2/product/ocr/ocrInference.d.ts +2 -2
  236. package/src/v2/product/ocr/ocrInference.js +2 -2
  237. package/src/v2/product/ocr/ocrResponse.d.ts +1 -1
  238. package/src/v2/product/ocr/ocrResponse.js +1 -1
  239. package/src/v2/product/ocr/params/ocrParameters.d.ts +1 -1
  240. package/src/v2/product/ocr/params/ocrParameters.js +1 -1
  241. package/src/v2/product/split/params/splitParameters.d.ts +1 -1
  242. package/src/v2/product/split/params/splitParameters.js +1 -1
  243. package/src/v2/product/split/split.d.ts +1 -1
  244. package/src/v2/product/split/split.js +1 -1
  245. package/src/v2/product/split/splitInference.d.ts +1 -1
  246. package/src/v2/product/split/splitInference.js +1 -1
  247. package/src/v2/product/split/splitRange.d.ts +1 -1
  248. package/src/v2/product/split/splitRange.js +2 -2
  249. package/src/v2/product/split/splitResponse.d.ts +1 -1
  250. package/src/v2/product/split/splitResponse.js +1 -1
  251. package/src/v2/product/split/splitResult.js +1 -1
  252. package/src/v2/search/baseSearch.d.ts +2 -2
  253. package/src/v2/search/models/modelSearch.d.ts +3 -3
  254. package/src/v2/search/models/modelSearch.js +3 -3
  255. package/src/v2/search/models/modelSearchParameters.d.ts +1 -1
  256. package/src/v2/search/models/modelSearchParameters.js +1 -1
  257. package/src/v2/search/models/modelSearchResponse.d.ts +2 -2
  258. package/src/v2/search/models/modelSearchResponse.js +2 -2
  259. package/src/v2/search/ragDocuments/ragDocumentSearch.d.ts +3 -3
  260. package/src/v2/search/ragDocuments/ragDocumentSearch.js +3 -3
  261. package/src/v2/search/ragDocuments/ragDocumentSearchParameters.d.ts +1 -1
  262. package/src/v2/search/ragDocuments/ragDocumentSearchParameters.js +1 -1
  263. package/src/v2/search/ragDocuments/ragDocumentSearchResponse.d.ts +2 -2
  264. package/src/v2/search/ragDocuments/ragDocumentSearchResponse.js +2 -2
@@ -1,11 +1,11 @@
1
1
  import { ApiSettings } from "./apiSettings.js";
2
2
  import { Dispatcher } from "undici";
3
- import { BaseProductParameters } from "../../v2/index.js";
4
- import { BaseSearchParameters } from "../../v2/clientOptions/baseSearchParameters.js";
5
- import { JobResponse } from "../../v2/parsing/index.js";
6
- import { InputSource } from "../../input/index.js";
7
- import { BaseProduct } from "../../v2/product/baseProduct.js";
8
- import { BaseSearch } from "../../v2/search/baseSearch.js";
3
+ import { BaseProductParameters } from "../index.js";
4
+ import { BaseSearchParameters, BaseAnnotationParameters, BaseRagDocumentUploadParameters } from "../clientOptions/index.js";
5
+ import { JobResponse } from "../parsing/index.js";
6
+ import { InputSource, LocalInputSource } from "../../input/index.js";
7
+ import { BaseProduct } from "../product/baseProduct.js";
8
+ import { BaseSearch } from "../search/baseSearch.js";
9
9
  /**
10
10
  * Mindee V2 API handler.
11
11
  */
@@ -57,4 +57,33 @@ export declare class MindeeApiV2 {
57
57
  * @returns a `Promise` containing the search response.
58
58
  */
59
59
  reqGetSearch<S extends typeof BaseSearch>(search: S, parameters: BaseSearchParameters): Promise<InstanceType<S["responseClass"]>>;
60
+ /**
61
+ * Get a document's info and annotations from the RAG database.
62
+ * @param product the product definition to use.
63
+ * @param documentId the document id to get.
64
+ * @returns a `Promise` containing an annotation response.
65
+ */
66
+ reqGetRagAnnotation<P extends typeof BaseProduct>(product: P, documentId: string): Promise<InstanceType<P["annotationResponseClass"]>>;
67
+ /**
68
+ * Add a document to the RAG database.
69
+ * @param product the product definition to use.
70
+ * @param parameters the parameters to use.
71
+ * @param inputSource the file to upload.
72
+ * @returns a `Promise` containing an annotation response.
73
+ */
74
+ reqPostRagDocument<P extends typeof BaseProduct>(product: P, parameters: BaseRagDocumentUploadParameters, inputSource: LocalInputSource): Promise<InstanceType<P["annotationResponseClass"]>>;
75
+ /**
76
+ * Update a document's annotations in the RAG database.
77
+ * @param product the product definition to use.
78
+ * @param parameters the parameters to use.
79
+ * @returns a `Promise` containing an annotation response.
80
+ */
81
+ reqPatchRagAnnotation<P extends typeof BaseProduct>(product: P, parameters: BaseAnnotationParameters): Promise<InstanceType<P["annotationResponseClass"]>>;
82
+ /**
83
+ * Deletes a document from the RAG database.
84
+ * @param product the product definition to use.
85
+ * @param documentId the document's ID.
86
+ * @returns true if the document was deleted successfully, false otherwise.
87
+ */
88
+ reqDeleteRagDocument<P extends typeof BaseProduct>(product: P, documentId: string): Promise<boolean>;
60
89
  }
@@ -6,7 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _MindeeApiV2_instances, _MindeeApiV2_paramsToFormData, _MindeeApiV2_processResponse;
7
7
  import { ApiSettings } from "./apiSettings.js";
8
8
  import { FormData } from "undici";
9
- import { ErrorResponse, JobResponse, } from "../../v2/parsing/index.js";
9
+ import { ErrorResponse, JobResponse, } from "../parsing/index.js";
10
10
  import { sendRequestAndReadResponse } from "../../http/apiCore.js";
11
11
  import { LocalInputSource } from "../../input/index.js";
12
12
  import { MindeeDeserializationError, MindeeError } from "../../errors/index.js";
@@ -34,12 +34,11 @@ export class MindeeApiV2 {
34
34
  else {
35
35
  form.set("url", inputSource.url);
36
36
  }
37
- const path = `/v2/products/${product.slug}/enqueue`;
38
37
  const options = {
39
38
  method: "POST",
40
39
  headers: this.settings.baseHeaders,
41
40
  hostname: this.settings.hostname,
42
- path: path,
41
+ path: `/v2/products/${product.slug}/enqueue`,
43
42
  body: form,
44
43
  timeoutSecs: this.settings.timeoutSecs,
45
44
  };
@@ -123,6 +122,83 @@ export class MindeeApiV2 {
123
122
  const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
124
123
  return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, search.responseClass);
125
124
  }
125
+ /**
126
+ * Get a document's info and annotations from the RAG database.
127
+ * @param product the product definition to use.
128
+ * @param documentId the document id to get.
129
+ * @returns a `Promise` containing an annotation response.
130
+ */
131
+ async reqGetRagAnnotation(product, documentId) {
132
+ const options = {
133
+ method: "GET",
134
+ headers: this.settings.baseHeaders,
135
+ hostname: this.settings.hostname,
136
+ path: `/v2/products/${product.slug}/rag-documents/${documentId}`,
137
+ timeoutSecs: this.settings.timeoutSecs,
138
+ };
139
+ const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
140
+ return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.annotationResponseClass);
141
+ }
142
+ /**
143
+ * Add a document to the RAG database.
144
+ * @param product the product definition to use.
145
+ * @param parameters the parameters to use.
146
+ * @param inputSource the file to upload.
147
+ * @returns a `Promise` containing an annotation response.
148
+ */
149
+ async reqPostRagDocument(product, parameters, inputSource) {
150
+ const form = __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_paramsToFormData).call(this, parameters.getRequestParameters());
151
+ form.set("file", new Blob([inputSource.fileObject]), inputSource.filename);
152
+ const options = {
153
+ method: "POST",
154
+ headers: this.settings.baseHeaders,
155
+ hostname: this.settings.hostname,
156
+ path: `/v2/products/${product.slug}/rag-documents`,
157
+ body: form,
158
+ timeoutSecs: this.settings.timeoutSecs,
159
+ };
160
+ const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
161
+ return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.annotationResponseClass);
162
+ }
163
+ /**
164
+ * Update a document's annotations in the RAG database.
165
+ * @param product the product definition to use.
166
+ * @param parameters the parameters to use.
167
+ * @returns a `Promise` containing an annotation response.
168
+ */
169
+ async reqPatchRagAnnotation(product, parameters) {
170
+ const options = {
171
+ method: "PATCH",
172
+ headers: {
173
+ ...this.settings.baseHeaders,
174
+ // eslint-disable-next-line @typescript-eslint/naming-convention
175
+ "Content-Type": "application/json",
176
+ },
177
+ hostname: this.settings.hostname,
178
+ path: `/v2/products/${product.slug}/rag-documents/${parameters.documentId}`,
179
+ body: JSON.stringify(parameters.getRequestParameters()),
180
+ timeoutSecs: this.settings.timeoutSecs,
181
+ };
182
+ const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
183
+ return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.annotationResponseClass);
184
+ }
185
+ /**
186
+ * Deletes a document from the RAG database.
187
+ * @param product the product definition to use.
188
+ * @param documentId the document's ID.
189
+ * @returns true if the document was deleted successfully, false otherwise.
190
+ */
191
+ async reqDeleteRagDocument(product, documentId) {
192
+ const options = {
193
+ method: "DELETE",
194
+ headers: this.settings.baseHeaders,
195
+ hostname: this.settings.hostname,
196
+ path: `/v2/products/${product.slug}/rag-documents/${documentId}`,
197
+ timeoutSecs: this.settings.timeoutSecs,
198
+ };
199
+ const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
200
+ return response.messageObj?.statusCode >= 200 && response.messageObj?.statusCode < 400;
201
+ }
126
202
  }
127
203
  _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_paramsToFormData = function _MindeeApiV2_paramsToFormData(params) {
128
204
  const form = new FormData();
@@ -133,15 +209,20 @@ _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_paramsToFormData = function
133
209
  }, _MindeeApiV2_processResponse = function _MindeeApiV2_processResponse(result, responseClass) {
134
210
  if (result.messageObj?.statusCode
135
211
  && (result.messageObj?.statusCode > 399 || result.messageObj?.statusCode < 200)) {
212
+ let errorResponse;
136
213
  if (result.data?.status !== null) {
137
- throw new MindeeHttpErrorV2(new ErrorResponse(result.data));
214
+ errorResponse = new ErrorResponse(result.data);
215
+ }
216
+ else {
217
+ errorResponse = new ErrorResponse({
218
+ status: result.messageObj?.statusCode ?? -1,
219
+ title: "Unknown Error",
220
+ detail: result.data?.detail ?? "The server returned an Unknown error.",
221
+ code: `${result.messageObj?.statusCode ?? -1}-000`,
222
+ });
138
223
  }
139
- throw new MindeeHttpErrorV2(new ErrorResponse({
140
- status: result.messageObj?.statusCode ?? -1,
141
- title: "Unknown Error",
142
- detail: result.data?.detail ?? "The server returned an Unknown error.",
143
- code: `${result.messageObj?.statusCode ?? -1}-000`,
144
- }));
224
+ logger.error(errorResponse.toString());
225
+ throw new MindeeHttpErrorV2(errorResponse);
145
226
  }
146
227
  try {
147
228
  return new responseClass(result.data);
package/src/v2/index.d.ts CHANGED
@@ -3,6 +3,6 @@ export * as parsing from "./parsing/index.js";
3
3
  export * as product from "./product/index.js";
4
4
  export * as search from "./search/index.js";
5
5
  export { Client } from "./client.js";
6
- export { JobResponse, ErrorResponse, LocalResponse, } from "./parsing/index.js";
6
+ export { JobResponse, ErrorResponse, LocalResponse, FailedInferenceResponse, } from "./parsing/index.js";
7
7
  export type { BaseProductParameters, TimerOptions } from "./clientOptions/index.js";
8
8
  export { PollingOptions } from "./clientOptions/index.js";
package/src/v2/index.js CHANGED
@@ -3,5 +3,5 @@ export * as parsing from "./parsing/index.js";
3
3
  export * as product from "./product/index.js";
4
4
  export * as search from "./search/index.js";
5
5
  export { Client } from "./client.js";
6
- export { JobResponse, ErrorResponse, LocalResponse, } from "./parsing/index.js";
6
+ export { JobResponse, ErrorResponse, LocalResponse, FailedInferenceResponse, } from "./parsing/index.js";
7
7
  export { PollingOptions } from "./clientOptions/index.js";
@@ -0,0 +1,28 @@
1
+ import { BaseResponse } from "./baseResponse.js";
2
+ import { StringDict } from "../../parsing/index.js";
3
+ /**
4
+ * Base class for all RAG document responses from the V2 API.
5
+ */
6
+ export declare class BaseRagAnnotationResponse extends BaseResponse {
7
+ /**
8
+ * Unique identifier of the RAG document.
9
+ */
10
+ id: string;
11
+ /**
12
+ * Original filename of the uploaded document.
13
+ */
14
+ filename: string;
15
+ /**
16
+ * Date and time of the document creation.
17
+ */
18
+ createdAt: Date;
19
+ /**
20
+ * Current status of the RAG document.
21
+ */
22
+ status: string;
23
+ constructor(serverResponse: StringDict);
24
+ }
25
+ /**
26
+ * Constructor signature for typed v2 response classes.
27
+ */
28
+ export type AnnotationResponseConstructor<T extends BaseRagAnnotationResponse> = new (serverResponse: StringDict) => T;
@@ -0,0 +1,14 @@
1
+ import { BaseResponse } from "./baseResponse.js";
2
+ import { parseDate } from "../../parsing/index.js";
3
+ /**
4
+ * Base class for all RAG document responses from the V2 API.
5
+ */
6
+ export class BaseRagAnnotationResponse extends BaseResponse {
7
+ constructor(serverResponse) {
8
+ super(serverResponse);
9
+ this.id = serverResponse["id"];
10
+ this.filename = serverResponse["filename"];
11
+ this.createdAt = parseDate(serverResponse["created_at"]);
12
+ this.status = serverResponse["status"];
13
+ }
14
+ }
@@ -1,5 +1,7 @@
1
1
  import { StringDict } from "../../parsing/stringDict.js";
2
- /** Base response contract for v2 product responses. */
2
+ /**
3
+ * Base response contract for v2 product responses.
4
+ */
3
5
  export declare abstract class BaseResponse {
4
6
  /**
5
7
  * Raw text representation of the API's response.
@@ -15,5 +17,7 @@ export declare abstract class BaseResponse {
15
17
  */
16
18
  getRawHttp(): StringDict;
17
19
  }
18
- /** Constructor signature for typed v2 response classes. */
20
+ /**
21
+ * Constructor signature for typed v2 response classes.
22
+ */
19
23
  export type ResponseConstructor<T extends BaseResponse> = new (serverResponse: StringDict) => T;
@@ -1,5 +1,7 @@
1
1
  import { logger } from "../../logger.js";
2
- /** Base response contract for v2 product responses. */
2
+ /**
3
+ * Base response contract for v2 product responses.
4
+ */
3
5
  export class BaseResponse {
4
6
  /**
5
7
  * @param serverResponse JSON response from the server.
@@ -6,7 +6,7 @@ export declare class ErrorItem {
6
6
  /**
7
7
  * A JSON Pointer to the location of the body property.
8
8
  */
9
- pointer?: string;
9
+ pointer: string;
10
10
  /**
11
11
  * Explicit information on the issue.
12
12
  */
@@ -6,9 +6,7 @@ export class ErrorItem {
6
6
  * @param serverResponse JSON response from the server.
7
7
  */
8
8
  constructor(serverResponse) {
9
- if (serverResponse["pointer"] !== undefined) {
10
- this.pointer = serverResponse["pointer"];
11
- }
9
+ this.pointer = serverResponse["pointer"];
12
10
  this.detail = serverResponse["detail"];
13
11
  }
14
12
  }
@@ -1,7 +1,7 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { ErrorItem } from "./errorItem.js";
3
3
  import { ErrorDetails } from "./errorDetails.js";
4
- import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
4
+ import { BaseResponse } from "../baseResponse.js";
5
5
  /**
6
6
  * Error response detailing a problem. The format adheres to RFC 9457.
7
7
  */
@@ -15,4 +15,8 @@ export declare class ErrorResponse extends BaseResponse implements ErrorDetails
15
15
  * @param serverResponse JSON response from the server.
16
16
  */
17
17
  constructor(serverResponse: StringDict);
18
+ /**
19
+ * To make the error prettier to display.
20
+ */
21
+ toString(): string;
18
22
  }
@@ -1,5 +1,5 @@
1
1
  import { ErrorItem } from "./errorItem.js";
2
- import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
2
+ import { BaseResponse } from "../baseResponse.js";
3
3
  /**
4
4
  * Error response detailing a problem. The format adheres to RFC 9457.
5
5
  */
@@ -20,4 +20,30 @@ export class ErrorResponse extends BaseResponse {
20
20
  this.errors = [];
21
21
  }
22
22
  }
23
+ /**
24
+ * To make the error prettier to display.
25
+ */
26
+ toString() {
27
+ const result = [];
28
+ result.push("Error Details");
29
+ result.push("=============");
30
+ result.push(`:HTTP Status: ${this.status}`);
31
+ result.push(`:Title: ${this.title}`);
32
+ result.push(`:Code: ${this.code}`);
33
+ result.push(`:Detail: ${this.detail}`);
34
+ if (this.errors && this.errors.length > 0) {
35
+ result.push("");
36
+ result.push("Error Items");
37
+ result.push("-----------");
38
+ this.errors.forEach((error, i) => {
39
+ result.push(`**Error ${i + 1}:**`);
40
+ result.push(` :Pointer: ${error.pointer}`);
41
+ result.push(` :Detail: ${error.detail}`);
42
+ if (i < this.errors.length - 1) {
43
+ result.push("");
44
+ }
45
+ });
46
+ }
47
+ return result.join("\n") + "\n";
48
+ }
23
49
  }
@@ -1,8 +1,10 @@
1
1
  export { ErrorResponse, ErrorItem, } from "./error/index.js";
2
2
  export type { ErrorDetails } from "./error/index.js";
3
3
  export { Job, JobResponse, JobWebhook, } from "./job/index.js";
4
- export { BaseInference, InferenceFile, InferenceModel, } from "./inference/index.js";
4
+ export { BaseInference, InferenceFile, InferenceModel, FailedInferenceResponse, } from "./inference/index.js";
5
5
  export { LocalResponse } from "./localResponse.js";
6
6
  export { BaseResponse } from "./baseResponse.js";
7
7
  export type { ResponseConstructor } from "./baseResponse.js";
8
+ export { BaseRagAnnotationResponse } from "./baseRagAnnotationResponse.js";
9
+ export type { AnnotationResponseConstructor } from "./baseRagAnnotationResponse.js";
8
10
  export * as field from "./inference/field/index.js";
@@ -1,6 +1,7 @@
1
1
  export { ErrorResponse, ErrorItem, } from "./error/index.js";
2
2
  export { Job, JobResponse, JobWebhook, } from "./job/index.js";
3
- export { BaseInference, InferenceFile, InferenceModel, } from "./inference/index.js";
3
+ export { BaseInference, InferenceFile, InferenceModel, FailedInferenceResponse, } from "./inference/index.js";
4
4
  export { LocalResponse } from "./localResponse.js";
5
5
  export { BaseResponse } from "./baseResponse.js";
6
+ export { BaseRagAnnotationResponse } from "./baseRagAnnotationResponse.js";
6
7
  export * as field from "./inference/field/index.js";
@@ -1,6 +1,6 @@
1
1
  import { StringDict } from "../../../parsing/index.js";
2
- import { ErrorResponse } from "../../../v2/index.js";
3
- import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
2
+ import { ErrorResponse } from "../../index.js";
3
+ import { BaseResponse } from "../baseResponse.js";
4
4
  /**
5
5
  * Webhook payload returned when an inference fails before producing a result.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { parseDate } from "../../../parsing/index.js";
2
- import { ErrorResponse } from "../../../v2/index.js";
3
- import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
2
+ import { ErrorResponse } from "../../index.js";
3
+ import { BaseResponse } from "../baseResponse.js";
4
4
  /**
5
5
  * Webhook payload returned when an inference fails before producing a result.
6
6
  */
@@ -7,11 +7,17 @@ export declare class InferenceFields extends Map<string, SimpleField | ObjectFie
7
7
  /** Indentation level used when rendering text output. */
8
8
  protected _indentLevel: number;
9
9
  constructor(serverResponse: StringDict, indentLevel?: number);
10
- /** Returns a field as a `SimpleField`, or throws if the type mismatches. */
10
+ /**
11
+ * Returns a field as a `SimpleField`, or throws if the type mismatches.
12
+ */
11
13
  getSimpleField(fieldName: string): SimpleField;
12
- /** Returns a field as an `ObjectField`, or throws if the type mismatches. */
14
+ /**
15
+ * Returns a field as an `ObjectField`, or throws if the type mismatches.
16
+ */
13
17
  getObjectField(fieldName: string): ObjectField;
14
- /** Returns a field as a `ListField`, or throws if the type mismatches. */
18
+ /**
19
+ * Returns a field as a `ListField`, or throws if the type mismatches.
20
+ */
15
21
  getListField(fieldName: string): ListField;
16
22
  toString(indent?: number): string;
17
23
  }
@@ -7,7 +7,9 @@ export class InferenceFields extends Map {
7
7
  }));
8
8
  this._indentLevel = indentLevel;
9
9
  }
10
- /** Returns a field as a `SimpleField`, or throws if the type mismatches. */
10
+ /**
11
+ * Returns a field as a `SimpleField`, or throws if the type mismatches.
12
+ */
11
13
  getSimpleField(fieldName) {
12
14
  const field = this.get(fieldName);
13
15
  if (field === undefined) {
@@ -18,7 +20,9 @@ export class InferenceFields extends Map {
18
20
  }
19
21
  return field;
20
22
  }
21
- /** Returns a field as an `ObjectField`, or throws if the type mismatches. */
23
+ /**
24
+ * Returns a field as an `ObjectField`, or throws if the type mismatches.
25
+ */
22
26
  getObjectField(fieldName) {
23
27
  const field = this.get(fieldName);
24
28
  if (field === undefined) {
@@ -29,7 +33,9 @@ export class InferenceFields extends Map {
29
33
  }
30
34
  return field;
31
35
  }
32
- /** Returns a field as a `ListField`, or throws if the type mismatches. */
36
+ /**
37
+ * Returns a field as a `ListField`, or throws if the type mismatches.
38
+ */
33
39
  getListField(fieldName) {
34
40
  const field = this.get(fieldName);
35
41
  if (field === undefined) {
@@ -7,6 +7,7 @@ import type { ListField } from "./listField.js";
7
7
  export declare class ObjectField extends BaseField {
8
8
  /** Nested fields carried by this object. */
9
9
  readonly fields: InferenceFields;
10
+ constructor(serverResponse: StringDict, indentLevel?: number);
10
11
  /**
11
12
  * Retrieves the simple sub-fields in the object.
12
13
  *
@@ -29,29 +30,32 @@ export declare class ObjectField extends BaseField {
29
30
  * Retrieves a SimpleField by its name if it exists and is of the correct type.
30
31
  *
31
32
  * @param {string} fieldName - The name of the field to retrieve.
32
- * @return {SimpleField} The SimpleField instance if it exists and is valid, or undefined if not.
33
- * @throws {Error} If the field does not exist or is not of type SimpleField.
33
+ * @return {SimpleField} The field instance if it exists and is valid, or undefined if not.
34
+ * @throws {Error} If the field does not exist or is of wrong type.
34
35
  */
35
36
  getSimpleField(fieldName: string): SimpleField;
36
37
  /**
37
38
  * Retrieves a ListField by its name if it exists and is of the correct type.
38
39
  *
39
40
  * @param {string} fieldName - The name of the field to retrieve.
40
- * @return {ListField} The ListField instance if it exists and is valid, or undefined if not.
41
- * @throws {Error} If the field does not exist or is not of type ListField.
41
+ * @return {ListField} The field instance if it exists and is valid, or undefined if not.
42
+ * @throws {Error} If the field does not exist or is of wrong type.
42
43
  */
43
44
  getListField(fieldName: string): ListField;
44
45
  /**
45
46
  * Retrieves an ObjectField by its name if it exists and is of the correct type.
46
47
  *
47
48
  * @param {string} fieldName - The name of the field to retrieve.
48
- * @return {ObjectField} The ObjectField instance if it exists and is valid, or undefined if not.
49
- * @throws {Error} If the field does not exist or is not of type ObjectField.
49
+ * @return {ObjectField} The field instance if it exists and is valid, or undefined if not.
50
+ * @throws {Error} If the field does not exist or is of wrong type.
50
51
  */
51
52
  getObjectField(fieldName: string): ObjectField;
52
- constructor(serverResponse: StringDict, indentLevel?: number);
53
- /** Returns a readable representation of nested fields. */
53
+ /**
54
+ * Returns a readable representation of nested fields.
55
+ */
54
56
  toString(): string;
55
- /** Returns a compact representation suitable for list items. */
57
+ /**
58
+ * Returns a compact representation suitable for list items.
59
+ */
56
60
  toStringFromList(): string;
57
61
  }
@@ -2,6 +2,10 @@ import { InferenceFields } from "./inferenceFields.js";
2
2
  import { BaseField } from "./baseField.js";
3
3
  /** Object-valued inference field. */
4
4
  export class ObjectField extends BaseField {
5
+ constructor(serverResponse, indentLevel = 0) {
6
+ super(serverResponse, indentLevel);
7
+ this.fields = new InferenceFields(serverResponse["fields"], this._indentLevel + 1);
8
+ }
5
9
  /**
6
10
  * Retrieves the simple sub-fields in the object.
7
11
  *
@@ -48,59 +52,41 @@ export class ObjectField extends BaseField {
48
52
  * Retrieves a SimpleField by its name if it exists and is of the correct type.
49
53
  *
50
54
  * @param {string} fieldName - The name of the field to retrieve.
51
- * @return {SimpleField} The SimpleField instance if it exists and is valid, or undefined if not.
52
- * @throws {Error} If the field does not exist or is not of type SimpleField.
55
+ * @return {SimpleField} The field instance if it exists and is valid, or undefined if not.
56
+ * @throws {Error} If the field does not exist or is of wrong type.
53
57
  */
54
58
  getSimpleField(fieldName) {
55
- if (!this.fields.has(fieldName) && !this.simpleFields.has(fieldName)) {
56
- throw new Error(`The field '${fieldName}' was not found.`);
57
- }
58
- if (this.fields.get(fieldName)?.constructor.name !== "SimpleField") {
59
- throw new Error(`The field '${fieldName}' is not a SimpleField.`);
60
- }
61
- return this.simpleFields.get(fieldName);
59
+ return this.fields.getSimpleField(fieldName);
62
60
  }
63
61
  /**
64
62
  * Retrieves a ListField by its name if it exists and is of the correct type.
65
63
  *
66
64
  * @param {string} fieldName - The name of the field to retrieve.
67
- * @return {ListField} The ListField instance if it exists and is valid, or undefined if not.
68
- * @throws {Error} If the field does not exist or is not of type ListField.
65
+ * @return {ListField} The field instance if it exists and is valid, or undefined if not.
66
+ * @throws {Error} If the field does not exist or is of wrong type.
69
67
  */
70
68
  getListField(fieldName) {
71
- if (!this.fields.has(fieldName) || !this.listFields.has(fieldName)) {
72
- throw new Error(`The field '${fieldName}' was not found.`);
73
- }
74
- if (this.fields.get(fieldName)?.constructor.name !== "ListField") {
75
- throw new Error(`The field '${fieldName}' is not a ListField.`);
76
- }
77
- return this.listFields.get(fieldName);
69
+ return this.fields.getListField(fieldName);
78
70
  }
79
71
  /**
80
72
  * Retrieves an ObjectField by its name if it exists and is of the correct type.
81
73
  *
82
74
  * @param {string} fieldName - The name of the field to retrieve.
83
- * @return {ObjectField} The ObjectField instance if it exists and is valid, or undefined if not.
84
- * @throws {Error} If the field does not exist or is not of type ObjectField.
75
+ * @return {ObjectField} The field instance if it exists and is valid, or undefined if not.
76
+ * @throws {Error} If the field does not exist or is of wrong type.
85
77
  */
86
78
  getObjectField(fieldName) {
87
- if (!this.fields.has(fieldName) && !this.objectFields.has(fieldName)) {
88
- throw new Error(`The field '${fieldName}' was not found.`);
89
- }
90
- if (this.fields.get(fieldName)?.constructor.name !== "ObjectField") {
91
- throw new Error(`The field '${fieldName}' is not an ObjectField.`);
92
- }
93
- return this.objectFields.get(fieldName);
94
- }
95
- constructor(serverResponse, indentLevel = 0) {
96
- super(serverResponse, indentLevel);
97
- this.fields = new InferenceFields(serverResponse["fields"], this._indentLevel + 1);
79
+ return this.fields.getObjectField(fieldName);
98
80
  }
99
- /** Returns a readable representation of nested fields. */
81
+ /**
82
+ * Returns a readable representation of nested fields.
83
+ */
100
84
  toString() {
101
85
  return "\n" + (this.fields ? this.fields.toString(1) : "");
102
86
  }
103
- /** Returns a compact representation suitable for list items. */
87
+ /**
88
+ * Returns a compact representation suitable for list items.
89
+ */
104
90
  toStringFromList() {
105
91
  return this.fields ? this.fields.toString(2).substring(4) : "";
106
92
  }
@@ -1,4 +1,5 @@
1
1
  export { BaseInference } from "./baseInference.js";
2
2
  export { InferenceFile } from "./inferenceFile.js";
3
3
  export { InferenceModel } from "./inferenceModel.js";
4
+ export { FailedInferenceResponse } from "./failedInferenceResponse.js";
4
5
  export * as field from "./field/index.js";
@@ -1,4 +1,5 @@
1
1
  export { BaseInference } from "./baseInference.js";
2
2
  export { InferenceFile } from "./inferenceFile.js";
3
3
  export { InferenceModel } from "./inferenceModel.js";
4
+ export { FailedInferenceResponse } from "./failedInferenceResponse.js";
4
5
  export * as field from "./field/index.js";