feat(llm-batch): add LlmBatchModel type for batch-supported models - #2177
feat(llm-batch): add LlmBatchModel type for batch-supported models#2177InjunPark-sap wants to merge 5 commits into
Conversation
|
👋 Hi — I'm PR Bot, your SAP code review assistant. I'll automatically review your pull requests for code quality, security, and SAP compliance. Get an overview of what I do → What I do
Key commands
Configure me for your teamCreate {
"$schema": "https://devops-insights-pr-bot.cfapps.eu10-004.hana.ondemand.com/schema/pull_request_bot.json",
"features": {
"control_panel": false,
"summarize": {
"auto_generate_summary": true,
"auto_insert_summary": true,
"auto_run_on_draft_pr": true,
"use_custom_summarize_prompt": false,
"use_custom_summarize_output_template": false,
"excluded_paths": [],
"auto_exclude_authors": []
},
"review": {
"auto_generate_review": true,
"auto_run_on_draft_pr": false,
"use_custom_review_focus": false,
"excluded_paths": [],
"auto_exclude_authors": []
},
"sonar_fix": {
"enable": true,
"excluded_rules": []
},
"pipeline_fix": {
"enable": true
}
},
"excluded_paths": []
}
|
SummaryThe following content is AI-generated and provides a summary of the pull request: New Feature: Add
|
| "make-llm-batch-experimental": "node ../../scripts/postgenerate-llm-batch.ts ./src/client/batch-service/batches-api.ts", | ||
| "patch-batch-model-type": "node ../../scripts/postgenerate-llm-batch.ts ./src/client/batch-service/schema/batch-create-request.ts", |
There was a problem hiding this comment.
[pp] Please handle these as a single invocation of postgenerate-llm-batch.ts
| // Header/title rows vary, so filter by model-name shape instead of a fixed | ||
| // slice offset: keep only cells that look like a model id (lowercase, | ||
| // digits, dots, dashes). This rejects header labels like "Model"/"Region". | ||
| const isModelName = s => /^[a-z0-9][a-z0-9.-]*$/.test(s); |
There was a problem hiding this comment.
[q] Other row extractions do not have this, is this necessary?
| // Header/title rows vary, so filter by model-name shape instead of a fixed | |
| // slice offset: keep only cells that look like a model id (lowercase, | |
| // digits, dots, dashes). This rejects header labels like "Model"/"Region". | |
| const isModelName = s => /^[a-z0-9][a-z0-9.-]*$/.test(s); |
| // Identified by a "region" column with no "orchestration" and no | ||
| // "suggested replacement" column (distinguishes it from active/retired tables). | ||
|
|
||
| function findBatchTable() { |
There was a problem hiding this comment.
[pp] I assume this works but it might be easier to look for the first table past a <strong>/<b>/<hN> Batch Consumption string.
| batchCurrent.size !== batchNew.size || | ||
| [...batchNew].some(m => !batchCurrent.has(m)); |
There was a problem hiding this comment.
[pp]
| batchCurrent.size !== batchNew.size || | |
| [...batchNew].some(m => !batchCurrent.has(m)); | |
| batchCurrent.symmetricDifference(batchNew).size > 0; |
|
|
||
| const SAP_MODELS_PATH = resolve(import.meta.dirname, 'sap-models.json'); | ||
|
|
||
| const SAP_BATCH_MODELS_PATH = resolve(import.meta.dirname, 'sap-batch-models.json'); |
There was a problem hiding this comment.
[pp] I would prefer adding the new information to SAP_MODELS_PATH as part of an extra key in the main file.
| if (batchChanged) { | ||
| bumps.push("'@sap-ai-sdk/llm-batch': minor"); | ||
| } |
There was a problem hiding this comment.
As we don't bump extra packages when bumping other model types, I would also avoid doing that here.
| batchCurrent.size !== batchNew.size || | ||
| [...batchNew].some(m => !batchCurrent.has(m)); | ||
|
|
||
| const allAdded = Object.entries(typeToActiveModels).flatMap(([typeName, activeModels]) => { |
There was a problem hiding this comment.
[req] Please add changeset lines for changes (additions/removals) to the batch model list.
Context
Closes SAP/ai-sdk-js-backlog#609.
What this PR does and why it is needed
Adds a
LlmBatchModeltype soBatchCreateRequest.spec.modelis typed instead of plainstring, giving IDE autocomplete for batch-supported models while staying backward compatible (any string is still accepted viaLiteralUnion).LlmBatchModelin@sap-ai-sdk/core, re-exported from@sap-ai-sdk/llm-batch.BatchCreateRequest.spec.modeltoLlmBatchModelvia the postgenerate step (generated file is never hand-edited; anchor miss hard-fails).scripts/sap-batch-models.jsonas the ground-truth batch model list (6 models from the LLM batch service config; the SAP Notes list is intentionally incomplete).update-modelsskill + scraper to sync the SAP Notes batch section non-destructively (never shrinks the ground-truth file; auto-bumps thellm-batchchangeset).Definition of Done