Skip to content

Commit 689e750

Browse files
committed
chore: address pr comments, add notes
1 parent 0424a62 commit 689e750

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/backend/src/apps/aisay/common/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export const DOCUMENT_TYPES = [
88

99
export const DEFAULT_GENERALISED_MODEL_TYPE = 'standard'
1010
export const GENERALISED_MODEL_OPTIONS = [
11-
{ label: 'Standard', value: DEFAULT_GENERALISED_MODEL_TYPE },
12-
{ label: 'Vision', value: 'DOC_EXTRACTION_V2' },
11+
{ label: 'Standard', value: DEFAULT_GENERALISED_MODEL_TYPE }, // LLM
12+
{ label: 'Vision', value: 'DOC_EXTRACTION_V2' }, // VLM
1313
]

packages/backend/src/apps/aisay/common/schema.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,23 @@ export const generalisedModelSchema = z.object({
4040
})
4141
return result
4242
}),
43+
/**
44+
* NOTE: the custom model type is indicated by the 'additonal_features' field in the request body
45+
* 1. this function returns null when using the standard model as it is not required by default.
46+
* 2. it is only included when using the vision generalised model.
47+
* API doc: https://app.swaggerhub.com/apis-docs/DAMIENSKTWORK/bgp-aisay_document_extraction_api/1.0.11#/DocumentParserRequestS3GenericV2
48+
*/
4349
modelType: z
4450
.string()
4551
.optional()
4652
.transform((value) => {
47-
if (!value) {
53+
if (!value || value === DEFAULT_GENERALISED_MODEL_TYPE) {
4854
return null
4955
}
5056

5157
const allowedValues = GENERALISED_MODEL_OPTIONS.map(
5258
(option) => option.value,
53-
).filter((value) => value !== DEFAULT_GENERALISED_MODEL_TYPE)
59+
)
5460

5561
if (!allowedValues.includes(value)) {
5662
return null

0 commit comments

Comments
 (0)