[ML] Inference endpoints creation: adds custom header support#242187
[ML] Inference endpoints creation: adds custom header support#242187alvarezmelissa87 merged 11 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/ml-ui (:ml) |
## Summary This PR handles header field for inference endpoint creation until full support is added here #242187 Before: https://github.com/user-attachments/assets/b3d41704-8240-4f4b-bc0b-f802efa794ae After: https://github.com/user-attachments/assets/19ac1a7f-b1d2-433b-84d9-c22b10765119 ### 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.
|
@elasticmachine merge upstream |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#9818[✅] x-pack/solutions/search/test/functional_search/config.ts: 35/35 tests passed. |
Samiul-TheSoccerFan
left a comment
There was a problem hiding this comment.
LGTM, code review only
| return ( | ||
| <EuiAccordion | ||
| id="inferenceMoreOptions" | ||
| data-test-subj="inference-endpoint-more-options" |
There was a problem hiding this comment.
nitpick: Do we need this data-test-subj if we are adding one below?
| providerConfig?: ProviderConfig; // Record<string, unknown>; | ||
| contextWindowLength?: number; | ||
| temperature?: number; | ||
| headers?: Map; |
There was a problem hiding this comment.
nitpick: just curious why we declare this as Map instead of Record<string, string>?
| inferenceId: string; | ||
| provider: string; | ||
| providerConfig?: Record<string, unknown>; | ||
| providerConfig?: ProviderConfig; // Record<string, unknown>; |
There was a problem hiding this comment.
Please make sure to remove the commented out code before merging.
|
|
||
| expect(await testSubjects.isEnabled('inference-endpoint-submit-button')).to.be(true); | ||
| }, | ||
|
|
|
@elasticmachine merge upstream |
rbrtj
left a comment
There was a problem hiding this comment.
Overall LGTM, but
- If you try to add another key starting with the value of the first key, it won't let you. (e.g., first header key -
value, second header key -value2). - When viewing the endpoint, the behavior is odd, the http headers are initially disabled, and when you enable it for the first time, previously added headers appear. After toggling it again, they disappear.
Screen.Recording.2025-11-14.at.09.40.24.mov
|
Found another issue similar to what @rbrtj found. There looks to be some alphabetical ordering happening with the headers, resulting in the active input jumping around, and the cursor being placed in the wrong input. Untitled.mov |
Thanks so much for taking a look and testing, @KDKHD! Good catch! 🙏 Pushed some improvements to the functionality which resolve both issues in c493b08 PR description has been updated with a description of the improved behavior. Would you be up for taking a final look/test? Thank you so much! inferenceHeadersReorderFix.mov |
Thanks so much for testing @rbrtj 🙏 Based on your feedback I made some improvements to the behavior to fix duplicate key issue and for better clarity.
I updated the description with the improved behavior in the PR description above and also updated the recording. Would you be up for giving it another look and test? Thank you so much! |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#9854[✅] x-pack/solutions/search/test/functional_search/config.ts: 25/25 tests passed. |
rbrtj
left a comment
There was a problem hiding this comment.
LGTM after latest changes
nit:
when toggling off the headers switch, headers are no longer removed
The labeling probably indicates the intended behavior, but tbh, when toggling off the headers, I would expect them not to be sent.
Also, if you add a header, then remove it and toggle it off, the Add button remains enabled. Not a big issue, but just noting the inconsistency 😄
Screen.Recording.2025-11-20.at.16.57.09.mov
|
@elasticmachine merge upstream |
|
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
History
|
…42300) ## Summary This PR handles header field for inference endpoint creation until full support is added here elastic#242187 Before: https://github.com/user-attachments/assets/b3d41704-8240-4f4b-bc0b-f802efa794ae After: https://github.com/user-attachments/assets/19ac1a7f-b1d2-433b-84d9-c22b10765119 ### 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.
…#242187) ## Summary This PR is the second part of an effort to add custom header support for OpenAI in the inference endpoints creation UI. Because adding new properties to a schema require a 2 step deployment (see elastic#228371 (comment)), 2 PRs are needed for this. step one - the schema changes in elastic#241887 (this PR can't be merged until this is in serverless) step two - things that can set the config property (so here, the UI) - in this PR This PR improves the behavior of the headers input field. - when toggling off the headers switch, headers are no longer removed - the previous behavior was causing confusion - switch label now reads 'Hide headers' when toggled on and 'Add headers' when off (if editing with existing headers, reads 'View headers' when toggled off) - adds duplicate key check and adds error message when duplicate key is detected - headers input field now keeps it's own state (array list for the headers) in order to detect the duplicate keys and the form state is updated onblur and when no duplicates are present. This ensures the form updates only when the user is done typing and cuts down on unnecessary re-renders. https://github.com/user-attachments/assets/53e59c78-4619-4b34-959e-5382a369882c Flaky test runner for updates https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/9818 Flaky test runner after behavior update (last commit) https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/9854 ### 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
This PR is the second part of an effort to add custom header support for OpenAI in the inference endpoints creation UI.
Because adding new properties to a schema require a 2 step deployment (see #228371 (comment)), 2 PRs are needed for this.
step one - the schema changes in #241887 (this PR can't be merged until this is in serverless)
step two - things that can set the config property (so here, the UI) - in this PR
This PR improves the behavior of the headers input field.
inferenceEndpointHeadersRecording.mov
Flaky test runner for updates
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/9818
Flaky test runner after behavior update (last commit) https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/9854
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.