[ML] Inference endpoints UI serverless: Enables adaptive allocations and allow user to set max allocations#222726
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
2d51451 to
4254225
Compare
4254225 to
33cb73e
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Samiul-TheSoccerFan
left a comment
There was a problem hiding this comment.
Looks good so far! Just wondering, are any changes needed in the Index Management package as well? Since it's also possible to create inference endpoints from there, it might be worth validating whether any updates are required on that side too.
...es/shared/kbn-inference-endpoint-ui-common/src/components/configuration/helptext_callout.tsx
Outdated
Show resolved
Hide resolved
| const MIN_ALLOCATIONS = 0; | ||
| const DEFAULT_NUM_THREADS = 1; | ||
|
|
||
| export const getInferenceApiParams = (data: any, enforceAdaptiveAllocations: boolean) => { |
There was a problem hiding this comment.
Note on this function - ideally we should be doing this in the form serializer but because right now we need enforceAdaptiveAllocations (which isn't available outside of the component) we need to keep this as an external function.
Once this change is included in all environments and we no longer need that flag - this will be moved to the serializer. cc @jcger 🙏
|
|
||
| // TODO: Remove when https://github.com/elastic/kibana/issues/133107 is resolved | ||
| const formDeserializer = (data: ConnectorFormSchema): ConnectorFormSchema => { | ||
| if ( |
There was a problem hiding this comment.
I couldn't find a better alternative. We have to hardcode the serializer/deserializer this way. We'll open an issue to improve our framework
| */ | ||
|
|
||
| const { actionTypeId, name, config, secrets } = data; | ||
| const connectorData = getInferenceApiParams(data, !!enforceAdaptiveAllocations) ?? data; |
There was a problem hiding this comment.
I think it would be better to add the condition here to check that it's only called when the connector type is the inference connector.
There was a problem hiding this comment.
This data manipulation now lives in the form serializer/deserializer so this helper function is no longer needed.
Changes made here 1e4dd5a
| export interface ActionConnectorFieldsProps { | ||
| readOnly: boolean; | ||
| isEdit: boolean; | ||
| enforceAdaptiveAllocations?: boolean; |
There was a problem hiding this comment.
It's too specific for the inference connector. For now, it's using the value of isServerless, let's call it that instead. If the requirements for determining when the inference connector should enforceAdapativeAllocations change, we can adapt. For now, let's go for the mininum required changes for the current needs, and keep it as easy as possible. I'll add an extra comment for the lazy loading components that don't set the context the same way we do in the rest of the plugin
|
|
||
| const InferenceAPIConnectorFields: React.FunctionComponent<ActionConnectorFieldsProps> = ({ | ||
| isEdit, | ||
| enforceAdaptiveAllocations, |
There was a problem hiding this comment.
Let's use isServerless via the Kibana context instead.
The component should render like this:
<InferenceServiceFormFields
http={http}
isEdit={isEdit}
enforceAdaptiveAllocations={isServerless}
toasts={toasts}
/>
| actionTypeRegistry, | ||
| ruleTypeRegistry, | ||
| share: pluginsStart.share, | ||
| enforceAdaptiveAllocations: !!pluginsStart.serverless, |
There was a problem hiding this comment.
lets call this isServerless. Same for the rest
… remove deprecated plugin deps
jcger
left a comment
There was a problem hiding this comment.
I'd recommend testing that the field is shown when it should be, ensuring we don't break it with a change to the isServerless feature. Approving because that test isn't on our side, and because it could be done in a future PR
| interface ConnectorFormFieldsProps { | ||
| actionTypeModel: ActionTypeModel | null; | ||
| isEdit: boolean; | ||
| enforceAdaptiveAllocations?: boolean; |
There was a problem hiding this comment.
this can be removed now, I can't see it being used
| setResetForm?: (value: ResetForm) => void; | ||
| } | ||
|
|
||
| interface ProviderConfig { |
There was a problem hiding this comment.
nit: rename it to something that makes it clear that it's only used/needed by the inference connector, something like InferenceConnectorProviderConfig
There was a problem hiding this comment.
Could you please add tests for the new logic?
|
@elasticmachine merge upstream |
⏳ Build in-progress
History
|
|
Created a follow up issue #225700 for adding tests. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
…UI (#249098) ### Summary Adds tests for serverless adaptive allocations feature (#222726). ### Run Tests ``` yarn test:jest --no-collectCoverage x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_service_form_fields.test.tsx yarn test:jest --no-collectCoverage x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_flyout_wrapper.test.tsx ``` ### 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 - [x] [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 - [x] 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. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…UI (elastic#249098) ### Summary Adds tests for serverless adaptive allocations feature (elastic#222726). ### Run Tests ``` yarn test:jest --no-collectCoverage x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_service_form_fields.test.tsx yarn test:jest --no-collectCoverage x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_flyout_wrapper.test.tsx ``` ### 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 - [x] [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 - [x] 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. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…UI (elastic#249098) ### Summary Adds tests for serverless adaptive allocations feature (elastic#222726). ### Run Tests ``` yarn test:jest --no-collectCoverage x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_service_form_fields.test.tsx yarn test:jest --no-collectCoverage x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_flyout_wrapper.test.tsx ``` ### 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 - [x] [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 - [x] 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. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Related issue: #221827
The changes in this PR for now will only apply in serverless.
This PR adds the following changes in a serverless environment:
Entry points tested:
Add endpointbuttonConnect to an LLMbuttonCreate connector buttonSet up GenAI ConnectorbuttonTASKS
- [ ] implement helper class to calculate appropriate value fornum_threadsbased on max allocations specified by the user. This will be done keeping in mind that it will be optimized for search with high resource use.num_allocationswill be defaulted to 1 as the endpoint currently requires that parameterTO NOTE
The field overrides added are a temporary solution until the endpoint returning the service's configurable fields can be updated.
As the code is shared with the AI Connector - this behavior will also apply for Elasticsearch service when on serverless.
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 guidelines