Skip to content

[Obs AI Assistant] Use built-in inference endpoints over specific models#215591

Closed
sorenlouv wants to merge 70 commits intoelastic:mainfrom
sorenlouv:make-inference-task-type-configurable
Closed

[Obs AI Assistant] Use built-in inference endpoints over specific models#215591
sorenlouv wants to merge 70 commits intoelastic:mainfrom
sorenlouv:make-inference-task-type-configurable

Conversation

@sorenlouv
Copy link
Member

@sorenlouv sorenlouv commented Mar 21, 2025

Relates to https://github.com/elastic/obs-ai-assistant-team/issues/161

  • Updates POST /internal/observability_ai_assistant/kb/setup API by adding inference_id. This makes it possible to use any inference endpoint, and thereby any model in the knowledge base. For now we will only expose the built-in inference endpoints for E5 and ELSER as options in the UI
  • Improve re-indexing so it increments the current index and writes to the new one. Previously we would re-index to a temporary index, and then back again to the original index
  • Improve re-indexing so different consumers cannot run multiple re-index operations simultaneously

@sorenlouv sorenlouv changed the title [Obs AI Assistant] Make inference task type configurable [Obs AI Assistant] Add task_type param to. setup API and improve re-indexing logic Mar 22, 2025
@sorenlouv sorenlouv marked this pull request as ready for review March 22, 2025 00:19
@sorenlouv sorenlouv requested review from a team as code owners March 22, 2025 00:19
@botelastic botelastic bot added the Team:Obs AI Assistant Observability AI Assistant label Mar 22, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant)

@sorenlouv sorenlouv added backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes v9.1.0 v8.19.0 labels Mar 22, 2025
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Mar 22, 2025
@github-actions
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@sorenlouv sorenlouv force-pushed the make-inference-task-type-configurable branch from be0ef22 to be207d6 Compare March 23, 2025 23:31
@sorenlouv sorenlouv changed the title [Obs AI Assistant] Enable custom inference endpoints in KB [Obs AI Assistant] Use built-in inference endpoints over specific models Apr 13, 2025
@viduni94
Copy link
Contributor

Hey @sorenlouv
With the changes in your PR, we will be solving this issue too, am I right?
As per my understanding, when this PR is merged, we will stop using our custom inference endpoint. Just wanted to confirm.

