Skip to content

[AI Infra] Adds new temperature parameter to AI Connector and OpenAI, Bedrock, Gemini connectors#239806

Merged
alvarezmelissa87 merged 20 commits intoelastic:mainfrom
qn895:ai-connectors-add-temperature
Nov 5, 2025
Merged

[AI Infra] Adds new temperature parameter to AI Connector and OpenAI, Bedrock, Gemini connectors#239806
alvarezmelissa87 merged 20 commits intoelastic:mainfrom
qn895:ai-connectors-add-temperature

Conversation

@qn895
Copy link
Member

@qn895 qn895 commented Oct 20, 2025

Summary

Follow up of #239626. This PR addresses #239181.

If a user defines/sets a temperature at the connector level, the connector's temperature will override the Kibana's default temperature for each connector. If temperature is not explicitly set by a user, then we respect the the temperature set by the request.

AI connector
Screenshot 2025-10-28 at 09 16 29

Screenshot 2025-10-28 at 09 20 18 Screenshot 2025-10-28 at 09 18 18 Screenshot 2025-10-28 at 09 18 03

Before:
image

After:

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.

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.

@qn895 qn895 changed the title [AI Infra] Add new temperature parameter to GenAI Connectors (OpenAI, AI Connector, Gemini, and Bedrock) Oct 27, 2025
@qn895 qn895 marked this pull request as ready for review October 28, 2025 14:27
@qn895 qn895 requested review from a team as code owners October 28, 2025 14:27
@@ -338,6 +436,7 @@ export const AdditionalOptionsFields: React.FC<AdditionalOptionsFieldsProps> = (
</UseField>
<EuiSpacer size="m" />
{contextWindowLengthSettings}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is temperature something that can be set with every connector or just when using chat_completion task type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably just chat_completion or completion 👀

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I assume it only makes sense for those two task types

@qn895 qn895 changed the title [AI Infra] Add new temperature parameter to Inference GenAI Connector Oct 29, 2025
@@ -338,6 +436,7 @@ export const AdditionalOptionsFields: React.FC<AdditionalOptionsFieldsProps> = (
</UseField>
<EuiSpacer size="m" />
{contextWindowLengthSettings}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I assume it only makes sense for those two task types

Comment on lines 213 to 218
if (isNaN(numValue) || numValue < 0 || numValue > 1) {
return {
code: 'ERR_FIELD_INVALID',
path,
message: LABELS.TEMPERATURE_VALIDATION_MESSAGE,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think temperature is capped to 1. Note that the max value may depend on the provider and model 🙈. But it's probably fine to let them pick whatever they want here. Worth case it breaks when using the connector with an explicit error (which is the case) and the customer can just edit it again.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 20650d7 (#239806)

return { temperature: connector.config.temperature };
}

if (temperature === undefined || temperature < 0 || temperature > 1) return {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark about max value

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Updated here 20650d7 (#239806)

Comment on lines +16 to +19
// If user sets temperature in the connector config, use it by default
if (connector?.config?.temperature) {
return { temperature: connector.config.temperature };
}
Copy link
Contributor

Choose a reason for hiding this comment

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

So - the approach is fine for any usage of the GenAI connectors going through the inference plugin.

This new temperature config param will not be used when calling the connectors directly. I'm not sure this is a problem, given the inference plugin is the recommended way of calling LLMs from Kibana, but I just wanted to make sure we were aware of it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I'm trying to support for those connectors not going through the inference plugin too for this PR but it's a bit time consuming, so maybe a follow up is fine. Thank you for bringing this up!

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@peteharverson peteharverson added the Team:AI Infra Platform AppEx AI Infrastructure Team t// label Oct 30, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-ai-infra (Team:AI Infra)

@peteharverson peteharverson added the Feature: AI Infra Relating to the AI Assistant flow and any work impacting/involving the AI/Inference Connector label Oct 30, 2025
@qn895 qn895 requested review from a team as code owners October 30, 2025 15:34

const temperatureSettings = useMemo(
() =>
taskTypeOptions?.some((option) => option.id === CHAT_COMPLETION_TASK_TYPE) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is only compatible with chat completion, then we should enforce that in the UI by only showing this setting if chat completion is selected.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 6989330 (#239806)

@alvarezmelissa87
Copy link
Contributor

alvarezmelissa87 commented Oct 30, 2025

Tested AI Connector (openAI provider) and confirmed temperature is sent along correctly.
Tested Open AI specific connector and confirmed temperature is sent along correctly.

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the improvement!

import { FormattedMessage } from '@kbn/i18n-react';
import * as i18n from './translations';

export const temperatureField: ConfigFieldSchema = {
Copy link
Contributor

Choose a reason for hiding this comment

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

no default value?

Copy link
Contributor

Choose a reason for hiding this comment

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

no,by design. Default value is meant to be undefined (defaulting to the provider's native default)

@alvarezmelissa87
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 left a comment

Choose a reason for hiding this comment

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

LGTM ⚡

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

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 170 171 +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 698.4KB 700.8KB +2.4KB
searchInferenceEndpoints 114.4KB 116.7KB +2.4KB
searchPlayground 235.0KB 235.3KB +277.0B
securitySolution 11.0MB 11.0MB +277.0B
stackConnectors 725.5KB 730.4KB +4.9KB
total +10.2KB
Unknown metric groups

API count

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

History

cc @qn895

@alvarezmelissa87 alvarezmelissa87 merged commit cf5ff5b into elastic:main Nov 5, 2025
13 checks passed
@kibanamachine kibanamachine added backport:skip This PR does not require backporting v9.3.0 and removed backport:version Backport to applied version labels labels Nov 5, 2025
wildemat pushed a commit to wildemat/kibana that referenced this pull request Nov 6, 2025
… Bedrock, Gemini connectors (elastic#239806)

## Summary

Follow up of elastic#239626. This PR
addresses elastic#239181.

If a user defines/sets a temperature at the connector level, the
connector's temperature will override the Kibana's default temperature
for each connector. If temperature is not explicitly set by a user, then
we respect the the temperature set by the request.

AI connector
<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 16 29"
src="https://github.com/user-attachments/assets/e5d28754-0b4d-46df-99b7-43c26bb9ab5a"
/>

<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 20 18"
src="https://github.com/user-attachments/assets/71e3a125-e8a3-4bd9-a04d-c34b29e0b7a1"
/>
<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 18 18"
src="https://github.com/user-attachments/assets/6fa62eb0-24dc-4245-bc3f-a84fa10b34c4"
/>
<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 18 03"
src="https://github.com/user-attachments/assets/b60391fd-f23f-40c5-b8a8-87c419f5b2c6"
/>


Before:
<img width="1896" height="1386" alt="image"
src="https://github.com/user-attachments/assets/6213ee44-d53e-440e-95c3-ac1abaded3c0"
/>

After:



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

### 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>
Co-authored-by: Melissa <melissa.alvarez@elastic.co>
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Dec 2, 2025
… Bedrock, Gemini connectors (elastic#239806)

## Summary

Follow up of elastic#239626. This PR
addresses elastic#239181.

If a user defines/sets a temperature at the connector level, the
connector's temperature will override the Kibana's default temperature
for each connector. If temperature is not explicitly set by a user, then
we respect the the temperature set by the request.

AI connector
<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 16 29"
src="https://github.com/user-attachments/assets/e5d28754-0b4d-46df-99b7-43c26bb9ab5a"
/>

<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 20 18"
src="https://github.com/user-attachments/assets/71e3a125-e8a3-4bd9-a04d-c34b29e0b7a1"
/>
<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 18 18"
src="https://github.com/user-attachments/assets/6fa62eb0-24dc-4245-bc3f-a84fa10b34c4"
/>
<img width="866" height="880" alt="Screenshot 2025-10-28 at 09 18 03"
src="https://github.com/user-attachments/assets/b60391fd-f23f-40c5-b8a8-87c419f5b2c6"
/>


Before:
<img width="1896" height="1386" alt="image"
src="https://github.com/user-attachments/assets/6213ee44-d53e-440e-95c3-ac1abaded3c0"
/>

After:



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

### 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>
Co-authored-by: Melissa <melissa.alvarez@elastic.co>
@peteharverson peteharverson changed the title [AI Infra] Add new temperature parameter to Inference AI, and OpenAI, Bedrock, Gemini connectors Dec 8, 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 :ml release_note:enhancement Team:AI Infra Platform AppEx AI Infrastructure Team t// v9.3.0

9 participants