Skip to content

[ML] Inference endpoints creation: adds custom header support#242187

Merged
alvarezmelissa87 merged 11 commits intoelastic:mainfrom
alvarezmelissa87:inference-endpoint-headers
Nov 21, 2025
Merged

[ML] Inference endpoints creation: adds custom header support#242187
alvarezmelissa87 merged 11 commits intoelastic:mainfrom
alvarezmelissa87:inference-endpoint-headers

Conversation

@alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Nov 6, 2025

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.

  • 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.
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.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests 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
  • 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 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
  • Review the backport guidelines and apply applicable backport:* labels.
@alvarezmelissa87 alvarezmelissa87 self-assigned this Nov 6, 2025
@alvarezmelissa87 alvarezmelissa87 requested review from a team as code owners November 6, 2025 19:01
@alvarezmelissa87 alvarezmelissa87 requested review from a team as code owners November 6, 2025 19:01
@alvarezmelissa87 alvarezmelissa87 added backport:skip This PR does not require backporting Feature:Inference UI ML Inference endpoints UI and AI connector v9.3.0 Feature: AI Infra Relating to the AI Assistant flow and any work impacting/involving the AI/Inference Connector labels Nov 6, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@alvarezmelissa87 alvarezmelissa87 requested review from rbrtj and removed request for jgowdyelastic November 7, 2025 16:11
alvarezmelissa87 added a commit that referenced this pull request Nov 7, 2025
## 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.
@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

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.

see run history

Copy link
Contributor

@Samiul-TheSoccerFan Samiul-TheSoccerFan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, code review only

return (
<EuiAccordion
id="inferenceMoreOptions"
data-test-subj="inference-endpoint-more-options"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to remove the commented out code before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in c493b08


expect(await testSubjects.isEnabled('inference-endpoint-submit-button')).to.be(true);
},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👏

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87 alvarezmelissa87 removed the request for review from viduni94 November 13, 2025 18:55
Copy link
Contributor

@viduni94 viduni94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (CR only)

Copy link
Contributor

@rbrtj rbrtj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@KDKHD
Copy link
Member

KDKHD commented Nov 14, 2025

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
@alvarezmelissa87
Copy link
Contributor Author

alvarezmelissa87 commented Nov 19, 2025

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
@alvarezmelissa87
Copy link
Contributor Author

  • 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

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.

  • 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

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!

@kibanamachine
Copy link
Contributor

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.

see run history

Copy link
Contributor

@rbrtj rbrtj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87
Copy link
Contributor Author

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

@rbrtj - thank you! Fixed that last bit in 640d50a

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/inference-endpoint-ui-common 171 172 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexManagement 706.2KB 707.0KB +818.0B
searchInferenceEndpoints 120.2KB 121.1KB +938.0B
searchPlayground 235.9KB 236.3KB +368.0B
securitySolution 11.1MB 11.1MB +368.0B
stackConnectors 811.7KB 812.4KB +648.0B
total +3.1KB
Unknown metric groups

API count

id before after diff
@kbn/inference-endpoint-ui-common 171 172 +1

History

cc @alvarezmelissa87

@alvarezmelissa87 alvarezmelissa87 merged commit 78a65fe into elastic:main Nov 21, 2025
12 checks passed
@alvarezmelissa87 alvarezmelissa87 deleted the inference-endpoint-headers branch November 21, 2025 19:03
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Dec 2, 2025
…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.
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Dec 2, 2025
…#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>
@peteharverson peteharverson changed the title [ML] Inference endpoints creation: add custom header support Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature: AI Infra Relating to the AI Assistant flow and any work impacting/involving the AI/Inference Connector Feature:Inference UI ML Inference endpoints UI and AI connector :ml release_note:enhancement v9.3.0

9 participants