params: t.partial({
query: t.partial({
model_id: t.string,
params: t.type({
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to pass this as a query param instead of in the body since this is a POST request?

@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 22, 2025

💔 Build Failed

  • Buildkite Build
  • Commit: 250c147
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-215591-250c147323ef

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #96 / Observability AI Assistant Functional tests knowledge_base_management/index.spec.ts Knowledge management tab "before all" hook in "Knowledge management tab"
  • [job] [logs] FTR Configs #96 / Observability AI Assistant Functional tests knowledge_base_management/index.spec.ts Knowledge management tab "before all" hook in "Knowledge management tab"
  • [job] [logs] FTR Configs #64 / Serverless Observability - Deployment-agnostic APM API integration tests observability AI Assistant context "before all" hook in "context"
  • [job] [logs] FTR Configs #64 / Serverless Observability - Deployment-agnostic APM API integration tests observability AI Assistant context "before all" hook in "context"
  • [job] [logs] FTR Configs #126 / Stateful Observability - Deployment-agnostic API integration tests Observability Alerting Custom Threshold rule CUSTOM_EQ - AVG - BYTES - FIRED Rule creation should set correct action variables

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/ai-assistant 105 106 +1

Async chunks

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

id before after diff
observabilityAIAssistantApp 240.2KB 240.1KB -70.0B
observabilityAiAssistantManagement 84.1KB 84.1KB +55.0B
searchAssistant 165.5KB 165.4KB -70.0B
total -85.0B
Unknown metric groups

API count

id before after diff
@kbn/ai-assistant 105 106 +1

History

@sorenlouv
Copy link
Member Author

Replaced by #218448

@sorenlouv sorenlouv closed this Apr 23, 2025
sorenlouv added a commit that referenced this pull request May 5, 2025
…Knowledge Base (#218448)

Closes elastic/obs-ai-team#230
Closes elastic/obs-ai-team#232

Related to #215591

## Summary

This PR implements the changes related to the first phase of supporing
multilingual Knowledge Base. The users have the ability to pick the
`e5-small` model for the Knowledge Base, if they want support for
languages other than English.

<img width="610" alt="image"
src="https://github.com/user-attachments/assets/4c815aa4-aa97-4845-98c5-e079dd92f23a"
/>

<img width="1281" alt="image"
src="https://github.com/user-attachments/assets/7c1bcd82-5464-497f-a053-7fe271da1cdd"
/>

<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/bc084e90-c291-44ea-8560-e033729bfcca"
/>

When the KB model is not allocated due to nodes scaling down:


![image](https://github.com/user-attachments/assets/2f52e31e-81e4-4824-bc5b-b97df714da5c)


### Checklist

- [x] 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)
- [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
- [ ] [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)


## Upgrade testing steps

### 9.0 - 9.1 (main)

Checkout `9.0` branch and start Kibana and ES. ES must be started with
`path.data` to persist data:

```
yarn es snapshot --license trial --E path.data=/Users/sorenlouv/elastic/es_data/upgrade_test_9.0
```

---------

Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
sorenlouv pushed a commit to sorenlouv/kibana that referenced this pull request May 5, 2025
…Knowledge Base (elastic#218448)

Closes elastic/obs-ai-team#230
Closes elastic/obs-ai-team#232

Related to elastic#215591

## Summary

This PR implements the changes related to the first phase of supporing
multilingual Knowledge Base. The users have the ability to pick the
`e5-small` model for the Knowledge Base, if they want support for
languages other than English.

<img width="610" alt="image"
src="https://github.com/user-attachments/assets/4c815aa4-aa97-4845-98c5-e079dd92f23a"
/>

<img width="1281" alt="image"
src="https://github.com/user-attachments/assets/7c1bcd82-5464-497f-a053-7fe271da1cdd"
/>

<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/bc084e90-c291-44ea-8560-e033729bfcca"
/>

When the KB model is not allocated due to nodes scaling down:

![image](https://github.com/user-attachments/assets/2f52e31e-81e4-4824-bc5b-b97df714da5c)

### Checklist

- [x] 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)
- [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
- [ ] [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)

## Upgrade testing steps

### 9.0 - 9.1 (main)

Checkout `9.0` branch and start Kibana and ES. ES must be started with
`path.data` to persist data:

```
yarn es snapshot --license trial --E path.data=/Users/sorenlouv/elastic/es_data/upgrade_test_9.0
```

---------

Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
(cherry picked from commit dc019f8)

# Conflicts:
#	x-pack/platform/plugins/private/translations/translations/fr-FR.json
#	x-pack/platform/plugins/private/translations/translations/ja-JP.json
#	x-pack/platform/plugins/private/translations/translations/zh-CN.json
#	x-pack/platform/plugins/shared/observability_ai_assistant/server/service/inference_endpoint.ts
#	x-pack/platform/plugins/shared/observability_ai_assistant/server/service/knowledge_base_service/reindex_knowledge_base.ts
#	x-pack/platform/plugins/shared/observability_ai_assistant/server/service/startup_migrations/create_or_update_index_assets.ts
#	x-pack/platform/plugins/shared/observability_ai_assistant/server/service/startup_migrations/populate_missing_semantic_text_field_migration.ts
#	x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.json
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/chat/chat.spec.ts
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/knowledge_base/knowledge_base.spec.ts
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/knowledge_base/knowledge_base_reindex_and_populate_missing_semantic_text_fields.spec.ts
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/knowledge_base/knowledge_base_reindex_to_fix_sparse_vector_support.spec.ts
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/knowledge_base/knowledge_base_setup.spec.ts
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/knowledge_base/knowledge_base_status.spec.ts
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/ai_assistant/utils/knowledge_base.ts
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…Knowledge Base (elastic#218448)

Closes elastic/obs-ai-team#230
Closes elastic/obs-ai-team#232

Related to elastic#215591

## Summary

This PR implements the changes related to the first phase of supporing
multilingual Knowledge Base. The users have the ability to pick the
`e5-small` model for the Knowledge Base, if they want support for
languages other than English.

<img width="610" alt="image"
src="https://github.com/user-attachments/assets/4c815aa4-aa97-4845-98c5-e079dd92f23a"
/>

<img width="1281" alt="image"
src="https://github.com/user-attachments/assets/7c1bcd82-5464-497f-a053-7fe271da1cdd"
/>

<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/bc084e90-c291-44ea-8560-e033729bfcca"
/>

When the KB model is not allocated due to nodes scaling down:


![image](https://github.com/user-attachments/assets/2f52e31e-81e4-4824-bc5b-b97df714da5c)


### Checklist

- [x] 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)
- [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
- [ ] [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)


## Upgrade testing steps

### 9.0 - 9.1 (main)

Checkout `9.0` branch and start Kibana and ES. ES must be started with
`path.data` to persist data:

```
yarn es snapshot --license trial --E path.data=/Users/sorenlouv/elastic/es_data/upgrade_test_9.0
```

---------

Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
qn895 pushed a commit to qn895/kibana that referenced this pull request Jun 3, 2025
…Knowledge Base (elastic#218448)

Closes elastic/obs-ai-team#230
Closes elastic/obs-ai-team#232

Related to elastic#215591

## Summary

This PR implements the changes related to the first phase of supporing
multilingual Knowledge Base. The users have the ability to pick the
`e5-small` model for the Knowledge Base, if they want support for
languages other than English.

<img width="610" alt="image"
src="https://github.com/user-attachments/assets/4c815aa4-aa97-4845-98c5-e079dd92f23a"
/>

<img width="1281" alt="image"
src="https://github.com/user-attachments/assets/7c1bcd82-5464-497f-a053-7fe271da1cdd"
/>

<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/bc084e90-c291-44ea-8560-e033729bfcca"
/>

When the KB model is not allocated due to nodes scaling down:


![image](https://github.com/user-attachments/assets/2f52e31e-81e4-4824-bc5b-b97df714da5c)


### Checklist

- [x] 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)
- [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
- [ ] [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)


## Upgrade testing steps

### 9.0 - 9.1 (main)

Checkout `9.0` branch and start Kibana and ES. ES must be started with
`path.data` to persist data:

```
yarn es snapshot --license trial --E path.data=/Users/sorenlouv/elastic/es_data/upgrade_test_9.0
```

---------

Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:Obs AI Assistant Observability AI Assistant v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants