What the documents look like
Permit handling happens before declaration and determines whether goods may legally cross the border, so the accuracy of document parsing and chunking at this stage feeds directly into later customs clearance. The main data sources are the commerce authority system, customs commodity codes, supplier materials and customer end-use statements. The documents handled day to day are automatic import licences, dual-use item licences, contracts and product descriptions.
These materials differ widely in length. A licence carries a certificate number and regulatory conditions; a contract carries parties and subject matter; a product description carries end use and technical parameters. Updates are irregular and per shipment. After source material changes, the actual training and index state has to be re-checked, and a successful upload cannot be treated as proof that retrieval has been refreshed. The most time-consuming steps are judging the regulatory certificate, preparing the end-use statement and following the approval status, and each of these depends on preserving the structure and conditions of the source text intact.
Constraints at the document chunking step
Parsing first checks the source structure and keeps a document identity and version that can point back to the original. Segmentation follows the structure of the specific material, and a condition, its explanation and the content it constrains cannot be split apart. Original data and retrieval indexes are distinct: one group of original data may correspond to several indexes, and one group of data may correspond to several vectors. During retrieval, vectors are recalled first, then the vector ID is used to locate the original data in MongoDB; records that map to the same group of original data are merged, and the highest vector score is taken.
Semantic retrieval depends on vector distance, full-text retrieval depends on keyword hits, and hybrid retrieval merges the two result sets through RRF. RRF is a fusion process, not a switch that can be turned on. The minimum relevance value takes effect only under semantic retrieval or when result reranking is used; it is a filter threshold, not a sorting rule. The reference limit is controlled by tokens rather than by top k. Question optimisation adds one model call before retrieval for coreference resolution and question expansion, which improves multi-turn retrieval and adds latency. Image retrieval requires image input and the corresponding model capability, and reranking requires a model and is enabled by configuration; neither runs on every request.
A retrieval result or a value collected by a form does not constitute authorisation. Business verification, approval, database writes and external synchronisation each need their own downstream implementation. Libraries built on different vector models cannot be associated together; the identifiers are checked and non-matching libraries are excluded.
Configuration and implementation checks
The following rows list documented settings or implementation checks relevant to this feature and the product-material and selection question task, around one hypothetical drill sample.
Hypothetical drill sample: a trade compliance role prepares one automatic import licence record. The source text reads: "Licence number: AUTO-2024-0731; commodity name: CNC machine tool; regulatory condition: automatic import licence required; licence holder: a machinery import and export company; valid until 31 December 2024." A draft sentence awaits judgement: "This licence already covers the current CNC machine tool import and can be used directly before declaration." The sample is marked as a hypothetical drill and does not point to a real entity or certificate.
| Configuration item | Documented basis | Value in this sample and reason |
|---|---|---|
| Search mode | Semantic, full-text and hybrid retrieval are documented | Hybrid retrieval, because certificate numbers and natural-language questions appear together |
| Reference limit | Controlled by tokens, not top k | Hypothetical starting point of 3000 tokens, because licence and contract excerpts are long; compared against the default value before adjustment |
| Minimum relevance | A 0-1 value, effective only under semantic retrieval or reranking | Hypothetical starting point of 0.4, compared against observed retrieval results |
| Result reranking | ReRank produces a 0-1 score that can be used for filtering | Enabled, for secondary sorting when candidates are numerous |
| Question optimisation | Coreference resolution and question expansion before retrieval | Enabled, because the sample may involve multi-turn follow-up |
| Data and index check | Original data and indexes are distinct; one group may hold several indexes | After each shipment's material changes, the training and index state is checked |
Three common errors
- Treating a successful upload as refreshed retrieval. The input is the upload action for the sample licence; the comparison object is the actual training and index state; the observable result is whether retrieval can hit that certificate number. Upload success and index effectiveness are two separate matters.
- Treating minimum relevance as a permission or entity filter. The input is the minimum relevance setting; the comparison object is whether returned content belongs to the target certificate; the observable result is whether unrelated certificates are excluded. A similarity setting does not perform authorisation or entity isolation.
- Treating a pending review state as granted authorisation. The input is the sample draft sentence "can be used directly before declaration"; the comparison object is whether the source text states an authorisation or effective-use clause; the observable result is that the source text does not state this content. A pending review does not prove that permission is absent, and it does not equal approval.
How to verify the setup
- Input the sample licence source text and the draft sentence, compare whether the source text contains the authorisation wording "can be used directly before declaration", and observe that the source text states only the number, commodity, regulatory condition, holder and validity period, with no such authorisation. The condition is met when the draft sentence is marked as unsupported.
- Input the certificate number "AUTO-2024-0731" for full-text retrieval, compare whether the returned passage keeps the number and the regulatory condition in the same segment, and observe that the number and condition are not split apart. The condition is met when the segment can point back to the source text.
- Input the paper input [] for an empty result, compare how the downstream design handles an empty reference, and observe that the system outputs according to the empty reference. The condition is met when an empty result is not interpreted as the certificate not existing. All three are paper checks and do not claim that testing has been performed.