@@ -13,26 +13,26 @@ import {
1313 RagMetadata ,
1414 RawText ,
1515} from "@/v2/parsing/index.js" ;
16- import { V2_RESOURCE_PATH } from "../../index.js" ;
16+ import { V2_PRODUCT_PATH } from "../../index.js" ;
1717import { ExtractionResponse } from "@/v2/product/index.js" ;
1818
19- const findocPath = path . join ( V2_RESOURCE_PATH , "products " , "financial_document" ) ;
20- const inferencePath = path . join ( V2_RESOURCE_PATH , "inference " ) ;
21- const deepNestedFieldPath = path . join ( inferencePath , "deep_nested_fields.json" ) ;
22- const standardFieldPath = path . join ( inferencePath , "standard_field_types.json" ) ;
23- const standardFieldRstPath = path . join ( inferencePath , "standard_field_types.rst" ) ;
19+ const findocPath = path . join ( V2_PRODUCT_PATH , "extraction " , "financial_document" ) ;
20+ const extractionPath = path . join ( V2_PRODUCT_PATH , "extraction " ) ;
21+ const deepNestedFieldPath = path . join ( extractionPath , "deep_nested_fields.json" ) ;
22+ const standardFieldPath = path . join ( extractionPath , "standard_field_types.json" ) ;
23+ const standardFieldRstPath = path . join ( extractionPath , "standard_field_types.rst" ) ;
2424const locationFieldPath = path . join ( findocPath , "complete_with_coordinates.json" ) ;
2525
26- async function loadV2Inference ( resourcePath : string ) : Promise < ExtractionResponse > {
26+ async function loadV2Extraction ( resourcePath : string ) : Promise < ExtractionResponse > {
2727 const localResponse = new LocalResponse ( resourcePath ) ;
2828 await localResponse . init ( ) ;
2929 return localResponse . deserializeResponse ( ExtractionResponse ) ;
3030}
3131
32- describe ( "MindeeV2 - Inference Response" , async ( ) => {
32+ describe ( "MindeeV2 - Extraction Response" , async ( ) => {
3333 describe ( "Financial Document" , async ( ) => {
3434 it ( "should load a blank inference with valid properties" , async ( ) => {
35- const response = await loadV2Inference (
35+ const response = await loadV2Extraction (
3636 path . join ( findocPath , "blank.json" )
3737 ) ;
3838 const fields = response . inference . result . fields ;
@@ -64,7 +64,7 @@ describe("MindeeV2 - Inference Response", async () => {
6464 } ) ;
6565
6666 it ( "should load a complete inference with valid properties" , async ( ) => {
67- const response = await loadV2Inference (
67+ const response = await loadV2Extraction (
6868 path . join ( findocPath , "complete.json" )
6969 ) ;
7070 const inference = response . inference ;
@@ -129,7 +129,7 @@ describe("MindeeV2 - Inference Response", async () => {
129129
130130 describe ( "Deeply Nested" , async ( ) => {
131131 it ( "should load a deep nested object" , async ( ) => {
132- const response = await loadV2Inference ( deepNestedFieldPath ) ;
132+ const response = await loadV2Extraction ( deepNestedFieldPath ) ;
133133 const fields = response . inference . result . fields ;
134134 expect ( fields . get ( "field_simple" ) ) . to . be . an . instanceof ( SimpleField ) ;
135135 expect ( fields . get ( "field_object" ) ) . to . be . an . instanceof ( ObjectField ) ;
@@ -165,7 +165,7 @@ describe("MindeeV2 - Inference Response", async () => {
165165
166166 describe ( "Standard Field Types" , async ( ) => {
167167 it ( "should recognize simple fields" , async ( ) => {
168- const response = await loadV2Inference ( standardFieldPath ) ;
168+ const response = await loadV2Extraction ( standardFieldPath ) ;
169169 const fields = response . inference . result . fields ;
170170
171171 expect ( fields . get ( "field_simple_string" ) ) . to . be . instanceOf ( SimpleField ) ;
@@ -211,7 +211,7 @@ describe("MindeeV2 - Inference Response", async () => {
211211 } ) ;
212212
213213 it ( "should recognize simple list fields" , async ( ) => {
214- const response = await loadV2Inference ( standardFieldPath ) ;
214+ const response = await loadV2Extraction ( standardFieldPath ) ;
215215 const fields = response . inference . result . fields ;
216216
217217 expect ( fields . get ( "field_simple_list" ) ) . to . be . instanceOf ( ListField ) ;
@@ -226,7 +226,7 @@ describe("MindeeV2 - Inference Response", async () => {
226226 } ) ;
227227
228228 it ( "should recognize object fields" , async ( ) => {
229- const response = await loadV2Inference ( standardFieldPath ) ;
229+ const response = await loadV2Extraction ( standardFieldPath ) ;
230230 const fields = response . inference . result . fields ;
231231
232232 expect ( fields . get ( "field_object" ) ) . to . be . instanceOf ( ObjectField ) ;
@@ -246,7 +246,7 @@ describe("MindeeV2 - Inference Response", async () => {
246246 } ) ;
247247
248248 it ( "should recognize object list fields" , async ( ) => {
249- const response = await loadV2Inference ( standardFieldPath ) ;
249+ const response = await loadV2Extraction ( standardFieldPath ) ;
250250 const fields = response . inference . result . fields ;
251251
252252 expect ( fields . get ( "field_object_list" ) ) . to . be . instanceOf ( ListField ) ;
@@ -272,8 +272,8 @@ describe("MindeeV2 - Inference Response", async () => {
272272
273273 describe ( "Raw Text" , async ( ) => {
274274 it ( "raw text should be exposed" , async ( ) => {
275- const response = await loadV2Inference (
276- path . join ( inferencePath , "raw_texts.json" )
275+ const response = await loadV2Extraction (
276+ path . join ( extractionPath , "raw_texts.json" )
277277 ) ;
278278 expect ( response . inference . result . rag ) . to . be . undefined ;
279279
@@ -291,17 +291,17 @@ describe("MindeeV2 - Inference Response", async () => {
291291
292292 describe ( "RAG Metadata" , async ( ) => {
293293 it ( "RAG metadata when matched" , async ( ) => {
294- const response = await loadV2Inference (
295- path . join ( inferencePath , "rag_matched.json" )
294+ const response = await loadV2Extraction (
295+ path . join ( extractionPath , "rag_matched.json" )
296296 ) ;
297297 const rag = response . inference . result . rag ;
298298 expect ( rag ) . to . be . instanceOf ( RagMetadata ) ;
299299 expect ( rag ?. retrievedDocumentId ) . to . eq ( "12345abc-1234-1234-1234-123456789abc" ) ;
300300 } ) ;
301301
302302 it ( "RAG metadata when not matched" , async ( ) => {
303- const response = await loadV2Inference (
304- path . join ( inferencePath , "rag_not_matched.json" )
303+ const response = await loadV2Extraction (
304+ path . join ( extractionPath , "rag_not_matched.json" )
305305 ) ;
306306 const rag = response . inference . result . rag ;
307307 expect ( rag ) . to . be . instanceOf ( RagMetadata ) ;
@@ -311,7 +311,7 @@ describe("MindeeV2 - Inference Response", async () => {
311311
312312 describe ( "RST Display" , async ( ) => {
313313 it ( "to be properly exposed" , async ( ) => {
314- const response = await loadV2Inference ( standardFieldPath ) ;
314+ const response = await loadV2Extraction ( standardFieldPath ) ;
315315 const rstString = await fs . readFile ( standardFieldRstPath , "utf8" ) ;
316316
317317 expect ( response . inference ) . to . not . be . null ;
@@ -321,7 +321,7 @@ describe("MindeeV2 - Inference Response", async () => {
321321
322322 describe ( "Field Locations and Confidence" , async ( ) => {
323323 it ( "to be properly exposed" , async ( ) => {
324- const response = await loadV2Inference ( locationFieldPath ) ;
324+ const response = await loadV2Extraction ( locationFieldPath ) ;
325325
326326 expect ( response . inference ) . to . not . be . null ;
327327
0 commit comments