[ML] AI/Inference Connector creation: use 'location' field to correctly set provider config #250838
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
pgayvallet
left a comment
There was a problem hiding this comment.
(on behalf of search-kibana, didn't full review)
|
@elasticmachine merge upstream |
| }; | ||
|
|
||
| const taskSettingsWithHeaders = { | ||
| ...unflattenObject(config?.taskTypeConfig ?? {}), // TODO: confirm this unflatten is needed |
|
This PR is blocked by this bug fix (#251357) that needs to go in first. |
|
@elasticmachine merge upstream |
|
merge conflict between base and head |
|
Pinging @elastic/ml-ui (:ml) |
x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/constants.tsx
Show resolved
Hide resolved
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
peteharverson
left a comment
There was a problem hiding this comment.
LGTM.
Tested using Anthropic (claude-sonnet-4-5) and Elasticsearch service - created on main and on the PR branch, and can view / edit connectors successfully when running on your PR branch.
|
@saikatsarkar056 - updated this with latest from main. Would you be up for giving this a test on review? 🙏 |
|
I did the following tests: Test 1: OpenAI with Custom Headers
Test 2: Anthropic with max_tokens
|
| enabled: true, | ||
| min_number_of_allocations: MIN_ALLOCATIONS, | ||
| ...(maxAllocations ? { max_number_of_allocations: maxAllocations } : {}), | ||
| ...(max_number_of_allocations ? { max_number_of_allocations } : {}), |
There was a problem hiding this comment.
max_number_of_allocations is already checked at line: 27. We can just put max_number_of_allocations here instead of ternary operation
| ...(max_number_of_allocations ? { max_number_of_allocations } : {}), | |
| max_number_of_allocations, |
There was a problem hiding this comment.
@saikatsarkar056 - good catch! Updated in e0e21e1
| ...restProviderConfig | ||
| } = providerConfig || {}; | ||
|
|
||
| if (restProviderConfig) { |
There was a problem hiding this comment.
I think after destructuring providerConfig || {}, restProviderConfig will be at least an empty object {} which is always truthy. Could you please verify whether this is true? I will try to test. In that case, we can never reach line 62: return data
const providerConfig = undefined;
const { a, ...rest } = providerConfig || {};
if (rest) {
console.log('always reaches here:', rest);
} else {
console.log('never reaches here');
}
output: "always reaches here:", {}
There was a problem hiding this comment.
@saikatsarkar056 - thank you for taking a look 🙏 You're totally right! Good catch - updated in e0e21e1
|
This has been updated with latest main and all comments have been addressed. I tested all cases with latest changes. |
⏳ Build in-progress
Failed CI StepsTest Failures
History
|
…d_agent_navigation2 * commit '9289d6b5502db245e645e190b0246554396c6c20': (34 commits) [api-docs] 2026-03-19 Daily api_docs build (elastic#258471) [Shared UX][DateRangePicker] Missing parts (elastic#258229) [Dashboard] Keep pinned_panels separate in read response (elastic#258444) Move inheritance: true to top level in .coderabbit.yml (elastic#258461) [DOCS] 9.3.2 Kibana release notes (elastic#257332) adds routing accept metric attribute to the cps metric (elastic#258168) [ML] AI/Inference Connector creation: use 'location' field to correctly set provider config (elastic#250838) [Lens] Add e2e test for legend list layout (elastic#258160) [SigEvents] Convert feature duplication evaluators to createPrompt pattern (elastic#256534) Add actionable-obs author to .coderabbit.yml (elastic#257922) [DOCS] 9.2.7 Kibana release notes (elastic#257331) Grant Serverless editor/viewer access to ES v2 indices (elastic#258384) [SigEvents][Evals] Rename terminology for KI features and KI queries (elastic#258361) [EDR Workflows][Osquery] Add shared table toolbar components and redesign saved queries list (elastic#258394) [Automatic Import V2] Upload samples using an existing index (elastic#258074) Add GET /inference_features route to expose feature registry (elastic#258044) fix additional fields not included (elastic#257625) [Discover] [Metrics] Add tier 2 journeys for Metrics in Discover E2E (elastic#255036) [Lens as code] Support correct X-Axis types in ES|QL visualizations (elastic#258159) Update APM (main) (elastic#254880) ...
…ly set provider config (elastic#250838) ## Summary Related issue: elastic#241872 In upcoming changes, the services API will specify where a field should be included (`service_settings` or `task_settings`) - this will be an optional `location` field (similar to `supported_task_types` and how it's used). This will help Kibana build the request and place the fields in the correct settings object. This PR ensures that field is used to set the config fields in the correct location - if the field is not present, then the default location should be `service_settings`. This PR utilizes the existing but unused `taskTypeConfig` for keeping track of what fields end up going in task_settings. Anything in 'providerConfig' remains in service_settings. The serializers have been updated to handle the old saved object format that didn't include taskTypeConfig. Example of what the field will look like: ``` { "service": "openai", "name": "OpenAI", "task_types": [ "text_embedding", "completion", "chat_completion" ], "configurations": { "api_key": { "description": "The OpenAI API authentication key. For more details about generating OpenAI API keys, refer to the https://platform.openai.com/account/api-keys.", "label": "API Key", "required": true, "sensitive": true, "updatable": true, "type": "str", "supported_task_types": [ "text_embedding", "completion", "chat_completion" ] }, "url": { "description": "The absolute URL of the external service to send requests to.", "label": "URL", "required": false, "sensitive": false, "updatable": false, "type": "str", "supported_task_types": [ "text_embedding", "completion", "chat_completion" ], "location": a string either task_settings|service_settings }, ... } ``` ### TESTING To test, create a connector with Open AI as the provider (gpt-4.1 model id can be used) with custom headers on main (so the old saved object format is created) and create one on the branch to ensure both show up correctly. The same can be done for Anthropic (claude-sonnet-4-5 model id can be used) with max_tokens set. For adaptive allocations, test on serverless and ensure that adaptive allocations are sent correctly for elastic/elasticsearch provider. On stateful it will be num_threads and num_allocations. You can create a connector/inference endpoint on main and then on the branch to ensure both show up correctly. Ping me if you need any api keys to use. ### 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) - [ ] 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>
…ly set provider config (elastic#250838) ## Summary Related issue: elastic#241872 In upcoming changes, the services API will specify where a field should be included (`service_settings` or `task_settings`) - this will be an optional `location` field (similar to `supported_task_types` and how it's used). This will help Kibana build the request and place the fields in the correct settings object. This PR ensures that field is used to set the config fields in the correct location - if the field is not present, then the default location should be `service_settings`. This PR utilizes the existing but unused `taskTypeConfig` for keeping track of what fields end up going in task_settings. Anything in 'providerConfig' remains in service_settings. The serializers have been updated to handle the old saved object format that didn't include taskTypeConfig. Example of what the field will look like: ``` { "service": "openai", "name": "OpenAI", "task_types": [ "text_embedding", "completion", "chat_completion" ], "configurations": { "api_key": { "description": "The OpenAI API authentication key. For more details about generating OpenAI API keys, refer to the https://platform.openai.com/account/api-keys.", "label": "API Key", "required": true, "sensitive": true, "updatable": true, "type": "str", "supported_task_types": [ "text_embedding", "completion", "chat_completion" ] }, "url": { "description": "The absolute URL of the external service to send requests to.", "label": "URL", "required": false, "sensitive": false, "updatable": false, "type": "str", "supported_task_types": [ "text_embedding", "completion", "chat_completion" ], "location": a string either task_settings|service_settings }, ... } ``` ### TESTING To test, create a connector with Open AI as the provider (gpt-4.1 model id can be used) with custom headers on main (so the old saved object format is created) and create one on the branch to ensure both show up correctly. The same can be done for Anthropic (claude-sonnet-4-5 model id can be used) with max_tokens set. For adaptive allocations, test on serverless and ensure that adaptive allocations are sent correctly for elastic/elasticsearch provider. On stateful it will be num_threads and num_allocations. You can create a connector/inference endpoint on main and then on the branch to ensure both show up correctly. Ping me if you need any api keys to use. ### 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) - [ ] 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>
Summary
Related issue: #241872
In upcoming changes, the services API will specify where a field should be included (
service_settingsortask_settings) - this will be an optionallocationfield (similar tosupported_task_typesand how it's used). This will help Kibana build the request and place the fields in the correct settings object.This PR ensures that field is used to set the config fields in the correct location - if the field is not present, then the default location should be
service_settings.This PR utilizes the existing but unused
taskTypeConfigfor keeping track of what fields end up going in task_settings. Anything in 'providerConfig' remains in service_settings.The serializers have been updated to handle the old saved object format that didn't include taskTypeConfig.
Example of what the field will look like:
TESTING
To test, create a connector with Open AI as the provider (gpt-4.1 model id can be used) with custom headers on main (so the old saved object format is created) and create one on the branch to ensure both show up correctly. The same can be done for Anthropic (claude-sonnet-4-5 model id can be used) with max_tokens set.
For adaptive allocations, test on serverless and ensure that adaptive allocations are sent correctly for elastic/elasticsearch provider. On stateful it will be num_threads and num_allocations. You can create a connector/inference endpoint on main and then on the branch to ensure both show up correctly. Ping me if you need any api keys to use.
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.