Skip to content

Commit 96445f9

Browse files
[Search] Fix: prevent hidden provider fields from being sent in request payload (elastic#264462)
## Summary Fields hidden via `INTERNAL_OVERRIDE_FIELDS` were still being written into the form state as null during task type selection, causing them to be included in the API request. This has been fixed by skipping any field not present in the filtered schema during form state sync. This PR also hides `max_input_tokens` for the Mistral provider, which does not support this configuration and was rejecting requests that included it. <img width="700" alt="Screenshot 2026-04-20 at 16 42 26" src="https://github.com/user-attachments/assets/d60b3686-9ab2-4c13-84a9-2a4f37a75943" /> ### Testing - Start Kibana and navigate to the `External Inference` page - Click `Add endpoint` and select `Mistral` as the service. - Fill in a valid API key and model ID (`mistral-medium-latest`). - Confirm that `Maximum Input Tokens` field does not appear in the `More options` accordion section. - Select `chat_completion` under `Task type` - Submit the form and confirm that the endpoint is created successfully. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] ~Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~ - [ ] ~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials~ - [ ] ~[Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios~ - [ ] ~If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~ - [ ] ~This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations.~ - [ ] ~[Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed~ - [ ] ~The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~ - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent a6df752 commit 96445f9

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_service_form_fields.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,13 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
284284
newProvider?.configurations[k]?.supported_task_types &&
285285
newProvider?.configurations[k].supported_task_types.includes(taskType)
286286
) {
287-
// Get default value from schema (which includes overridden defaults from INTERNAL_OVERRIDE_FIELDS)
287+
// Get default value from schema (which includes overridden defaults from INTERNAL_OVERRIDE_FIELDS).
288+
// If the field is not in the schema (e.g. hidden by INTERNAL_OVERRIDE_FIELDS), skip it so
289+
// it is never written into the form state and therefore never sent in the request payload.
288290
const schemaField = newProviderSchema.find((f) => f.key === k);
289-
newConfigToUse[k] = schemaField?.default_value ?? null;
291+
if (schemaField !== undefined) {
292+
newConfigToUse[k] = schemaField.default_value ?? null;
293+
}
290294
}
291295
});
292296

x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/constants.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,7 @@ export const INTERNAL_OVERRIDE_FIELDS: InternalOverrideFieldsType = {
137137
[ServiceProviderKeys.googleaistudio]: {
138138
defaultValues: { model_id: GEMINI_DEFAULT_MODEL },
139139
},
140+
[ServiceProviderKeys.mistral]: {
141+
hidden: ['max_input_tokens'],
142+
},
140143
};

0 commit comments

Comments
 (0)