From 3e180b9ed5f118c2a49de54037f7870644b86c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Louv-Jansen?= Date: Thu, 14 Nov 2024 13:30:13 +0100 Subject: [PATCH] [AI Assistant] Use `semantic_text` for internal knowledge base (#186499) Closes https://github.com/elastic/obs-ai-assistant-team/issues/162 Closes https://github.com/elastic/kibana/issues/192757 This replaces the ML inference pipeline with `semantic_text` and adds a migration task that runs automatically when Kibana starts. Blocked by: - https://github.com/elastic/elasticsearch/pull/110027 - https://github.com/elastic/elasticsearch/pull/110033 - https://github.com/elastic/ml-team/issues/1298 (cherry picked from commit 671ff30516f2ca302962efffae7585dcd7ddfce9) # Conflicts: # x-pack/plugins/translations/translations/zh-CN.json --- ...ssage_knowledge_base_setup_error_panel.tsx | 36 +- .../src/hooks/use_knowledge_base.tsx | 14 +- .../server/config.ts | 2 +- .../server/functions/context.ts | 6 +- .../server/functions/index.ts | 8 +- .../server/plugin.ts | 15 +- .../server/routes/knowledge_base/route.ts | 86 +++-- .../server/routes/register_routes.ts | 3 +- .../server/routes/types.ts | 1 + .../server/service/client/index.ts | 20 +- .../server/service/index.ts | 84 ++--- .../server/service/inference_endpoint.ts | 104 ++++++ .../server/service/kb_component_template.ts | 9 + .../service/knowledge_base_service/index.ts | 314 +++++++----------- ...ter_migrate_knowledge_base_entries_task.ts | 149 +++++++++ .../translations/translations/fr-FR.json | 6 - .../translations/translations/ja-JP.json | 6 - .../translations/translations/zh-CN.json | 7 - .../knowledge_base_8_15/data.json.gz | Bin 0 -> 3099 bytes .../knowledge_base_8_15/mappings.json | 102 ++++++ .../configs/index.ts | 2 +- .../complete/functions/summarize.spec.ts | 10 +- .../tests/knowledge_base/helpers.ts | 17 + .../knowledge_base/knowledge_base.spec.ts | 18 +- .../knowledge_base_migration.spec.ts | 160 +++++++++ .../knowledge_base_setup.spec.ts | 44 ++- .../knowledge_base_status.spec.ts | 56 +++- .../knowledge_base_user_instructions.spec.ts | 13 +- .../knowledge_base_management/index.spec.ts | 18 +- .../check_registered_task_types.ts | 1 + .../observability/ai_assistant/config.ts | 2 +- .../tests/knowledge_base/helpers.ts | 20 -- .../knowledge_base/knowledge_base.spec.ts | 5 +- .../knowledge_base_setup.spec.ts | 45 ++- .../knowledge_base_status.spec.ts | 30 +- .../knowledge_base_user_instructions.spec.ts | 4 +- 36 files changed, 997 insertions(+), 420 deletions(-) create mode 100644 x-pack/plugins/observability_solution/observability_ai_assistant/server/service/inference_endpoint.ts create mode 100644 x-pack/plugins/observability_solution/observability_ai_assistant/server/service/task_manager_definitions/register_migrate_knowledge_base_entries_task.ts create mode 100644 x-pack/test/functional/es_archives/observability/ai_assistant/knowledge_base_8_15/data.json.gz create mode 100644 x-pack/test/functional/es_archives/observability/ai_assistant/knowledge_base_8_15/mappings.json create mode 100644 x-pack/test/observability_ai_assistant_api_integration/tests/knowledge_base/knowledge_base_migration.spec.ts delete mode 100644 x-pack/test_serverless/api_integration/test_suites/observability/ai_assistant/tests/knowledge_base/helpers.ts diff --git a/x-pack/packages/kbn-ai-assistant/src/chat/welcome_message_knowledge_base_setup_error_panel.tsx b/x-pack/packages/kbn-ai-assistant/src/chat/welcome_message_knowledge_base_setup_error_panel.tsx index eeff9c8afd7f3..f7267d6d21855 100644 --- a/x-pack/packages/kbn-ai-assistant/src/chat/welcome_message_knowledge_base_setup_error_panel.tsx +++ b/x-pack/packages/kbn-ai-assistant/src/chat/welcome_message_knowledge_base_setup_error_panel.tsx @@ -37,7 +37,9 @@ export function WelcomeMessageKnowledgeBaseSetupErrorPanel({ }) { const { http } = useKibana().services; - const modelName = knowledgeBase.status.value?.model_name; + const modelId = knowledgeBase.status.value?.endpoint?.service_settings?.model_id; + const deploymentState = knowledgeBase.status.value?.model_stats?.deployment_state; + const allocationState = knowledgeBase.status.value?.model_stats?.allocation_state; return (