From d032a32ab48a5b32ce095be89ebd5f4c7275d97c Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Fri, 25 Aug 2023 11:28:03 +0200 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit c6c505716aefa0c52f3c23cec06d0c099121e556 Merge: 97a0c69ec9c 4297b8708e2 Author: Dario Gieselaar Date: Fri Aug 25 11:25:33 2023 +0200 Merge remote-tracking branch 'upstream/main' into obs-ai-assistant-2 commit 97a0c69ec9c03722d16a2baf6a5b45df19f921db Merge: 553ca0cbb43 236c5eba62f Author: Dario Gieselaar Date: Fri Aug 25 09:36:10 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 553ca0cbb4398d2265aa91fe72c7f80e5612155c Author: Dario Gieselaar Date: Fri Aug 25 08:17:48 2023 +0200 Fixed number of retries commit 28d8ded176a044d3a187191b004289cce472d37d Merge: cbf4a8c80ab 2d652e1313a Author: Dario Gieselaar Date: Thu Aug 24 18:33:05 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit cbf4a8c80ab0d0f86725c267317efbbf0f54ffa6 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Aug 23 07:11:46 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 3486c69016ee887281f9bac07e82711f28f8bbeb Author: Dario Gieselaar Date: Wed Aug 23 09:06:06 2023 +0200 Fix type errors commit 08eaa6d294efce954eb8bac5d01c446de11ab199 Author: Dario Gieselaar Date: Wed Aug 23 08:57:19 2023 +0200 Active alerts function commit f408aa4a5e63408044134f06f6236ee3ecd7ab37 Author: Dario Gieselaar Date: Tue Aug 22 18:07:19 2023 +0200 Improve description of Kibana function commit 635d2fd0c2a2db25235204b737cd3a5b61c17e81 Author: Dario Gieselaar Date: Tue Aug 22 17:42:09 2023 +0200 Call any Kibana API commit a0e6bb27d81b8d10dd4ba54859b937588e71a5e9 Author: Dario Gieselaar Date: Tue Aug 22 15:03:48 2023 +0200 Add get_apm_services_list function commit 97381d8a7160a81dffa5cf41ef65cb0986e265c8 Merge: b81448c493d 31eed021e9b Author: Dario Gieselaar Date: Tue Aug 22 08:30:09 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit b81448c493daf37abb7b39b13d79fc6c360760dc Merge: 53a59c0fc7c eddb98ecc99 Author: Dario Gieselaar Date: Mon Aug 21 18:36:54 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 53a59c0fc7c7d6c5888b923cf7a68a6a3d06eea1 Author: Dario Gieselaar Date: Mon Aug 21 18:35:10 2023 +0200 Fix type errors commit eddb98ecc995af3082492a3af4f63ec255107fd3 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Aug 21 14:00:06 2023 +0000 [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' commit df0951859f119ff57dae3e8117851efd22081447 Author: Dario Gieselaar Date: Mon Aug 21 15:54:11 2023 +0200 Split documents commit 12e9edc0b870251d7fb77a09ea2912292d7d78c5 Merge: 438c070b5c6 037cbce707f Author: Dario Gieselaar Date: Mon Aug 21 13:59:46 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 438c070b5c6ba629a3a5eb4e0387d836bcfc7b55 Merge: a7d1ce2330b 1244b4322ca Author: Dario Gieselaar Date: Mon Aug 21 13:34:33 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 1244b4322ca6f6bf565b9eae80f4543bc9a376bf Merge: 3fe36dcd3f2 23d39555e0d Author: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Aug 21 07:28:27 2023 -0400 Merge branch 'main' into obs-ai-assistant-2 commit a7d1ce2330b2b922abff7a6466c16f98991b314f Merge: 3fe36dcd3f2 23d39555e0d Author: Dario Gieselaar Date: Mon Aug 21 13:17:24 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 3fe36dcd3f2324ab1e803a20dd400535a5b6d9d1 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Aug 17 08:53:55 2023 +0000 [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' commit 4f5b5b1888fd8619001b3afbf49010172951ac06 Merge: 03e95e1096b 9d55308844d Author: Coen Warmer Date: Thu Aug 17 10:14:02 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 03e95e1096b07e116b2873f949a7e09ee8624ae3 Merge: 54301ca105b 664cd4d898f Author: Coen Warmer Date: Tue Aug 15 17:31:51 2023 +0200 Merge pull request #44 from CoenWarmer/storybook commit 664cd4d898f6a5d7f2aaf942d5e7403b8a7f3268 Author: Coen Warmer Date: Tue Aug 15 17:29:33 2023 +0200 Hide Feedback buttons for now commit 6446dbf7926a6aa2a947b9f47fe91fa617a6ff79 Author: Coen Warmer Date: Tue Aug 15 17:28:52 2023 +0200 Add TechPreview Badge commit e500731eb3de17849413f75b7042fc0066c0d454 Author: Coen Warmer Date: Tue Aug 15 16:25:53 2023 +0200 Handle case where function responses don't return JSON commit 18f6a1057fd9328423eb4ecf01ba9a864801f7af Author: Coen Warmer Date: Tue Aug 15 16:23:29 2023 +0200 Fix bug in FunctionListPopover where it would not update list of functions commit df577b202d6dfc2f4de8956d607ec58916b0bacb Author: Coen Warmer Date: Tue Aug 15 16:22:48 2023 +0200 Styling tweaks for Conversation View commit d7afa9c38df478f4a35a3423088e7776a68e4869 Author: Coen Warmer Date: Tue Aug 15 16:21:35 2023 +0200 Add translatable descriptionForUser's for APM functions commit 54301ca105b914f7a731c12e457e6b94762a13e0 Merge: 4474daf6b61 fff489b3ac6 Author: Coen Warmer Date: Tue Aug 15 13:06:25 2023 +0200 Merge pull request #43 from CoenWarmer/storybook commit fff489b3ac6ea190a8d393d866b4fdc96dace250 Author: Coen Warmer Date: Tue Aug 15 13:04:27 2023 +0200 Fixes for InlineText component commit 4474daf6b61158607707b07884e9ce28f51dc3c9 Merge: c50ded12126 bd6d65591a5 Author: Dario Gieselaar Date: Mon Aug 14 20:19:36 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit c50ded12126a00174f22425c1ec684cb935cb6a0 Author: Dario Gieselaar Date: Mon Aug 14 20:16:40 2023 +0200 Add environments to get_apm_service_summary commit 34620403e510e1a46c6c0ac6557f3d1ba2c1b486 Merge: 2799ccb31c0 f823c2e1aac Author: Coen Warmer Date: Mon Aug 14 17:00:09 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 2799ccb31c063d2ff09ddba8065c4480392e57fc Author: Coen Warmer Date: Mon Aug 14 16:57:43 2023 +0200 Editing of conversation titles by user commit f823c2e1aac865a7fe14e1b47c8a086418395c3f Author: Dario Gieselaar Date: Mon Aug 14 16:53:14 2023 +0200 Remove duplicate files commit 483e1fb033d99946b9654a268a0e31ef51a136dc Author: Dario Gieselaar Date: Mon Aug 14 16:43:36 2023 +0200 Undo changes in infra commit d0039e5a8c0b0e6e818d281cc8d761ddf64fe7ee Merge: c1722b46f86 312b2542665 Author: Dario Gieselaar Date: Mon Aug 14 16:37:03 2023 +0200 Merge remote-tracking branch 'upstream/main' into obs-ai-assistant-2 commit 2160a6c46dc8ffe75c30e0591ef995cc82fbd9e1 Merge: 849439d2b2b c1722b46f86 Author: Coen Warmer Date: Mon Aug 14 11:34:19 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 849439d2b2baeee7c9caf340daba83e96e63d8e7 Author: Coen Warmer Date: Mon Aug 14 11:34:14 2023 +0200 Remove extraneous prop commit c1722b46f864bf999bcc54dede421512d9dd416d Author: Dario Gieselaar Date: Mon Aug 14 11:33:44 2023 +0200 Make it stick commit fdeff07f07723c9db0263245199b0c7e571066bf Author: Dario Gieselaar Date: Mon Aug 14 11:23:28 2023 +0200 Fix type checks commit 42a623df5b6c1f82bc59e96ce4f46980bb62efb8 Merge: 352395c45dd 98d981da420 Author: Coen Warmer Date: Mon Aug 14 11:08:23 2023 +0200 Merge pull request #41 from CoenWarmer/storybook commit 98d981da42015013e4a5e2b2a9f5b06e59bef5a9 Merge: ceba8dad888 352395c45dd Author: Coen Warmer Date: Mon Aug 14 11:07:32 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit ceba8dad888609563d5b7659bbf7ec74d1aab409 Author: Coen Warmer Date: Mon Aug 14 11:02:24 2023 +0200 Remove ObsAiAssistant interface commit b41d0dc5461d0287aa303b43b0dad2ee6bab27a1 Author: Coen Warmer Date: Mon Aug 14 11:02:07 2023 +0200 Set Conversationlist width to 250 commit 3920c0fe2aa5dd3e4ecca74b587124633b2b81c8 Author: Coen Warmer Date: Mon Aug 14 10:54:19 2023 +0200 Add focus to functionlist on opening commit 352395c45dd5f79bcae2c55d37e25aa9328cf45e Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Aug 14 07:49:56 2023 +0000 [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' commit 6faba281a3b82f616d5e76475cd37a36367ba6f6 Author: Dario Gieselaar Date: Mon Aug 14 09:44:22 2023 +0200 Remove debugging artifact commit c4529b7876e5b3ffff514b26f804b3fabe02fb15 Author: Dario Gieselaar Date: Mon Aug 14 09:40:28 2023 +0200 Only load APM functions if APM data is available commit cdfcad0afcd29e834c5d7128667e882b28f7e982 Author: Dario Gieselaar Date: Mon Aug 14 08:58:05 2023 +0200 Fix tests commit ac636b4508752d7d404368b20f4967429dda3783 Author: Dario Gieselaar Date: Sun Aug 13 21:20:27 2023 +0200 Make chat stick to the bottom commit e3c3dfda981b662c675d5e2e876ba7757633c586 Author: Dario Gieselaar Date: Sun Aug 13 20:58:36 2023 +0200 Don't allow submit when message is still loading, remove $ shortcut commit cc1604aed13ce7520d8f11cb647b47f1ce457d26 Author: Dario Gieselaar Date: Sun Aug 13 20:43:02 2023 +0200 Fix loaders for conversation/incoming message commit d1e64caf3cc011ff3d86d87ee7e3a89a445c6e4e Author: Dario Gieselaar Date: Sun Aug 13 19:54:13 2023 +0200 Change location of docs commit e74f9a66ec4719bc34b0bd8ebb4c54b9ee49704b Author: Dario Gieselaar Date: Sun Aug 13 19:20:59 2023 +0200 Remove console.log statement commit b120293a82fcb069b3269779bd19833a2bc386b4 Author: Dario Gieselaar Date: Sun Aug 13 13:17:41 2023 +0200 Lens function (#42) Co-authored-by: Carlos Crespo Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alejandro Fernández Haro commit 1909c0f9000a46d82c966f411fd32344c04116c7 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun Aug 13 06:14:04 2023 +0000 [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' commit ca5fb154f191fa0d8405a75c9d83734b7f798867 Author: Dario Gieselaar Date: Sun Aug 13 07:41:58 2023 +0200 Handle token limit reached errors commit 67e04ce206e3b7a9250050f68eff45fb00542eee Author: Dario Gieselaar Date: Sat Aug 12 20:17:06 2023 +0200 Make sure error message is displayed if response fails commit 75322df743aa0cb6e7d41bd578477458728b48f0 Merge: 11271c840c2 27b7c7a0cc0 Author: Dario Gieselaar Date: Sat Aug 12 19:51:36 2023 +0200 Merge branch 'response-body-error' into obs-ai-assistant-2 commit 27b7c7a0cc01e9842661f376f6823a5a3a470502 Author: Dario Gieselaar Date: Sat Aug 12 19:49:08 2023 +0200 Wrap JSON.parse in try/catch, add API test commit bb84bd505f88f45356415eb54e82aa7d76ab4171 Merge: c69880b0e6d b336a195e03 Author: Dario Gieselaar Date: Sat Aug 12 19:21:53 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into response-body-error commit 11271c840c2eede6e34755822c4577258e830b1b Author: Dario Gieselaar Date: Sat Aug 12 09:43:18 2023 +0200 Increase limit for Observability AI Assistant bundle commit 7acb20a326da91954bf776b000a757c3f270ab2e Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sat Aug 12 06:54:50 2023 +0000 [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' commit 62642c5ddfbe2807e0d0c1f96953f4bf99ee3258 Author: Dario Gieselaar Date: Sat Aug 12 08:49:17 2023 +0200 Lazily load APM functions commit 0b52e4a76c4a375d38f4306b34eb6f0ab3a2a5a8 Author: Dario Gieselaar Date: Sat Aug 12 08:42:14 2023 +0200 Fix APM API test commit 4551e4c4f90e1481fd7b98325ecc20a59727ee9b Merge: c9dbbcecbd2 b336a195e03 Author: Dario Gieselaar Date: Sat Aug 12 08:27:20 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit c45fd1d80ec094d5e0ec111e5cab56d3573f9d92 Author: Coen Warmer Date: Sat Aug 12 02:28:12 2023 +0200 Add filtering to function list commit 133d6b975689401f16e470763233e261f8d8a301 Author: Coen Warmer Date: Fri Aug 11 22:21:29 2023 +0200 Add autotitling of conversations commit c9dbbcecbd2f0fdaef9df75c91c88c91597f8a40 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri Aug 11 11:17:36 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit aaeb5eb30b779e378cf23650c58fcc503b3db18a Merge: 5128c048603 e3a5fd86ca6 Author: Coen Warmer Date: Fri Aug 11 13:12:09 2023 +0200 Merge pull request #40 from CoenWarmer/storybook commit e3a5fd86ca6bf03879f2724e625067257fbaf33f Author: Coen Warmer Date: Fri Aug 11 13:09:02 2023 +0200 Tweaking the timeline commit 5128c048603bba8d1be6318376fe0bd7d6bf3f1b Author: Dario Gieselaar Date: Thu Aug 10 22:12:32 2023 +0200 Don't mix up current and previous function_call commit d7181e6f06e182f182aa911023320a91e49c4e21 Merge: 010a31e73ac 87971165446 Author: Dario Gieselaar Date: Thu Aug 10 21:47:04 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 010a31e73acc2889254e69e60a6b2645835253b2 Author: Dario Gieselaar Date: Thu Aug 10 21:42:09 2023 +0200 i18n fix commit 879711654460d274a676771d053c0523dbef2ec7 Author: Dario Gieselaar Date: Thu Aug 10 21:25:01 2023 +0200 Timeline fixes (#39) commit ca13be0803e88882edcdbc693353d9a5daf1cab4 Merge: 4fc43195dad 47022b6a62a Author: Dario Gieselaar Date: Thu Aug 10 20:17:45 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 4fc43195dad7cc3461784718b17c0cc02ebcf069 Merge: b5365e2af16 76d25d0d540 Author: Dario Gieselaar Date: Thu Aug 10 20:15:53 2023 +0200 Merge branch 'obs-ai-assistant-action' into obs-ai-assistant-2 commit 47022b6a62a9252661efbec8bebad818042b2d38 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Aug 10 18:15:12 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 76d25d0d54067447dc6006d0ac0930e545736895 Merge: 58f9a6c367b 457a14de736 Author: Dario Gieselaar Date: Thu Aug 10 20:13:44 2023 +0200 Merge branch 'obs-ai-assistant-action' of github.com:dgieselaar/kibana into obs-ai-assistant-action commit 58f9a6c367bd372dbb32b667e36f9d5299a6f607 Merge: 705232d5706 a8f3a5ac8ce Author: Dario Gieselaar Date: Thu Aug 10 20:13:30 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-action commit b5365e2af16d9220f33532375cec07b806a3ebe2 Author: Dario Gieselaar Date: Thu Aug 10 20:06:35 2023 +0200 Other APM functions (#38) commit 457a14de7368ccc5dce405a8292bde345a484fcc Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Aug 10 17:03:03 2023 +0000 [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' commit d9a8802d8b18e8ed5f6c0878fa9d68c6e064d3c5 Author: Dario Gieselaar Date: Thu Aug 10 18:58:20 2023 +0200 Move chat logic into separate service (#37) commit 86f9efcc6ec57e8cf37ed7a51b95be1d93636168 Author: Dario Gieselaar Date: Thu Aug 10 18:57:08 2023 +0200 Update x-pack/plugins/observability/public/plugin.ts commit 798a2b7e6e55876902197929efc458bb1d582bb7 Merge: 668b2ba5cbb 90dc879eaaa Author: Dario Gieselaar Date: Thu Aug 10 18:13:31 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 90dc879eaaa44a6e3748bbb5e7b037a6400fa655 Merge: 797cdb8e942 f7ce6a7ff9c Author: Coen Warmer Date: Thu Aug 10 17:43:50 2023 +0200 Merge pull request #36 from CoenWarmer/storybook commit f7ce6a7ff9cd7ab38438d4dbbe253b82d547dad5 Author: Coen Warmer Date: Thu Aug 10 16:55:22 2023 +0200 Tweaking the timeline commit 797cdb8e942f3531504fca81b32155d9b3e69cbf Merge: 6e54fabe4bd f53df04d12b Author: Coen Warmer Date: Thu Aug 10 14:24:18 2023 +0200 Merge pull request #35 from CoenWarmer/storybook commit f53df04d12bce48941f14c105eac792af28e73b4 Author: Coen Warmer Date: Thu Aug 10 14:21:54 2023 +0200 Cleanup commit 668b2ba5cbbb88436203ef6170b7533ae8f656f8 Merge: 6e54fabe4bd 5c57df27ed4 Author: Dario Gieselaar Date: Thu Aug 10 10:41:00 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 6e54fabe4bd637a0b2ee4a3766a556db975ae065 Merge: a5348a40a34 24bf9cccd19 Author: Coen Warmer Date: Wed Aug 9 23:55:38 2023 +0200 Merge pull request #34 from CoenWarmer/storybook commit 24bf9cccd19011663afb00152b2bdea251ffe52d Author: Coen Warmer Date: Wed Aug 9 23:51:55 2023 +0200 Add better handling of initializing function code prompt according to schema commit 119ffcddc7e3e1464dfa575fef0557bbc396f203 Author: Coen Warmer Date: Wed Aug 9 14:22:46 2023 +0200 Fix error state for knowledge base setup commit 705232d5706a0f5a180b126be677e19ae40ddec4 Author: Dario Gieselaar Date: Wed Aug 9 13:56:10 2023 +0200 Fix unit tests commit 9000adcab643d65041e96d43a5d541ff4051389a Merge: 47c82260eab 4fc9906c172 Author: Dario Gieselaar Date: Wed Aug 9 13:27:40 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-action commit c9c923a0bb9bdfc37c5fa1aa5f8f3942974fa30a Author: Coen Warmer Date: Wed Aug 9 13:04:54 2023 +0200 Fix typescript error commit a5348a40a3470541f1a994a4c910cee8648347c3 Merge: 6ed3c938642 3afd23344a9 Author: Coen Warmer Date: Wed Aug 9 13:03:39 2023 +0200 Merge pull request #32 from CoenWarmer/storybook commit 3afd23344a936ae2f017baacb32d4ab64e565434 Merge: 3d8a6603eef 6ed3c938642 Author: Coen Warmer Date: Wed Aug 9 12:58:00 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 6ed3c938642997b80e3963924e413bd0f36ad40b Merge: c364bdcd316 01ee26a1ac2 Author: Coen Warmer Date: Wed Aug 9 12:40:26 2023 +0200 Merge pull request #33 from dgieselaar/obs-ai-assistant-kb-callout commit 01ee26a1ac2f501eb9a645329b8983eaf368699a Author: Dario Gieselaar Date: Wed Aug 9 11:45:27 2023 +0200 [Observability AI Assistant] Check/install knowledge base via callout commit 47c82260eab1e03136a044655de17fb66e26a039 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Aug 9 08:05:40 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 2e78093d05102db3696010bf89af4fbfa8d984d2 Merge: 0c7a2bce2d8 c0c827009bb Author: Dario Gieselaar Date: Wed Aug 9 09:58:46 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-action commit 0c7a2bce2d8bfacedfdeb6d14fa7c4b6aa476584 Merge: ffa972cc0b7 d26aafc5cb2 Author: Dario Gieselaar Date: Wed Aug 9 09:54:56 2023 +0200 Merge branch 'obs-ai-assistant-chat' into obs-ai-assistant-action commit c364bdcd316a61f3fe8f8595f24658e22ea6d530 Author: Dario Gieselaar Date: Wed Aug 9 09:17:45 2023 +0200 Fix tests and type check commit cd3cadfa9554dd43633c25090103c010b3a256be Merge: 64bf64f2d3d a307f224e30 Author: Dario Gieselaar Date: Wed Aug 9 08:52:16 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 64bf64f2d3dd6975b9916aafedbb8dbd8ca3d4e3 Merge: 62a646e0fa2 e3e0558aa43 Author: Dario Gieselaar Date: Wed Aug 9 08:50:51 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 62a646e0fa245c750cba6c88443b7834d065cd45 Merge: 79f84366a92 d26aafc5cb2 Author: Dario Gieselaar Date: Wed Aug 9 08:48:40 2023 +0200 Merge branch 'obs-ai-assistant-chat' into obs-ai-assistant-2 commit 3d8a6603eef25bf63e4ac83d8ba1a4f619e3a487 Author: Coen Warmer Date: Tue Aug 8 23:40:42 2023 +0200 Add editing of prompts commit a307f224e307dd649d4a65e79549566dfadb2c82 Merge: 79f84366a92 d2452727baf Author: Coen Warmer Date: Tue Aug 8 22:40:45 2023 +0200 Merge pull request #31 from CoenWarmer/storybook commit d2452727baf99c68998da50f399290de3ab943f4 Author: Coen Warmer Date: Tue Aug 8 22:38:13 2023 +0200 Cleanup commit a803ec785609f768a23c859a52dbe25aa4055502 Merge: 544a4e732eb 79f84366a92 Author: Coen Warmer Date: Tue Aug 8 19:11:08 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 79f84366a92e899b32c3fa2c4fdfc8904381ccbb Merge: 7f418893dc1 a778f3654df Author: Coen Warmer Date: Tue Aug 8 18:45:26 2023 +0200 Merge pull request #30 from CoenWarmer/storybook commit 544a4e732eb137f585f3ad59e6c9f575a3da8474 Merge: a778f3654df 7f418893dc1 Author: Coen Warmer Date: Tue Aug 8 17:28:21 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit a778f3654df42eb617593d4a3d60db18cc2df871 Author: Coen Warmer Date: Tue Aug 8 17:27:37 2023 +0200 Add InlinePrompt Editor, clean up Timeline commit 7f418893dc10aaa718c9155364a0acee5af0a9e0 Author: Dario Gieselaar Date: Tue Aug 8 13:00:28 2023 +0200 Fix scrolling, linebreak after submit commit 333dd599971e178d78329f0098a8f6c7b2c42746 Merge: 6d48a9c5dad 038c8f3ab02 Author: Dario Gieselaar Date: Tue Aug 8 12:42:29 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 038c8f3ab02023970e7cb97037cde7766735ced7 Merge: 533d6d91fe8 e8b852641e2 Author: Coen Warmer Date: Tue Aug 8 12:39:11 2023 +0200 Merge pull request #29 from CoenWarmer/storybook commit e8b852641e24d6c50ddf15e447d89f7ee46b6e92 Author: Coen Warmer Date: Tue Aug 8 12:37:48 2023 +0200 Add to init script that the Assistant should check with the user if data might be mutated commit 6d48a9c5dad5ec2e63462dbb103565b686eed86d Merge: 1a5fe1b1453 f4e62c1c74d Author: Dario Gieselaar Date: Tue Aug 8 12:34:12 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit d26aafc5cb2195902c7340029c4f50a91bbd89bc Author: Dario Gieselaar Date: Tue Aug 8 12:10:48 2023 +0200 Update oss_plugins.json commit 533d6d91fe86463bbc4210bc56584883ee9f2327 Merge: 1a5fe1b1453 9915344b460 Author: Coen Warmer Date: Tue Aug 8 12:05:14 2023 +0200 Merge pull request #28 from CoenWarmer/storybook commit 9915344b460cb24b5641b0922c018b6773a10079 Author: Coen Warmer Date: Tue Aug 8 12:03:58 2023 +0200 Fix for event handler commit 1a5fe1b1453cc2b7c0f70e5b59c79edf2b1c6c7e Merge: 165afcc11f8 3063d8a33dd Author: Coen Warmer Date: Tue Aug 8 11:58:12 2023 +0200 Merge pull request #27 from CoenWarmer/storybook commit aefd5ebfa49c87211e226e5c4f38f88fe5053234 Author: Dario Gieselaar Date: Tue Aug 8 11:53:16 2023 +0200 Add application key commit 3063d8a33dddec05623d235bc24cc4f5d1f13ad4 Author: Coen Warmer Date: Tue Aug 8 10:49:39 2023 +0200 Replace Inputfield with Textarea, and make it resize commit 48397909e6501a9ed5f710178e47a5cbd78a3a39 Merge: bf9f19357df 5a6c5fb4d33 Author: Dario Gieselaar Date: Tue Aug 8 09:11:15 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-chat commit bf9f19357df849e5d7249e4bffd595f71efeb9de Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue Aug 8 06:22:33 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 165afcc11f86243de0f03f6d8eb78bf0605401fc Merge: 761133aec5b 45832d6f02a Author: Dario Gieselaar Date: Tue Aug 8 08:17:11 2023 +0200 Merge branch 'obs-ai-assistant-chat' into obs-ai-assistant-2 commit 45832d6f02a4da192e878176650c6f6d51018078 Author: Dario Gieselaar Date: Tue Aug 8 08:16:58 2023 +0200 newline in package.json commit 761133aec5b0e93c3b1a0a826c97cdb8a22a860b Merge: 6842c0e1ced 1a5bf2236fd Author: Dario Gieselaar Date: Tue Aug 8 08:09:50 2023 +0200 Merge branch 'obs-ai-assistant-chat' into obs-ai-assistant-2 commit 1a5bf2236fd7ee69cf40888f12cc9a1975b71eb1 Merge: 20a93c6c90d 0627686500b Author: Dario Gieselaar Date: Tue Aug 8 08:08:01 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-chat commit c69880b0e6d96a1dc630feb9e4ea9d7267ebfbde Merge: 3cbb20c9000 4d8bf22d79b Author: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Aug 7 09:40:50 2023 -0400 Merge branch 'main' into response-body-error commit 6842c0e1ced97563187ad3fbb9d00125f1498aaa Merge: 53bdc911568 4d8bf22d79b Author: Dario Gieselaar Date: Mon Aug 7 15:34:05 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 53bdc911568b2e871387ff6e8f270bc5f258e5a6 Author: Dario Gieselaar Date: Mon Aug 7 15:01:04 2023 +0200 Remove console.log statement commit 25008f06d9623406565a313df20290750f2f4c2d Author: Dario Gieselaar Date: Mon Aug 7 14:50:35 2023 +0200 Show collapsible content for function suggestions commit 3cc860509050a3c9bf7ff4dc940edbabd1553557 Merge: bcab7788337 607787ed038 Author: Coen Warmer Date: Mon Aug 7 14:25:19 2023 +0200 Merge pull request #26 from CoenWarmer/storybook commit 607787ed03899b29ba3634f2f691c3af817c1c01 Author: Coen Warmer Date: Mon Aug 7 14:20:34 2023 +0200 Add human readable description for functions commit bcab7788337f1bd69d3f97e2909eae3cc38c18da Merge: c06351fa942 4f1d5ccfa8b Author: Coen Warmer Date: Mon Aug 7 14:14:14 2023 +0200 Merge pull request #23 from CoenWarmer/storybook commit 4f1d5ccfa8bdc49c1462b25dda6b5b1f43f8111f Merge: 7281ded33de c06351fa942 Author: Coen Warmer Date: Mon Aug 7 14:13:42 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 7281ded33de315918532df4e90f57719aeb0a990 Author: Coen Warmer Date: Mon Aug 7 14:12:59 2023 +0200 Added visualisation for Elasticsearch function commit c06351fa942db0220f854841d5f1278f1ab2ef5a Author: Dario Gieselaar Date: Mon Aug 7 14:08:40 2023 +0200 Remove Lens function commit f13901e7e54f76a15d21062a4731159c505802d4 Merge: bde017094d8 33b96bc783e Author: Coen Warmer Date: Mon Aug 7 13:26:33 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit bde017094d85e60ea7310f445a5b1fc4d2fdd234 Merge: bd7d8527566 3471c80e0f5 Author: Coen Warmer Date: Mon Aug 7 13:26:26 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 33b96bc783e83992aa9023868e5516d75066360b Author: Dario Gieselaar Date: Mon Aug 7 13:26:07 2023 +0200 Only wrap render functions in EuiErrorBoundary commit bd7d8527566943b8fbfc46fa7ff82aec9d672c22 Author: Coen Warmer Date: Mon Aug 7 13:18:22 2023 +0200 Assorted fixes commit 3471c80e0f5341c85c8a4ecf9deac9cbfe0e677f Author: Dario Gieselaar Date: Mon Aug 7 13:17:36 2023 +0200 RenderFunction component commit 8870548dba6656d65d047269912be25fd13c6221 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Aug 7 11:03:34 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit f9d7f8a5d7b98fd708cee5625e140bac4ffdff73 Merge: 33eb4cb5f68 708bc789504 Author: Coen Warmer Date: Mon Aug 7 13:02:21 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 708bc7895040a4dfc921e0ce3bf5374d1108933d Merge: b4711aadede b2d52e89cdd Author: Dario Gieselaar Date: Mon Aug 7 12:57:08 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit b4711aadede3bdf50569b5dc2d85e77605bb8c56 Author: Dario Gieselaar Date: Mon Aug 7 12:57:02 2023 +0200 Render functions in chat commit 33eb4cb5f68640a430aefcaf06e43928eaf5726e Merge: 0ac0c7be4d1 ffa972cc0b7 Author: Coen Warmer Date: Mon Aug 7 12:55:45 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit b2d52e89cddee9cbff9411305150cb6aa9cade69 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Aug 7 10:47:05 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 0ac0c7be4d14c19269c26df38274daccc9e51fa3 Merge: 98a9840ab0c 4d60bfcae1f Author: Coen Warmer Date: Mon Aug 7 11:04:30 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 98a9840ab0cfd83f2b3ee86a9ef00e98117c0434 Author: Coen Warmer Date: Mon Aug 7 11:01:03 2023 +0200 Assorted fixes commit ffa972cc0b7489466112c557faebfd2f9feaa006 Author: Dario Gieselaar Date: Sun Aug 6 19:38:33 2023 +0200 Add assistant button everywhere in Observability commit 85bc1e6640b7d9f08968449d6f7423ff73c49d7a Author: Dario Gieselaar Date: Sun Aug 6 18:20:04 2023 +0200 [Observability AI Assistant] Action menu item commit 20a93c6c90d9e4fda914a5cdca02a7a0aaff1629 Merge: 83030fa1233 4d60bfcae1f Author: Dario Gieselaar Date: Sun Aug 6 14:34:42 2023 +0200 Merge branch 'obs-ai-assistant-2' into obs-ai-assistant-chat commit 4d60bfcae1fcab5e49d1c152fc16700e9d02c47e Author: Dario Gieselaar Date: Sun Aug 6 14:34:29 2023 +0200 Fix i18n typos commit 83030fa1233a07cf3d7340195dca7e5d4a6f6d91 Merge: 980e69c5e3a 7d94c7b471e Author: Dario Gieselaar Date: Sun Aug 6 14:30:29 2023 +0200 Merge branch 'obs-ai-assistant-chat' of github.com:dgieselaar/kibana into obs-ai-assistant-chat commit 980e69c5e3a74247cc41c983bdade82cc456ad72 Author: Dario Gieselaar Date: Sun Aug 6 14:29:36 2023 +0200 Allow request bodies for elasticsearch function commit e311aef924391c2b2bd36e171cdb35df8b789e8d Author: Dario Gieselaar Date: Sun Aug 6 14:05:06 2023 +0200 Prevent cursor animation from being unmounted and reset commit 9d32168ee2a1429979ef301ec8607f30e994f540 Merge: 64638b15008 ac3c2334963 Author: Dario Gieselaar Date: Sun Aug 6 11:18:16 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 7d94c7b471ed43504a57bc10dc1b83a4c455fa1a Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun Aug 6 09:17:35 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit ac3c23349634910b93d0fad0e970a88992af25e9 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun Aug 6 09:15:18 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 64638b15008ab89bafac18773d08238273dda1f5 Merge: b8cd8ed40f0 fb84bcda3e3 Author: Dario Gieselaar Date: Sun Aug 6 11:10:52 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit b8cd8ed40f0098b595c2b0987ffdea575ec3f617 Author: Dario Gieselaar Date: Sun Aug 6 11:09:30 2023 +0200 [Observability AI Assistant] Persist conversations (#24) commit f89ee929c27272723a50c38cde047407172fce93 Merge: 3c8b9f4ee39 786b7056f83 Author: Coen Warmer Date: Fri Aug 4 11:42:53 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 3c8b9f4ee39b6a42dd58dfceeab57d40d48e008d Author: Coen Warmer Date: Fri Aug 4 11:36:36 2023 +0200 Add actions commit 786b7056f83361e9d9ebefe7bd26d7d63164a49f Author: Dario Gieselaar Date: Fri Aug 4 09:59:27 2023 +0200 code block styling & improved system prompt commit 7b3be9375e5b98a73e040924dec51eb4f3dd0c5b Author: Dario Gieselaar Date: Thu Aug 3 15:24:20 2023 +0200 Fix type errors commit 9847ee6416db07779cd1dfe3794423ab8ab759d9 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Aug 3 11:40:54 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 3cbb20c9000eead512905a4e8fbdf2527f910a09 Author: Dario Gieselaar Date: Thu Aug 3 13:38:51 2023 +0200 Make sure config is optional commit 24164ccb62b3e1fe648d26131fd25c07ee54437d Merge: 8a36834cabb fcfabcdcd10 Author: Dario Gieselaar Date: Thu Aug 3 13:36:57 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into response-body-error commit 006e1d62385f3a879d7e207178cfdf16a580aea3 Author: Dario Gieselaar Date: Thu Aug 3 13:34:25 2023 +0200 [Observability AI Assistant]: Summarise & recall (#22) commit ff5ffc2d3868bc8bca70444e6388e174a8bee4ea Merge: 0496387e58d 41b0df594a3 Author: Coen Warmer Date: Thu Aug 3 10:22:47 2023 +0200 Merge pull request #21 from CoenWarmer/storybook commit 41b0df594a345753af645dbf000c5e97d91dc5ce Author: Coen Warmer Date: Thu Aug 3 10:21:32 2023 +0200 Assorted tweaks commit 0496387e58dc92c486bf1e7eb5d3d685928d95ce Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Aug 2 19:18:06 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit fcf22d4dd27abbc635dd763f3b57c4e4ecd16156 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Aug 2 19:11:11 2023 +0000 [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' commit fa10b50f2aa00802da10d33080250f7db6b7a1bf Merge: da6fdbddba6 a28a5db2985 Author: Coen Warmer Date: Wed Aug 2 21:05:53 2023 +0200 Merge pull request #20 from CoenWarmer/storybook commit a28a5db2985465e4c6c848e3ae12230c27f5376e Author: Coen Warmer Date: Wed Aug 2 21:03:07 2023 +0200 Add onFocus handler and Keyboard handler to Chat Prompt Editor commit bcb7fcd5a256b62ae85ae31c0b2223f0f14f3a3b Merge: 17382cad18c da6fdbddba6 Author: Coen Warmer Date: Wed Aug 2 18:22:45 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into storybook commit 17382cad18ca1c3ceb2d1b0984401f96cc09fc05 Author: Coen Warmer Date: Wed Aug 2 18:14:00 2023 +0200 Listen for shift and 4 to trigger functionList commit da6fdbddba674cddecc7d327555615c018ae6e8d Author: Dario Gieselaar Date: Wed Aug 2 18:09:06 2023 +0200 Small UX fixes commit 198cc21161ad937de04d5884428bc7ae3e230bc2 Author: Coen Warmer Date: Wed Aug 2 16:13:20 2023 +0200 Add JSON schema validation for Prompt Editor commit 61f74765457d646b628a0e6f73b98a6ba1a60aa0 Merge: d5288d12cad 2ab673f3e58 Author: Dario Gieselaar Date: Wed Aug 2 14:44:32 2023 +0200 Merge branch 'obs-ai-assistant-chat' into obs-ai-assistant-2 commit d5288d12cadd3283574431584692d9b8dc423cb6 Author: Dario Gieselaar Date: Wed Aug 2 14:33:39 2023 +0200 Function states commit 2ab673f3e5872d9a92a675ba1c146eb08c5ba5d5 Author: Dario Gieselaar Date: Tue Aug 1 17:07:13 2023 +0200 Undo change in sub_action_connector commit f1426b635fa977eba42711bf2cd33dc9dfa02b74 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue Aug 1 15:08:55 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 8a36834cabb403edfa22004b8ff888d09a1e7980 Author: Dario Gieselaar Date: Tue Aug 1 17:08:49 2023 +0200 [Connectors] await response body when streaming sub action fails commit c042a9c912f2905ceff1cd3edc9d3a9efb28a280 Merge: b63e3f30f68 302e6075fa4 Author: Dario Gieselaar Date: Tue Aug 1 17:01:20 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-chat commit b63e3f30f687c4568a5b313616251712fce1860f Author: Dario Gieselaar Date: Tue Aug 1 16:59:56 2023 +0200 [Observability AI Assistant]: Function registry (#19) commit 2b757713685e0c9a22cbe3c955890f199f4c14ad Merge: b0615791afc 6cf0b70405e Author: Coen Warmer Date: Tue Aug 1 10:09:23 2023 +0200 Merge pull request #18 from CoenWarmer/storybook commit 6cf0b70405e13f70116193651af801aa1983ea69 Author: Coen Warmer Date: Mon Jul 31 17:34:51 2023 +0200 Add ConversationList commit 59ebcdf688b725b7e3b21fe3b4d1db36cd6d6167 Author: Clint Andrew Hall Date: Sat Jul 29 22:19:43 2023 -0400 [regression] Fix Storybooks after #161914 commit b0615791afcf60c9a600ae410efdfc2e6ce949a0 Author: Dario Gieselaar Date: Sun Jul 30 19:45:06 2023 +0200 Don't render cursor placeholder for code blocks commit bc8ade212e1871f26ec90b03dfecb837dec7e887 Merge: a2f85c64e5f ca0a9bd5054 Author: Dario Gieselaar Date: Sun Jul 30 18:58:06 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit a2f85c64e5f8174aae3967d4aa966c92c3625fa4 Merge: bcbda067e3f e530dc599cd Author: Dario Gieselaar Date: Sun Jul 30 18:57:54 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit bcbda067e3f3ef3dec8877caca4c508481433513 Author: Dario Gieselaar Date: Sun Jul 30 18:57:52 2023 +0200 Remove unused variable commit ca0a9bd5054b76fd3931859207a1e3d9af5c0e43 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun Jul 30 16:09:32 2023 +0000 [CI] Auto-commit changed files from 'node scripts/generate codeowners' commit f9723f372e6a15636ffbffe63bce0ec40459f4c0 Author: Dario Gieselaar Date: Sun Jul 30 18:02:30 2023 +0200 Update CODEOWNERS commit 745d7eee8f5a4d017f033572dff54e027d8aae8a Author: Dario Gieselaar Date: Sun Jul 30 16:05:41 2023 +0200 [Observability AI Assistant] Create chat (#17) commit 74422f92ff3be3d475527bc5e2320490a676274f Merge: c5a2e92dce7 50c1c18d604 Author: Dario Gieselaar Date: Sat Jul 29 10:14:39 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit c5a2e92dce7f86d7cf1f862cb22773e8a95d875d Merge: d2754bf040d 477505a2dd8 Author: Dario Gieselaar Date: Sat Jul 29 10:14:25 2023 +0200 Merge remote-tracking branch 'upstream/main' into obs-ai-assistant-2 commit 50c1c18d6041cebd4e37e86169b5a38dfe8dba63 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Jul 27 06:43:00 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit d2754bf040d5adf857f329736e711393f17a181a Merge: db42d294f72 8b715800bcf Author: Dario Gieselaar Date: Thu Jul 27 08:36:38 2023 +0200 Merge pull request #16 from dgieselaar/abort-and-regenerate-responses commit db42d294f7256f857b086c5c2e3988476f9e8252 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Jul 27 05:46:34 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 8b715800bcfeccecc6d59aa04a12d408e286179e Merge: ca8a5768185 182994e0d80 Author: Dario Gieselaar Date: Thu Jul 27 07:43:00 2023 +0200 Merge branch 'obs-ai-assistant-2' into abort-and-regenerate-responses commit 182994e0d80a1e4e34c82fafdbbc19fb9f5db077 Merge: 1ff7e3e0981 983416320ac Author: Dario Gieselaar Date: Thu Jul 27 07:40:48 2023 +0200 Merge branch 'obs-ai-assistant' into obs-ai-assistant-2 commit 983416320acc465ef959dd71750a9e66f00e4972 Merge: c8e83e77fcd 682c772e098 Author: Dario Gieselaar Date: Thu Jul 27 07:40:22 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant commit 1ff7e3e098148e52b99c8b85bd91a257334f0e18 Merge: d72a3355b4d 682c772e098 Author: Dario Gieselaar Date: Thu Jul 27 07:38:41 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit d72a3355b4dde0b4b5b5993fbfe4b598753e3a10 Merge: 10184b52689 8e734ed00d6 Author: Dario Gieselaar Date: Thu Jul 27 07:38:30 2023 +0200 Merge branch 'obs-ai-assistant-2' of github.com:dgieselaar/kibana into obs-ai-assistant-2 commit 8e734ed00d6830820cf5f5e7e97f394adbbff0f1 Merge: 4cd509b7791 9cb93794a60 Author: Coen Warmer Date: Wed Jul 26 23:02:09 2023 +0200 Merge pull request #15 from CoenWarmer/storybook commit 9cb93794a607b9a9d1104968a593a8de52f21812 Author: Coen Warmer Date: Wed Jul 26 22:59:20 2023 +0200 Add builder for Conversation, update Stories commit 10184b526892157d33f8f3ca55cf7597b90822bd Merge: 4cd509b7791 4654a5244de Author: Dario Gieselaar Date: Wed Jul 26 20:43:46 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 4cd509b779135b88137621e571aed7e0bc7949dd Merge: 11a3b34b267 a6501252e0d Author: Dario Gieselaar Date: Wed Jul 26 16:44:55 2023 +0200 Merge pull request #14 from dgieselaar/obs-ai-assistant-conversation-page commit a6501252e0de435ac93b34677a2ce93a59d76822 Author: Dario Gieselaar Date: Wed Jul 26 16:37:51 2023 +0200 Add prompt form field and connectors commit d5dcfc13f5edd108b47479bff9ebb46652174230 Merge: 3de9a1f6012 11a3b34b267 Author: Dario Gieselaar Date: Wed Jul 26 14:47:28 2023 +0200 Merge branch 'obs-ai-assistant-2' into obs-ai-assistant-conversation-page commit 11a3b34b267afac5d031520cbacc0e52afdfba83 Merge: 22b35d62d0c ad542d01882 Author: Dario Gieselaar Date: Wed Jul 26 14:47:10 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant-2 commit 3de9a1f6012494f24cb88937bced71683e65fb8b Author: Dario Gieselaar Date: Wed Jul 26 14:46:07 2023 +0200 Conversation page commit 22b35d62d0c014aafc5337503d0ec8af57602f8b Author: Dario Gieselaar Date: Wed Jul 26 12:30:29 2023 +0200 Padding for controls commit ef0deeabbee3aab4547725829f1404b33b2c4951 Merge: 491006051e4 c8e83e77fcd Author: Dario Gieselaar Date: Wed Jul 26 12:18:21 2023 +0200 Merge branch 'obs-ai-assistant' into obs-ai-assistant-2 commit c8e83e77fcdb3eb5f7458a6ffcb915cb2dffbfde Author: Dario Gieselaar Date: Wed Jul 26 12:18:03 2023 +0200 Remove accidental important commit 491006051e4dd6fe6f0e642a16a71b105f7f3f39 Merge: b5ed9c53bce d12768160cf Author: Dario Gieselaar Date: Wed Jul 26 12:13:59 2023 +0200 Merge branch 'obs-ai-assistant' into obs-ai-assistant-2 commit d12768160cf437b5ec869cb1c5f345ad37b102d6 Merge: b90ba848e31 e17530fe359 Author: Dario Gieselaar Date: Wed Jul 26 12:10:13 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant commit b90ba848e316c4382d19ec4297bd1074ccb5d123 Author: Dario Gieselaar Date: Wed Jul 26 12:10:09 2023 +0200 Make sure to close mock connector server after tests commit b5ed9c53bce3f8695dcfade23dc161f2d5c3e5da Author: Dario Gieselaar Date: Wed Jul 26 11:47:02 2023 +0200 Re-adding subdued background for insight commit c9753e5faad573d73c287e2b165d5b5c9c129b6b Merge: 27f224ae3c6 3cb27a5d21e Author: Coen Warmer Date: Wed Jul 26 10:52:30 2023 +0200 Merge pull request #12 from CoenWarmer/storybook commit 3cb27a5d21eb44a214ce6e7ec39c5e567987fc3f Author: Coen Warmer Date: Wed Jul 26 01:16:31 2023 +0200 Chat Flyout commit 27f224ae3c6fe7a6595fea3d0749d1b1cd12250d Merge: 706559fe219 eb51ece0fee Author: Coen Warmer Date: Tue Jul 25 21:56:58 2023 +0200 Merge pull request #11 from CoenWarmer/storybook commit eb51ece0fee2646218e7748f99f72614648b8a00 Author: Coen Warmer Date: Tue Jul 25 21:55:23 2023 +0200 Add Regenerate button to ChatItem commit 706559fe219505056798e86e079a5a8e9951564f Merge: d01bbef6ba6 889f1a865bf Author: Coen Warmer Date: Tue Jul 25 21:24:47 2023 +0200 Merge pull request #10 from CoenWarmer/storybook commit 889f1a865bf793d4854fbf6513e3b634d6c8fab9 Author: Coen Warmer Date: Tue Jul 25 20:13:44 2023 +0200 Add Actions menu to ChatItems commit ca8a5768185206fc29202b6e6401d83c05f38878 Author: Dario Gieselaar Date: Tue Jul 25 20:08:53 2023 +0200 [Observability AI Assistant] Stop/regenerate response commit 7f6c24e91fc1ec0560f17611af6b1ba1794ae868 Author: Dario Gieselaar Date: Tue Jul 25 19:04:31 2023 +0200 Define system/user prompts for infra commit d4447de2ed10722f34a5c55f10d4cc8309f9f5cb Merge: f258a42cb7f 492cfdfe3a4 Author: Dario Gieselaar Date: Tue Jul 25 18:10:34 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant commit f258a42cb7f7c75b34c4630b457f81925857c096 Author: Dario Gieselaar Date: Tue Jul 25 18:10:30 2023 +0200 Review feedback & don't init on startup commit d01bbef6ba6b77bbb53c93d0ec76436051b300b0 Merge: 807fd104819 d4d2ad315ee Author: Dario Gieselaar Date: Tue Jul 25 15:10:24 2023 +0200 Merge pull request #9 from CoenWarmer/storybook commit 807fd104819e4819f67a59d6bd8a74b25978fdac Author: Dario Gieselaar Date: Tue Jul 25 12:08:38 2023 +0200 Use createConcreteWriteIndex from alerting plugin commit d4d2ad315ee1c1b8d264d4eb428a0a63194ca5f5 Author: Coen Warmer Date: Tue Jul 25 11:56:56 2023 +0200 Remove background for EA commit a6527b4318b51de83b2660a9e11af718cf7e9f0f Author: Coen Warmer Date: Tue Jul 25 11:42:30 2023 +0200 Integrate changes commit e0e9b0ef91af18175496a6c37bef1e039d8d25ea Merge: 38d0eb8f600 a8d6eca6411 Author: Dario Gieselaar Date: Tue Jul 25 11:31:27 2023 +0200 Merge branch 'obs-ai-assistant' of github.com:dgieselaar/kibana into obs-ai-assistant commit 38d0eb8f60069696a6bbcd842c7e2b7b0c99889f Author: Dario Gieselaar Date: Tue Jul 25 11:23:58 2023 +0200 Catch resource_already_exists_exception commit 43aede2aefe6d5da1a41d27db61155c10c2722e9 Merge: 0b66523b524 a8d6eca6411 Author: Coen Warmer Date: Tue Jul 25 11:20:37 2023 +0200 Merge branch 'obs-ai-assistant' of github.com:dgieselaar/kibana into storybook commit 0b66523b5249b4319ffcdd6aabc6eca6f91b2b31 Author: Coen Warmer Date: Tue Jul 25 10:52:33 2023 +0200 Add chat timeline commit a8d6eca641105334c6a36d41501caa71af598c68 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue Jul 25 08:28:51 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 76f4f3231bd2ed199ced45b641aa01964e69c93a Merge: a284f45897c 7143dcf2c30 Author: Dario Gieselaar Date: Tue Jul 25 10:23:52 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant commit a284f45897c3ebb2d565b0fc3075a753a48c3bd4 Author: Dario Gieselaar Date: Mon Jul 24 13:53:03 2023 +0200 Add support for Azure commit e0b5911353efa59f2b6879ffc501e1e95ff8e893 Merge: 47965bff81f 818ffc854ed Author: Dario Gieselaar Date: Mon Jul 24 11:18:47 2023 +0200 Merge branch 'contextual-insights' of github.com:dgieselaar/kibana into contextual-insights commit 47965bff81f2bff97e3458c23cb24ae4f3809dd2 Author: Dario Gieselaar Date: Mon Jul 24 11:14:00 2023 +0200 Correct type import commit 818ffc854ed87e05ed93e45e3aa9701f42e1a029 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon Jul 24 07:42:21 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 62c04bf977e88ac4f130b7ed69aa8b66994a64a9 Author: Dario Gieselaar Date: Mon Jul 24 09:36:32 2023 +0200 Remove basic config commit 54a6b0794191be17e40fdcc900952b15e4c2f507 Author: Dario Gieselaar Date: Mon Jul 24 09:31:55 2023 +0200 Remove AI ASsistant config settings from observability plugin in rendering service test commit f1bf9894b5f7e9fd3fc5d24d7b074072fb308f41 Author: Dario Gieselaar Date: Mon Jul 24 09:26:12 2023 +0200 Add API tests commit 2909dae91d0d9699946cf0a00b63cb3b28e5508c Author: Dario Gieselaar Date: Sun Jul 23 19:50:57 2023 +0200 Fix infra type errors commit 8930c8acdac726c64c74942c5e586eafd4aad0f2 Author: Dario Gieselaar Date: Sun Jul 23 19:10:02 2023 +0200 Fix types in test_helper commit 13c821a8b2d1a02fb58367ac3c20e86ae44624b4 Author: Dario Gieselaar Date: Sun Jul 23 18:36:32 2023 +0200 Remove unused translations commit 1641866737a3d467622d12c6f550a8428d815203 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun Jul 23 14:42:34 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit b12a2a2a79c20100332b3fa45f2bd021bbc285c2 Author: Dario Gieselaar Date: Sun Jul 23 18:29:40 2023 +0200 Fix types commit 8fb45148e0c53b6ace8a7ec1ba4c61d8bdb28029 Author: Dario Gieselaar Date: Sun Jul 23 16:05:43 2023 +0200 Migrate existing insights commit 9f211e22f1d3736f9c460bd4c05a5cd64392ea4f Author: Dario Gieselaar Date: Sun Jul 23 13:51:03 2023 +0200 Add unit tests commit 15f22dbcb1eaa291746eccbd8734c286fa357279 Author: Dario Gieselaar Date: Sun Jul 23 12:24:30 2023 +0200 Contextual insights commit 16955edc1541bac54da5c4090cd8fbae83cd8f69 Merge: 3a2e0696f2b 0af4e7e113f Author: Dario Gieselaar Date: Mon Jul 24 09:28:21 2023 +0200 Merge branch 'main' of github.com:elastic/kibana into obs-ai-assistant commit 3a2e0696f2bf337a43a54a36a6529907fad7d470 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu Jul 20 08:48:23 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit dbb37d9dd65cc3d18b7844cbfebe38fff0f4391e Author: Coen Warmer Date: Thu Jul 20 10:26:34 2023 +0200 Update i18n translation base key commit fc6d9441261b206db7b02c254323e9a17a12d6ea Author: Coen Warmer Date: Wed Jul 19 22:38:01 2023 +0200 Added Insight component commit a375fbd42b2b6cc4f6495158ac8663f718cea7f0 Author: Coen Warmer Date: Wed Jul 19 15:29:14 2023 +0200 Update AskAssistantButton to include Sparkles from Eui commit 739b116fa68d1fe8f19c8ef93b675cd35c67fa1d Author: Dario Gieselaar Date: Thu Jul 20 09:51:57 2023 +0200 Add observability_ai_assistant storybook to CI step commit 1755e1aa9fda924344cfff749a16663252cca5fb Author: Dario Gieselaar Date: Wed Jul 19 17:48:13 2023 +0200 Fix i18n check commit cedbed97575dcc7fcd373d103e1f6917dddb96d8 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Jul 19 13:46:31 2023 +0000 [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs' commit 82d482e71c645485200805995e4a203446573a59 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Jul 19 13:38:38 2023 +0000 [CI] Auto-commit changed files from 'node scripts/generate codeowners' commit 0c59c0c39c90d15d1bb122c8f225ecd43fef8040 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Jul 19 13:31:28 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 71884230161baf8f0a02e37c45cf893c10121155 Author: Dario Gieselaar Date: Wed Jul 19 16:08:45 2023 +0200 Add plugin to limits.yml commit a959689f4a479daaad47ef196e9a10fcd99f619d Author: Dario Gieselaar Date: Wed Jul 19 15:24:51 2023 +0200 newline in package.json commit 0efd9d3723642833a460aaaad607204a420e70e8 Author: Coen Warmer Date: Wed Jul 19 14:59:43 2023 +0200 First pass of InsightPanel commit 4d4ca17079d0e8421889cd5035fa62d5fb5f4382 Author: Coen Warmer Date: Wed Jul 19 14:37:46 2023 +0200 Add Assistant Avatar commit 7004c7c6637ba062ed8c0a725e340a83350e2755 Author: Coen Warmer Date: Wed Jul 19 12:24:37 2023 +0200 Add AskAiAssistantButton commit 61efe2fa9c4dde02bfaeebd39b44c86974d556b4 Author: Coen Warmer Date: Wed Jul 19 10:16:14 2023 +0200 Add Storybook setup commit d98b43ac19a28f503be7867c655afb028c8b3160 Author: Dario Gieselaar Date: Tue Jul 18 11:12:57 2023 +0200 Observability AI Assistant Service + Client commit 26bf6172a0f1d668a8c4d72ce07995c4f69f0450 Author: Dario Gieselaar Date: Sat Jul 15 08:12:13 2023 +0200 Observability AI Assistant plugin commit fa107667987ca2eb97c1b89918b4162cfcad858d Author: Coen Warmer Date: Thu Jul 20 16:53:05 2023 +0200 First pass of Chat interface commit 990d6d11e4a7e0cf4d7409acbb84f02306d95aa4 Author: Coen Warmer Date: Thu Jul 20 16:52:47 2023 +0200 Update imports commit 1a3d74c09a5dbace0ff3bcb9115e04837349631c Author: Coen Warmer Date: Thu Jul 20 16:52:18 2023 +0200 Add security as dependency commit c0decc669373fa0c13bcba4695a39d23bd7a8019 Author: Coen Warmer Date: Thu Jul 20 16:51:23 2023 +0200 Add hooks commit 3c96673fac0e4ba91a21b1c998f512c620d6a807 Author: Coen Warmer Date: Thu Jul 20 16:50:35 2023 +0200 Add builders for Messages commit cc0f643a5df53a49e67c93051af28081b65f751a Merge: d391008667c e3a67c8a569 Author: Coen Warmer Date: Thu Jul 20 10:27:14 2023 +0200 Merge branch 'storybook' of github.com:CoenWarmer/kibana into storybook commit d391008667c8d26fc0fc47d146c7523769b0c17f Author: Coen Warmer Date: Thu Jul 20 10:26:34 2023 +0200 Update i18n translation base key commit e3a67c8a5697daad8a2806697edb72905cf47fea Merge: a9c59b6b6c2 8a30a08ccaa Author: Coen Warmer Date: Thu Jul 20 08:36:36 2023 +0200 Merge branch 'obs-ai-assistant' into storybook commit a9c59b6b6c20b5adacecfbd7672605ca7e99001a Author: Coen Warmer Date: Wed Jul 19 22:38:01 2023 +0200 Added Insight component commit 8a30a08ccaa86c5d1524b5ba6629c275166eff5a Author: Dario Gieselaar Date: Wed Jul 19 17:48:13 2023 +0200 Fix i18n check commit 26dcb4ebbaa1219049a8c5f18a9196bc1e800aac Merge: e27e5907b38 0cd6dde87fa Author: Dario Gieselaar Date: Wed Jul 19 16:12:17 2023 +0200 Merge branch 'obs-ai-assistant' of github.com:dgieselaar/kibana into obs-ai-assistant commit e27e5907b38d53cae1da3a7c9b090e983750df3d Author: Dario Gieselaar Date: Wed Jul 19 16:08:45 2023 +0200 Add plugin to limits.yml commit 0cd6dde87fa0ad401f8860072576036a89538172 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Jul 19 13:46:31 2023 +0000 [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs' commit b06714b8b83c23c8ea52d68197ccfb705df3a497 Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Jul 19 13:38:38 2023 +0000 [CI] Auto-commit changed files from 'node scripts/generate codeowners' commit 4fc20ac099ff0cdac291e273f188b85918834ada Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Wed Jul 19 13:31:28 2023 +0000 [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' commit 7e2525d31756ab1505cfee77a98e9bcfdc459f2d Author: Coen Warmer Date: Wed Jul 19 15:29:14 2023 +0200 Update AskAssistantButton to include Sparkles from Eui commit 9279a0ba18c429eaf38f4cfc985248c9e04f8feb Author: Dario Gieselaar Date: Wed Jul 19 15:24:51 2023 +0200 newline in package.json commit 6d7bbcf27f47aff46538a0a604591b1faa125475 Merge: 798b1c3b0f1 378cc90da7c Author: Dario Gieselaar Date: Wed Jul 19 15:13:32 2023 +0200 Merge pull request #6 from CoenWarmer/storybook commit 378cc90da7c7a6d47191809715cdf980526bc08d Author: Coen Warmer Date: Wed Jul 19 14:59:43 2023 +0200 First pass of InsightPanel commit 09f821b4a1d82e1726098239cfb7972ef3c89795 Author: Coen Warmer Date: Wed Jul 19 14:37:46 2023 +0200 Add Assistant Avatar commit 8e5e8949137e26c472e3835838ad9104abfb19b1 Author: Coen Warmer Date: Wed Jul 19 12:24:37 2023 +0200 Add AskAiAssistantButton commit 5f96a6c5137560f228ce69b27780421fc8177e09 Author: Coen Warmer Date: Wed Jul 19 10:16:14 2023 +0200 Add Storybook setup commit 798b1c3b0f111206ee314c074c05d8e77c1aff3a Author: Dario Gieselaar Date: Tue Jul 18 11:12:57 2023 +0200 Observability AI Assistant Service + Client commit 90203d9d94b918716898ce197f5ba4d46ccc69ef Author: Dario Gieselaar Date: Sat Jul 15 08:12:13 2023 +0200 Observability AI Assistant plugin --- .../get_apm_service_summary.ts | 9 +- .../get_apm_services_list.ts | 55 +++ .../apm/public/assistant_functions/index.ts | 5 + .../apm/public/utils/non_empty_string_ref.ts | 11 + .../get_services_list/index.ts | 56 ++++ .../routes/assistant_functions/route.ts | 28 ++ .../common/types.ts | 1 + .../utils/get_bucket_size/calculate_auto.js | 78 +++++ .../utils/get_bucket_size/index.test.ts | 72 ++++ .../common/utils/get_bucket_size/index.ts | 38 +++ .../utils/get_bucket_size/unit_to_seconds.ts | 27 ++ .../observability_ai_assistant/kibana.jsonc | 2 +- .../message_panel/message_panel.stories.tsx | 27 ++ .../components/message_panel/message_text.tsx | 90 +++-- .../public/functions/alerts.ts | 80 +++++ .../public/functions/elasticsearch.ts | 6 +- .../public/functions/index.ts | 9 +- .../public/functions/kibana.ts | 69 ++++ .../public/functions/lens.tsx | 4 + .../public/functions/recall.ts | 1 + .../public/functions/summarise.ts | 2 + .../public/plugin.tsx | 1 + .../service/get_assistant_setup_message.ts | 8 +- .../server/plugin.ts | 3 +- .../server/routes/functions/route.ts | 106 +++++- .../server/routes/types.ts | 11 +- .../server/service/client/index.ts | 4 +- .../server/service/index.ts | 64 +++- .../server/service/kb_component_template.ts | 6 + .../server/service/kb_service/index.ts | 105 ++++-- .../server/service/kb_service/kb_docs/lens.ts | 317 +++++++++--------- .../server/service/util/split_kb_text.ts | 35 ++ .../observability_ai_assistant/tsconfig.json | 4 +- 33 files changed, 1098 insertions(+), 236 deletions(-) create mode 100644 x-pack/plugins/apm/public/assistant_functions/get_apm_services_list.ts create mode 100644 x-pack/plugins/apm/public/utils/non_empty_string_ref.ts create mode 100644 x-pack/plugins/apm/server/routes/assistant_functions/get_services_list/index.ts create mode 100644 x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/calculate_auto.js create mode 100644 x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.test.ts create mode 100644 x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.ts create mode 100644 x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/unit_to_seconds.ts create mode 100644 x-pack/plugins/observability_ai_assistant/public/functions/alerts.ts create mode 100644 x-pack/plugins/observability_ai_assistant/public/functions/kibana.ts create mode 100644 x-pack/plugins/observability_ai_assistant/server/service/util/split_kb_text.ts diff --git a/x-pack/plugins/apm/public/assistant_functions/get_apm_service_summary.ts b/x-pack/plugins/apm/public/assistant_functions/get_apm_service_summary.ts index fbbd35524d43da..189633ec959750 100644 --- a/x-pack/plugins/apm/public/assistant_functions/get_apm_service_summary.ts +++ b/x-pack/plugins/apm/public/assistant_functions/get_apm_service_summary.ts @@ -8,6 +8,7 @@ import { i18n } from '@kbn/i18n'; import type { RegisterFunctionDefinition } from '@kbn/observability-ai-assistant-plugin/common/types'; import { callApmApi } from '../services/rest/create_call_apm_api'; +import { NON_EMPTY_STRING } from '../utils/non_empty_string_ref'; export function registerGetApmServiceSummaryFunction({ registerFunction, @@ -35,20 +36,20 @@ alerts and anomalies.`, type: 'object', properties: { 'service.name': { - type: 'string', + ...NON_EMPTY_STRING, description: 'The name of the service that should be summarized.', }, 'service.environment': { - type: 'string', + ...NON_EMPTY_STRING, description: 'The environment that the service is running in', }, start: { - type: 'string', + ...NON_EMPTY_STRING, description: 'The start of the time range, in Elasticsearch date math, like `now`.', }, end: { - type: 'string', + ...NON_EMPTY_STRING, description: 'The end of the time range, in Elasticsearch date math, like `now-24h`.', }, diff --git a/x-pack/plugins/apm/public/assistant_functions/get_apm_services_list.ts b/x-pack/plugins/apm/public/assistant_functions/get_apm_services_list.ts new file mode 100644 index 00000000000000..e6b984c4c88b12 --- /dev/null +++ b/x-pack/plugins/apm/public/assistant_functions/get_apm_services_list.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import type { RegisterFunctionDefinition } from '@kbn/observability-ai-assistant-plugin/common/types'; +import { callApmApi } from '../services/rest/create_call_apm_api'; +import { NON_EMPTY_STRING } from '../utils/non_empty_string_ref'; + +export function registerGetApmServicesListFunction({ + registerFunction, +}: { + registerFunction: RegisterFunctionDefinition; +}) { + registerFunction( + { + name: 'get_apm_services_list', + contexts: ['apm'], + description: `Gets a list of services`, + descriptionForUser: i18n.translate( + 'xpack.apm.observabilityAiAssistant.functions.registerGetApmServicesList.descriptionForUser', + { + defaultMessage: `Gets the list of monitored services. Only returns the service names`, + } + ), + parameters: { + type: 'object', + properties: { + start: { + ...NON_EMPTY_STRING, + description: + 'The start of the time range, in Elasticsearch date math, like `now`.', + }, + end: { + ...NON_EMPTY_STRING, + description: + 'The end of the time range, in Elasticsearch date math, like `now-24h`.', + }, + }, + required: ['start', 'end'], + } as const, + }, + async ({ arguments: args }, signal) => { + return callApmApi('GET /internal/apm/assistant/get_services_list', { + signal, + params: { + query: args, + }, + }); + } + ); +} diff --git a/x-pack/plugins/apm/public/assistant_functions/index.ts b/x-pack/plugins/apm/public/assistant_functions/index.ts index f83e9fa6fc575e..693a10ec37b48f 100644 --- a/x-pack/plugins/apm/public/assistant_functions/index.ts +++ b/x-pack/plugins/apm/public/assistant_functions/index.ts @@ -18,6 +18,7 @@ import { import { registerGetApmCorrelationsFunction } from './get_apm_correlations'; import { registerGetApmDownstreamDependenciesFunction } from './get_apm_downstream_dependencies'; import { registerGetApmErrorDocumentFunction } from './get_apm_error_document'; +import { registerGetApmServicesListFunction } from './get_apm_services_list'; import { registerGetApmServiceSummaryFunction } from './get_apm_service_summary'; import { registerGetApmTimeseriesFunction } from './get_apm_timeseries'; @@ -64,6 +65,10 @@ export async function registerAssistantFunctions({ registerFunction, }); + registerGetApmServicesListFunction({ + registerFunction, + }); + registerContext({ name: 'apm', description: ` diff --git a/x-pack/plugins/apm/public/utils/non_empty_string_ref.ts b/x-pack/plugins/apm/public/utils/non_empty_string_ref.ts new file mode 100644 index 00000000000000..94cac08fa21982 --- /dev/null +++ b/x-pack/plugins/apm/public/utils/non_empty_string_ref.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const NON_EMPTY_STRING = { + type: 'string' as const, + minLength: 1, +}; diff --git a/x-pack/plugins/apm/server/routes/assistant_functions/get_services_list/index.ts b/x-pack/plugins/apm/server/routes/assistant_functions/get_services_list/index.ts new file mode 100644 index 00000000000000..1e9fc362155395 --- /dev/null +++ b/x-pack/plugins/apm/server/routes/assistant_functions/get_services_list/index.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as t from 'io-ts'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; +import { rangeQuery } from '@kbn/observability-plugin/server'; +import datemath from '@elastic/datemath'; +import type { APMEventClient } from '../../../lib/helpers/create_es_client/create_apm_event_client'; +import { SERVICE_NAME } from '../../../../common/es_fields/apm'; + +export const getApmServicesListRouteRt = t.type({ + start: t.string, + end: t.string, +}); + +export interface ApmServicesListContent { + hasMore: boolean; + services: Array<{ [SERVICE_NAME]: string }>; +} + +export async function getApmServicesList({ + arguments: args, + apmEventClient, +}: { + arguments: t.TypeOf; + apmEventClient: APMEventClient; +}): Promise { + const start = datemath.parse(args.start)!.valueOf(); + const end = datemath.parse(args.end)!.valueOf(); + + const terms = await apmEventClient.termsEnum('get_services_list', { + apm: { + events: [ + ProcessorEvent.transaction, + ProcessorEvent.span, + ProcessorEvent.metric, + ProcessorEvent.error, + ], + }, + index_filter: { + bool: { + filter: rangeQuery(start, end), + }, + }, + size: 20, + field: SERVICE_NAME, + }); + + return { + services: terms.terms.map((term) => ({ [SERVICE_NAME]: term })), + hasMore: !terms.complete, + }; +} diff --git a/x-pack/plugins/apm/server/routes/assistant_functions/route.ts b/x-pack/plugins/apm/server/routes/assistant_functions/route.ts index bd2d32c90907ed..1b749548410024 100644 --- a/x-pack/plugins/apm/server/routes/assistant_functions/route.ts +++ b/x-pack/plugins/apm/server/routes/assistant_functions/route.ts @@ -33,6 +33,11 @@ import { getApmTimeseries, getApmTimeseriesRt, } from './get_apm_timeseries'; +import { + ApmServicesListContent, + getApmServicesList, + getApmServicesListRouteRt, +} from './get_services_list'; const getApmTimeSeriesRoute = createApmServerRoute({ endpoint: 'POST /internal/apm/assistant/get_apm_timeseries', @@ -184,10 +189,33 @@ const getApmErrorDocRoute = createApmServerRoute({ }, }); +const getApmServicesListRoute = createApmServerRoute({ + endpoint: 'GET /internal/apm/assistant/get_services_list', + params: t.type({ + query: getApmServicesListRouteRt, + }), + options: { + tags: ['access:apm'], + }, + handler: async (resources): Promise<{ content: ApmServicesListContent }> => { + const { params } = resources; + const apmEventClient = await getApmEventClient(resources); + const { query } = params; + + return { + content: await getApmServicesList({ + apmEventClient, + arguments: query, + }), + }; + }, +}); + export const assistantRouteRepository = { ...getApmTimeSeriesRoute, ...getApmServiceSummaryRoute, ...getApmErrorDocRoute, ...getApmCorrelationValuesRoute, ...getDownstreamDependenciesRoute, + ...getApmServicesListRoute, }; diff --git a/x-pack/plugins/observability_ai_assistant/common/types.ts b/x-pack/plugins/observability_ai_assistant/common/types.ts index d1d9e8ef313321..1d8be57fd53b37 100644 --- a/x-pack/plugins/observability_ai_assistant/common/types.ts +++ b/x-pack/plugins/observability_ai_assistant/common/types.ts @@ -64,6 +64,7 @@ export interface KnowledgeBaseEntry { confidence: 'low' | 'medium' | 'high'; is_correction: boolean; public: boolean; + labels: Record; } export type CompatibleJSONSchema = Exclude; diff --git a/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/calculate_auto.js b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/calculate_auto.js new file mode 100644 index 00000000000000..bd4d6e51ccc0dd --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/calculate_auto.js @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment from 'moment'; +const d = moment.duration; + +const roundingRules = [ + [d(500, 'ms'), d(100, 'ms')], + [d(5, 'second'), d(1, 'second')], + [d(7.5, 'second'), d(5, 'second')], + [d(15, 'second'), d(10, 'second')], + [d(45, 'second'), d(30, 'second')], + [d(3, 'minute'), d(1, 'minute')], + [d(9, 'minute'), d(5, 'minute')], + [d(20, 'minute'), d(10, 'minute')], + [d(45, 'minute'), d(30, 'minute')], + [d(2, 'hour'), d(1, 'hour')], + [d(6, 'hour'), d(3, 'hour')], + [d(24, 'hour'), d(12, 'hour')], + [d(1, 'week'), d(1, 'd')], + [d(3, 'week'), d(1, 'week')], + [d(1, 'year'), d(1, 'month')], + [Infinity, d(1, 'year')], +]; + +const revRoundingRules = roundingRules.slice(0).reverse(); + +function find(rules, check, last) { + function pick(buckets, duration) { + const target = duration / buckets; + let lastResp = null; + + for (let i = 0; i < rules.length; i++) { + const rule = rules[i]; + const resp = check(rule[0], rule[1], target); + + if (resp == null) { + if (!last) continue; + if (lastResp) return lastResp; + break; + } + + if (!last) return resp; + lastResp = resp; + } + + // fallback to just a number of milliseconds, ensure ms is >= 1 + const ms = Math.max(Math.floor(target), 1); + return moment.duration(ms, 'ms'); + } + + return (buckets, duration) => { + const interval = pick(buckets, duration); + if (interval) return moment.duration(interval._data); + }; +} + +export const calculateAuto = { + near: find( + revRoundingRules, + function near(bound, interval, target) { + if (bound > target) return interval; + }, + true + ), + + lessThan: find(revRoundingRules, function lessThan(_bound, interval, target) { + if (interval < target) return interval; + }), + + atLeast: find(revRoundingRules, function atLeast(_bound, interval, target) { + if (interval <= target) return interval; + }), +}; diff --git a/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.test.ts b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.test.ts new file mode 100644 index 00000000000000..e91b6b44dee7fa --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.test.ts @@ -0,0 +1,72 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getBucketSize } from '.'; +import moment from 'moment'; + +describe('getBuckets', () => { + describe("minInterval 'auto'", () => { + it('last 15 minutes', () => { + const start = moment().subtract(15, 'minutes').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: 'auto' })).toEqual({ + bucketSize: 10, + intervalString: '10s', + }); + }); + it('last 1 hour', () => { + const start = moment().subtract(1, 'hour').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: 'auto' })).toEqual({ + bucketSize: 30, + intervalString: '30s', + }); + }); + it('last 1 week', () => { + const start = moment().subtract(1, 'week').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: 'auto' })).toEqual({ + bucketSize: 3600, + intervalString: '3600s', + }); + }); + it('last 30 days', () => { + const start = moment().subtract(30, 'days').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: 'auto' })).toEqual({ + bucketSize: 43200, + intervalString: '43200s', + }); + }); + it('last 1 year', () => { + const start = moment().subtract(1, 'year').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: 'auto' })).toEqual({ + bucketSize: 86400, + intervalString: '86400s', + }); + }); + }); + describe("minInterval '30s'", () => { + it('last 15 minutes', () => { + const start = moment().subtract(15, 'minutes').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: '30s' })).toEqual({ + bucketSize: 30, + intervalString: '30s', + }); + }); + it('last 1 year', () => { + const start = moment().subtract(1, 'year').valueOf(); + const end = moment.now(); + expect(getBucketSize({ start, end, minInterval: '30s' })).toEqual({ + bucketSize: 86400, + intervalString: '86400s', + }); + }); + }); +}); diff --git a/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.ts b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.ts new file mode 100644 index 00000000000000..ca1afaf41c1a61 --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/index.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment from 'moment'; +// @ts-ignore +import { calculateAuto } from './calculate_auto'; +import { unitToSeconds } from './unit_to_seconds'; + +export function getBucketSize({ + start, + end, + minInterval, + buckets = 100, +}: { + start: number; + end: number; + minInterval: string; + buckets?: number; +}) { + const duration = moment.duration(end - start, 'ms'); + const bucketSize = Math.max(calculateAuto.near(buckets, duration)?.asSeconds() ?? 0, 1); + const intervalString = `${bucketSize}s`; + const matches = minInterval && minInterval.match(/^([\d]+)([shmdwMy]|ms)$/); + const minBucketSize = matches ? Number(matches[1]) * unitToSeconds(matches[2]) : 0; + + if (bucketSize < minBucketSize) { + return { + bucketSize: minBucketSize, + intervalString: minInterval, + }; + } + + return { bucketSize, intervalString }; +} diff --git a/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/unit_to_seconds.ts b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/unit_to_seconds.ts new file mode 100644 index 00000000000000..eec81dd3fcd294 --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/common/utils/get_bucket_size/unit_to_seconds.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment, { unitOfTime as UnitOfTIme } from 'moment'; + +function getDurationAsSeconds(value: number, unitOfTime: UnitOfTIme.Base) { + return moment.duration(value, unitOfTime).asSeconds(); +} + +const units = { + ms: getDurationAsSeconds(1, 'millisecond'), + s: getDurationAsSeconds(1, 'second'), + m: getDurationAsSeconds(1, 'minute'), + h: getDurationAsSeconds(1, 'hour'), + d: getDurationAsSeconds(1, 'day'), + w: getDurationAsSeconds(1, 'week'), + M: getDurationAsSeconds(1, 'month'), + y: getDurationAsSeconds(1, 'year'), +}; + +export function unitToSeconds(unit: string) { + return units[unit as keyof typeof units]; +} diff --git a/x-pack/plugins/observability_ai_assistant/kibana.jsonc b/x-pack/plugins/observability_ai_assistant/kibana.jsonc index a1d535a4c14c82..e0299246377a38 100644 --- a/x-pack/plugins/observability_ai_assistant/kibana.jsonc +++ b/x-pack/plugins/observability_ai_assistant/kibana.jsonc @@ -7,7 +7,7 @@ "server": true, "browser": true, "configPath": ["xpack", "observabilityAIAssistant"], - "requiredPlugins": ["triggersActionsUi", "actions", "security", "features", "observabilityShared", "taskManager", "lens", "dataViews"], + "requiredPlugins": ["triggersActionsUi", "actions", "security", "features", "observabilityShared", "taskManager", "lens", "dataViews", "ruleRegistry"], "requiredBundles": ["kibanaReact", "kibanaUtils", "fieldFormats"], "optionalPlugins": [], "extraPublicDirs": [] diff --git a/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_panel.stories.tsx b/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_panel.stories.tsx index 2ab602e429ce17..1f817860863709 100644 --- a/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_panel.stories.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_panel.stories.tsx @@ -6,6 +6,7 @@ */ import { EuiPanel } from '@elastic/eui'; import { ComponentMeta, ComponentStoryObj } from '@storybook/react'; +import dedent from 'dedent'; import React from 'react'; import { FeedbackButtons } from '../feedback_buttons'; import { MessagePanel as Component } from './message_panel'; @@ -61,6 +62,32 @@ export const ContentFailed: ComponentStoryObj = { }, }; +export const ContentTable: ComponentStoryObj = { + args: { + body: ( + + ), + }, +}; + export const Controls: ComponentStoryObj = { args: { body: , diff --git a/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_text.tsx b/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_text.tsx index 7aeae624a02538..6fd9a1c70923de 100644 --- a/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_text.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/components/message_panel/message_text.tsx @@ -4,13 +4,17 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { EuiText } from '@elastic/eui'; +import { + EuiMarkdownFormat, + EuiSpacer, + EuiText, + getDefaultEuiMarkdownParsingPlugins, + getDefaultEuiMarkdownProcessingPlugins, +} from '@elastic/eui'; import { css } from '@emotion/css'; -import { euiThemeVars } from '@kbn/ui-theme'; import classNames from 'classnames'; import type { Code, InlineCode, Parent, Text } from 'mdast'; -import React from 'react'; -import ReactMarkdown from 'react-markdown'; +import React, { useMemo } from 'react'; import type { Node } from 'unist'; import { v4 } from 'uuid'; @@ -44,7 +48,7 @@ const cursorCss = css` const Cursor = () => ; -const CURSOR = `{{${v4()}}`; +const CURSOR = `{{${v4()}}}`; const loadingCursorPlugin = () => { const visitor = (node: Node, parent?: Parent) => { @@ -72,9 +76,6 @@ const loadingCursorPlugin = () => { parent!.children.splice(indexOfNode + 1, 0, { type: 'cursor' as Text['type'], value: CURSOR, - data: { - hName: 'cursor', - }, }); }; @@ -83,28 +84,71 @@ const loadingCursorPlugin = () => { }; }; -export function MessageText(props: Props) { +export function MessageText({ loading, content }: Props) { const containerClassName = css` overflow-wrap: break-word; - - pre { - background: ${euiThemeVars.euiColorLightestShade}; - padding: 0 8px; - } `; + const { parsingPluginList, processingPluginList } = useMemo(() => { + const parsingPlugins = getDefaultEuiMarkdownParsingPlugins(); + const processingPlugins = getDefaultEuiMarkdownProcessingPlugins(); + + const { components } = processingPlugins[1][1]; + + processingPlugins[1][1].components = { + ...components, + cursor: Cursor, + table: (props) => ( + <> +
+ {' '} + + + + + ), + th: (props) => { + const { children, ...rest } = props; + return ( + + ); + }, + tr: (props) => , + td: (props) => { + const { children, ...rest } = props; + return ( + + ); + }, + }; + + return { + parsingPluginList: [loadingCursorPlugin, ...parsingPlugins], + processingPluginList: processingPlugins, + }; + }, []); + return ( - - } + - {`${props.content}${props.loading ? CURSOR : ''}`} - + {`${content}${loading ? CURSOR : ''}`} + ); } diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/alerts.ts b/x-pack/plugins/observability_ai_assistant/public/functions/alerts.ts new file mode 100644 index 00000000000000..03ea9a055fcc7f --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/public/functions/alerts.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { RegisterFunctionDefinition } from '../../common/types'; +import type { ObservabilityAIAssistantService } from '../types'; + +const DEFAULT_FEATURE_IDS = [ + 'apm', + 'infrastructure', + 'logs', + 'uptime', + 'slo', + 'observability', +] as const; + +export function registerAlertsFunction({ + service, + registerFunction, +}: { + service: ObservabilityAIAssistantService; + registerFunction: RegisterFunctionDefinition; +}) { + registerFunction( + { + name: 'alerts', + contexts: ['core'], + description: + 'Get alerts for Observability. Display the response in tabular format if appropriate.', + descriptionForUser: 'Get alerts for Observability', + parameters: { + type: 'object', + additionalProperties: false, + properties: { + featureIds: { + type: 'array', + additionalItems: false, + items: { + type: 'string', + enum: DEFAULT_FEATURE_IDS, + }, + description: + 'The Observability apps for which to retrieve alerts. By default it will return alerts for all apps.', + }, + start: { + type: 'string', + description: 'The start of the time range, in Elasticsearch date math, like `now`.', + }, + end: { + type: 'string', + description: 'The end of the time range, in Elasticsearch date math, like `now-24h`.', + }, + filter: { + type: 'string', + description: + 'a KQL query to filter the data by. If no filter should be applied, leave it empty.', + }, + }, + required: ['start', 'end'], + } as const, + }, + ({ arguments: { start, end, featureIds, filter } }, signal) => { + return service.callApi('POST /internal/observability_ai_assistant/functions/alerts', { + params: { + body: { + start, + end, + featureIds: + featureIds && featureIds.length > 0 ? featureIds : DEFAULT_FEATURE_IDS.concat(), + filter, + }, + }, + signal, + }); + } + ); +} diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/elasticsearch.ts b/x-pack/plugins/observability_ai_assistant/public/functions/elasticsearch.ts index 214b157fe2358d..546bd2bea45749 100644 --- a/x-pack/plugins/observability_ai_assistant/public/functions/elasticsearch.ts +++ b/x-pack/plugins/observability_ai_assistant/public/functions/elasticsearch.ts @@ -21,7 +21,7 @@ export function registerElasticsearchFunction({ name: 'elasticsearch', contexts: ['core'], description: - 'Call Elasticsearch APIs on behalf of the user. Make sure the request body is valid for the API that you are using.', + 'Call Elasticsearch APIs on behalf of the user. Make sure the request body is valid for the API that you are using. Only call this function when the user has explicitly requested it.', descriptionForUser: 'Call Elasticsearch APIs on behalf of the user', parameters: { type: 'object', @@ -35,6 +35,10 @@ export function registerElasticsearchFunction({ type: 'string', description: 'The path of the Elasticsearch endpoint, including query parameters', }, + body: { + type: 'object', + description: 'The body of the request', + }, }, required: ['method', 'path'] as const, }, diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/index.ts b/x-pack/plugins/observability_ai_assistant/public/functions/index.ts index a077c24748997a..47aaba888d26c0 100644 --- a/x-pack/plugins/observability_ai_assistant/public/functions/index.ts +++ b/x-pack/plugins/observability_ai_assistant/public/functions/index.ts @@ -6,25 +6,30 @@ */ import dedent from 'dedent'; +import type { CoreStart } from '@kbn/core/public'; import type { RegisterContextDefinition, RegisterFunctionDefinition } from '../../common/types'; import type { ObservabilityAIAssistantPluginStartDependencies } from '../types'; import type { ObservabilityAIAssistantService } from '../types'; import { registerElasticsearchFunction } from './elasticsearch'; +import { registerKibanaFunction } from './kibana'; import { registerLensFunction } from './lens'; import { registerRecallFunction } from './recall'; import { registerSummarisationFunction } from './summarise'; +import { registerAlertsFunction } from './alerts'; export async function registerFunctions({ registerFunction, registerContext, service, pluginsStart, + coreStart, signal, }: { registerFunction: RegisterFunctionDefinition; registerContext: RegisterContextDefinition; service: ObservabilityAIAssistantService; pluginsStart: ObservabilityAIAssistantPluginStartDependencies; + coreStart: CoreStart; signal: AbortSignal; }) { return service @@ -34,7 +39,7 @@ export async function registerFunctions({ .then((response) => { const isReady = response.ready; - let description = `You have the ability to call Elasticsearch APIs with the "elasticsearch" function or create visualisations using Lens with the "lens" function in the context of this chat.`; + let description = `You have the ability to call Elasticsearch APIs with the "elasticsearch" function or create visualisations using Lens with the "lens" function in the context of this chat. Use the Elasticsearch function only when requested by the user.`; if (isReady) { description += `You can use the "summarise" functions to store new information you have learned in a knowledge database. Once you have established that you did not know the answer to a question, and the user gave you this information, it's important that you create a summarisation of what you have learned and store it in the knowledge database. When you create this summarisation, make sure you craft it in a way that can be recalled with a semantic search later. @@ -70,6 +75,8 @@ export async function registerFunctions({ } registerElasticsearchFunction({ service, registerFunction }); + registerKibanaFunction({ service, registerFunction, coreStart }); + registerAlertsFunction({ service, registerFunction }); registerContext({ name: 'core', diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/kibana.ts b/x-pack/plugins/observability_ai_assistant/public/functions/kibana.ts new file mode 100644 index 00000000000000..5ad877b2c2bff2 --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/public/functions/kibana.ts @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { CoreStart } from '@kbn/core/public'; +import type { RegisterFunctionDefinition } from '../../common/types'; +import type { ObservabilityAIAssistantService } from '../types'; + +export function registerKibanaFunction({ + service, + registerFunction, + coreStart, +}: { + service: ObservabilityAIAssistantService; + registerFunction: RegisterFunctionDefinition; + coreStart: CoreStart; +}) { + registerFunction( + { + name: 'kibana', + contexts: ['core'], + description: + 'Call Kibana APIs on behalf of the user. Only call this function when the user has explicitly requested it, and you know how to call it, for example by querying the knowledge base or having the user explain it to you. Assume that pathnames, bodies and query parameters may have changed since your knowledge cut off date.', + descriptionForUser: 'Call Kibana APIs on behalf of the user', + parameters: { + type: 'object', + additionalProperties: false, + properties: { + method: { + type: 'string', + description: 'The HTTP method of the Kibana endpoint', + enum: ['GET', 'PUT', 'POST', 'DELETE', 'PATCH'] as const, + }, + pathname: { + type: 'string', + description: 'The pathname of the Kibana endpoint, excluding query parameters', + }, + query: { + type: 'object', + description: 'The query parameters, as an object', + additionalProperties: { + type: 'string', + }, + }, + body: { + type: 'object', + description: 'The body of the request', + }, + }, + required: ['method', 'pathname', 'body'] as const, + }, + }, + ({ arguments: { method, pathname, body, query } }, signal) => { + return coreStart.http + .fetch(pathname, { + method, + body: body ? JSON.stringify(body) : undefined, + query, + signal, + }) + .then((response) => { + return { content: response }; + }); + } + ); +} diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/lens.tsx b/x-pack/plugins/observability_ai_assistant/public/functions/lens.tsx index b25c3a3717c609..9c283f290b8df3 100644 --- a/x-pack/plugins/observability_ai_assistant/public/functions/lens.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/functions/lens.tsx @@ -106,11 +106,13 @@ export function registerLensFunction({ 'Use this function to create custom visualisations, using Lens, that can be saved to dashboards.', parameters: { type: 'object', + additionalProperties: false, properties: { layers: { type: 'array', items: { type: 'object', + additionalProperties: false, properties: { label: { type: 'string', @@ -126,6 +128,7 @@ export function registerLensFunction({ }, format: { type: 'object', + additionalProperties: false, properties: { id: { type: 'string', @@ -149,6 +152,7 @@ export function registerLensFunction({ }, breakdown: { type: 'object', + additionalProperties: false, properties: { field: { type: 'string', diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/recall.ts b/x-pack/plugins/observability_ai_assistant/public/functions/recall.ts index a571287acf8b24..cefb0a713e2a53 100644 --- a/x-pack/plugins/observability_ai_assistant/public/functions/recall.ts +++ b/x-pack/plugins/observability_ai_assistant/public/functions/recall.ts @@ -25,6 +25,7 @@ export function registerRecallFunction({ descriptionForUser: 'This function allows the assistant to recall previous learnings.', parameters: { type: 'object', + additionalProperties: false, properties: { query: { type: 'string', diff --git a/x-pack/plugins/observability_ai_assistant/public/functions/summarise.ts b/x-pack/plugins/observability_ai_assistant/public/functions/summarise.ts index 3fe55385a74ff3..010cdb608fde04 100644 --- a/x-pack/plugins/observability_ai_assistant/public/functions/summarise.ts +++ b/x-pack/plugins/observability_ai_assistant/public/functions/summarise.ts @@ -25,6 +25,7 @@ export function registerSummarisationFunction({ 'This function allows the Elastic Assistant to summarise things from the conversation.', parameters: { type: 'object', + additionalProperties: false, properties: { id: { type: 'string', @@ -73,6 +74,7 @@ export function registerSummarisationFunction({ is_correction: isCorrection, confidence, public: isPublic, + labels: {}, }, }, signal, diff --git a/x-pack/plugins/observability_ai_assistant/public/plugin.tsx b/x-pack/plugins/observability_ai_assistant/public/plugin.tsx index 88853a5ce1bcd6..965a97e4a0a870 100644 --- a/x-pack/plugins/observability_ai_assistant/public/plugin.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/plugin.tsx @@ -107,6 +107,7 @@ export class ObservabilityAIAssistantPlugin service, signal, pluginsStart, + coreStart, registerContext, registerFunction, }); diff --git a/x-pack/plugins/observability_ai_assistant/public/service/get_assistant_setup_message.ts b/x-pack/plugins/observability_ai_assistant/public/service/get_assistant_setup_message.ts index b1e25233e9c3b3..da3f5f9947b0f7 100644 --- a/x-pack/plugins/observability_ai_assistant/public/service/get_assistant_setup_message.ts +++ b/x-pack/plugins/observability_ai_assistant/public/service/get_assistant_setup_message.ts @@ -16,7 +16,13 @@ export function getAssistantSetupMessage({ contexts }: { contexts: ContextDefini role: MessageRole.System as const, content: [ dedent( - `You are a helpful assistant for Elastic Observability. Your goal is to help the Elastic Observability users to quickly assess what is happening in their observed systems. You can help them visualise and analyze data, investigate their systems, perform root cause analysis or identify optimisation opportunities.` + `You are a helpful assistant for Elastic Observability. Your goal is to help the Elastic Observability users to quickly assess what is happening in their observed systems. You can help them visualise and analyze data, investigate their systems, perform root cause analysis or identify optimisation opportunities. + + It's very important to not assume what the user is meaning. Ask them for clarification if needed. + + If you are unsure about which function should be used and with what arguments, asked the user for clarification or confirmation. + + You can use (Github-flavored) Markdown in your responses. Use it to nicely format output, like a table.` ), ] .concat(contexts.map((context) => context.description)) diff --git a/x-pack/plugins/observability_ai_assistant/server/plugin.ts b/x-pack/plugins/observability_ai_assistant/server/plugin.ts index b13f22fd2fda00..01bd4fafb71c70 100644 --- a/x-pack/plugins/observability_ai_assistant/server/plugin.ts +++ b/x-pack/plugins/observability_ai_assistant/server/plugin.ts @@ -31,6 +31,7 @@ import { ObservabilityAIAssistantPluginSetupDependencies, ObservabilityAIAssistantPluginStartDependencies, } from './types'; +import { addLensDocsToKb } from './service/kb_service/kb_docs/lens'; export class ObservabilityAIAssistantPlugin implements @@ -114,7 +115,7 @@ export class ObservabilityAIAssistantPlugin taskManager: plugins.taskManager, }); - // addLensDocsToKb(service); + addLensDocsToKb(service); registerServerRoutes({ core, diff --git a/x-pack/plugins/observability_ai_assistant/server/routes/functions/route.ts b/x-pack/plugins/observability_ai_assistant/server/routes/functions/route.ts index 954262c5a03bee..c88070d00a137b 100644 --- a/x-pack/plugins/observability_ai_assistant/server/routes/functions/route.ts +++ b/x-pack/plugins/observability_ai_assistant/server/routes/functions/route.ts @@ -4,11 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import * as t from 'io-ts'; -import { nonEmptyStringRt, toBooleanRt } from '@kbn/io-ts-utils'; +import datemath from '@elastic/datemath'; import { notImplemented } from '@hapi/boom'; +import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; +import { nonEmptyStringRt, toBooleanRt } from '@kbn/io-ts-utils'; +import * as t from 'io-ts'; +import { omit } from 'lodash'; +import { ParsedTechnicalFields } from '@kbn/rule-registry-plugin/common'; +import type { KnowledgeBaseEntry } from '../../../common/types'; import { createObservabilityAIAssistantServerRoute } from '../create_observability_ai_assistant_server_route'; -import { KnowledgeBaseEntry } from '../../../common/types'; const functionElasticsearchRoute = createObservabilityAIAssistantServerRoute({ endpoint: 'POST /internal/observability_ai_assistant/functions/elasticsearch', @@ -47,6 +51,94 @@ const functionElasticsearchRoute = createObservabilityAIAssistantServerRoute({ }, }); +const OMITTED_ALERT_FIELDS = [ + 'tags', + 'event.action', + 'event.kind', + 'kibana.alert.rule.execution.uuid', + 'kibana.alert.rule.revision', + 'kibana.alert.rule.tags', + 'kibana.alert.rule.uuid', + 'kibana.alert.workflow_status', + 'kibana.space_ids', + 'kibana.alert.time_range', + 'kibana.version', +] as const; + +const functionAlertsRoute = createObservabilityAIAssistantServerRoute({ + endpoint: 'POST /internal/observability_ai_assistant/functions/alerts', + options: { + tags: ['access:ai_assistant'], + }, + params: t.type({ + body: t.intersection([ + t.type({ + featureIds: t.array(t.string), + start: t.string, + end: t.string, + }), + t.partial({ + filter: t.string, + }), + ]), + }), + handler: async ( + resources + ): Promise<{ + content: { + total: number; + alerts: ParsedTechnicalFields[]; + }; + }> => { + const { + featureIds, + start: startAsDatemath, + end: endAsDatemath, + filter, + } = resources.params.body; + + const racContext = await resources.context.rac; + const alertsClient = await racContext.getAlertsClient(); + + const start = datemath.parse(startAsDatemath)!.valueOf(); + const end = datemath.parse(endAsDatemath)!.valueOf(); + + const kqlQuery = !filter ? [] : [toElasticsearchQuery(fromKueryExpression(filter))]; + + const response = await alertsClient.find({ + featureIds, + + query: { + bool: { + filter: [ + { + range: { + '@timestamp': { + gte: start, + lte: end, + }, + }, + }, + ...kqlQuery, + ], + }, + }, + }); + + // trim some fields + const alerts = response.hits.hits.map((hit) => + omit(hit._source, ...OMITTED_ALERT_FIELDS) + ) as unknown as ParsedTechnicalFields[]; + + return { + content: { + total: (response.hits as { total: { value: number } }).total.value, + alerts, + }, + }; + }, +}); + const functionRecallRoute = createObservabilityAIAssistantServerRoute({ endpoint: 'POST /internal/observability_ai_assistant/functions/recall', params: t.type({ @@ -57,7 +149,9 @@ const functionRecallRoute = createObservabilityAIAssistantServerRoute({ options: { tags: ['access:ai_assistant'], }, - handler: async (resources): Promise<{ entries: KnowledgeBaseEntry[] }> => { + handler: async ( + resources + ): Promise<{ entries: Array> }> => { const client = await resources.service.getClient({ request: resources.request }); if (!client) { @@ -77,6 +171,7 @@ const functionSummariseRoute = createObservabilityAIAssistantServerRoute({ confidence: t.union([t.literal('low'), t.literal('medium'), t.literal('high')]), is_correction: toBooleanRt, public: toBooleanRt, + labels: t.record(t.string, t.string), }), }), options: { @@ -95,6 +190,7 @@ const functionSummariseRoute = createObservabilityAIAssistantServerRoute({ is_correction: isCorrection, text, public: isPublic, + labels, } = resources.params.body; return client.summarise({ @@ -104,6 +200,7 @@ const functionSummariseRoute = createObservabilityAIAssistantServerRoute({ is_correction: isCorrection, text, public: isPublic, + labels, }, }); }, @@ -159,4 +256,5 @@ export const functionRoutes = { ...functionSummariseRoute, ...setupKnowledgeBaseRoute, ...getKnowledgeBaseStatus, + ...functionAlertsRoute, }; diff --git a/x-pack/plugins/observability_ai_assistant/server/routes/types.ts b/x-pack/plugins/observability_ai_assistant/server/routes/types.ts index e1c256aefcb0e2..1766f5c2d55428 100644 --- a/x-pack/plugins/observability_ai_assistant/server/routes/types.ts +++ b/x-pack/plugins/observability_ai_assistant/server/routes/types.ts @@ -5,17 +5,22 @@ * 2.0. */ +import type { CustomRequestHandlerContext, KibanaRequest } from '@kbn/core/server'; import type { Logger } from '@kbn/logging'; -import type { KibanaRequest, RequestHandlerContext } from '@kbn/core/server'; +import type { RacApiRequestHandlerContext } from '@kbn/rule-registry-plugin/server'; +import type { ObservabilityAIAssistantService } from '../service'; import type { ObservabilityAIAssistantPluginSetupDependencies, ObservabilityAIAssistantPluginStartDependencies, } from '../types'; -import type { ObservabilityAIAssistantService } from '../service'; + +export type ObservabilityAIAssistantRequestHandlerContext = CustomRequestHandlerContext<{ + rac: RacApiRequestHandlerContext; +}>; export interface ObservabilityAIAssistantRouteHandlerResources { request: KibanaRequest; - context: RequestHandlerContext; + context: ObservabilityAIAssistantRequestHandlerContext; logger: Logger; service: ObservabilityAIAssistantService; plugins: { diff --git a/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts b/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts index ceb04475e8563b..3e574ca9682f85 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts @@ -312,7 +312,9 @@ export class ObservabilityAIAssistantClient { return createdConversation; }; - recall = async (query: string): Promise<{ entries: KnowledgeBaseEntry[] }> => { + recall = async ( + query: string + ): Promise<{ entries: Array> }> => { return this.dependencies.knowledgeBaseService.recall({ namespace: this.dependencies.namespace, user: this.dependencies.user, diff --git a/x-pack/plugins/observability_ai_assistant/server/service/index.ts b/x-pack/plugins/observability_ai_assistant/server/service/index.ts index 2ce0868aefd307..e3a0eb9f154695 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/index.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/index.ts @@ -13,13 +13,13 @@ import type { SecurityPluginStart } from '@kbn/security-plugin/server'; import { getSpaceIdFromPath } from '@kbn/spaces-plugin/common'; import type { TaskManagerSetupContract } from '@kbn/task-manager-plugin/server'; import { once } from 'lodash'; -import { KnowledgeBaseEntry } from '../../common/types'; import type { ObservabilityAIAssistantPluginStartDependencies } from '../types'; import { ObservabilityAIAssistantClient } from './client'; import { conversationComponentTemplate } from './conversation_component_template'; import { kbComponentTemplate } from './kb_component_template'; -import { KnowledgeBaseService } from './kb_service'; +import { KnowledgeBaseEntryOperationType, KnowledgeBaseService } from './kb_service'; import type { ObservabilityAIAssistantResourceNames } from './types'; +import { splitKbText } from './util/split_kb_text'; function getResourceName(resource: string) { return `.kibana-observability-ai-assistant-${resource}`; @@ -82,7 +82,7 @@ export class ObservabilityAIAssistantService { return { run: async () => { if (this.kbService) { - // await this.kbService.processQueue(); + await this.kbService.processQueue(); } }, }; @@ -256,20 +256,52 @@ export class ObservabilityAIAssistantService { }); } - async addToKnowledgeBase( + addToKnowledgeBase( entries: Array< - Omit + | { + id: string; + text: string; + } + | { + id: string; + texts: string[]; + } > - ): Promise { - await this.init(); - this.kbService!.store( - entries.map((entry) => ({ - ...entry, - '@timestamp': new Date().toISOString(), - public: true, - confidence: 'high', - is_correction: false, - })) - ); + ): void { + this.init() + .then(() => { + this.kbService!.queue( + entries.flatMap((entry) => { + const entryWithSystemProperties = { + ...entry, + '@timestamp': new Date().toISOString(), + public: true, + confidence: 'high' as const, + is_correction: false, + labels: { + document_id: entry.id, + }, + }; + + const operations = + 'texts' in entryWithSystemProperties + ? splitKbText(entryWithSystemProperties) + : [ + { + type: KnowledgeBaseEntryOperationType.Index, + document: entryWithSystemProperties, + }, + ]; + + return operations; + }) + ); + }) + .catch((error) => { + this.logger.error( + `Could not index ${entries.length} entries because of an initialisation error` + ); + this.logger.error(error); + }); } } diff --git a/x-pack/plugins/observability_ai_assistant/server/service/kb_component_template.ts b/x-pack/plugins/observability_ai_assistant/server/service/kb_component_template.ts index 55d6bbd15519ce..8d0e5ff423b2ca 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/kb_component_template.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/kb_component_template.ts @@ -20,6 +20,11 @@ const date = { type: 'date' as const, }; +const dynamic = { + type: 'object' as const, + dynamic: true, +}; + export const kbComponentTemplate: ClusterComponentTemplate['component_template']['template'] = { mappings: { dynamic: false, @@ -32,6 +37,7 @@ export const kbComponentTemplate: ClusterComponentTemplate['component_template'] name: keyword, }, }, + labels: dynamic, conversation: { properties: { id: keyword, diff --git a/x-pack/plugins/observability_ai_assistant/server/service/kb_service/index.ts b/x-pack/plugins/observability_ai_assistant/server/service/kb_service/index.ts index deed5c41fd4803..d680b121cb16cb 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/kb_service/index.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/kb_service/index.ts @@ -9,9 +9,10 @@ import type { QueryDslTextExpansionQuery } from '@elastic/elasticsearch/lib/api/ import { serverUnavailable } from '@hapi/boom'; import type { ElasticsearchClient } from '@kbn/core/server'; import type { Logger } from '@kbn/logging'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; import pLimit from 'p-limit'; import pRetry from 'p-retry'; +import { map } from 'lodash'; import { INDEX_QUEUED_DOCUMENTS_TASK_ID, INDEX_QUEUED_DOCUMENTS_TASK_TYPE } from '..'; import type { KnowledgeBaseEntry } from '../../../common/types'; import type { ObservabilityAIAssistantResourceNames } from '../types'; @@ -30,10 +31,30 @@ function throwKnowledgeBaseNotReady(body: any) { throw serverUnavailable(`Knowledge base is not ready yet`, body); } +export enum KnowledgeBaseEntryOperationType { + Index = 'index', + Delete = 'delete', +} + +interface KnowledgeBaseDeleteOperation { + type: KnowledgeBaseEntryOperationType.Delete; + id?: string; + labels?: Record; +} + +interface KnowledgeBaseIndexOperation { + type: KnowledgeBaseEntryOperationType.Index; + document: KnowledgeBaseEntry; +} + +export type KnowledgeBaseEntryOperation = + | KnowledgeBaseDeleteOperation + | KnowledgeBaseIndexOperation; + export class KnowledgeBaseService { private hasSetup: boolean = false; - private entryQueue: KnowledgeBaseEntry[] = []; + private _queue: KnowledgeBaseEntryOperation[] = []; constructor(private readonly dependencies: Dependencies) { this.ensureTaskScheduled(); @@ -51,65 +72,92 @@ export class KnowledgeBaseService { }, }) .then(() => { - this.dependencies.logger.debug('Scheduled document queue task'); + this.dependencies.logger.debug('Scheduled queue task'); return this.dependencies.taskManagerStart.runSoon(INDEX_QUEUED_DOCUMENTS_TASK_ID); }) .then(() => { - this.dependencies.logger.debug('Document queue task ran'); + this.dependencies.logger.debug('Queue task ran'); }) .catch((err) => { - this.dependencies.logger.error(`Failed to schedule document queue task`); + this.dependencies.logger.error(`Failed to schedule queue task`); this.dependencies.logger.error(err); }); } + private async processOperation(operation: KnowledgeBaseEntryOperation) { + if (operation.type === KnowledgeBaseEntryOperationType.Delete) { + await this.dependencies.esClient.deleteByQuery({ + index: this.dependencies.resources.aliases.kb, + query: { + bool: { + filter: [ + ...(operation.id ? [{ term: { _id: operation.id } }] : []), + ...(operation.labels + ? map(operation.labels, (value, key) => { + return { term: { [key]: value } }; + }) + : []), + ], + }, + }, + }); + return; + } + + await this.summarise({ + entry: operation.document, + }); + } + async processQueue() { - if (!this.entryQueue.length) { + if (!this._queue.length) { return; } if (!(await this.status()).ready) { - this.dependencies.logger.debug(`Bailing on document queue task: KB is not ready yet`); + this.dependencies.logger.debug(`Bailing on queue task: KB is not ready yet`); return; } - this.dependencies.logger.debug(`Processing document queue`); + this.dependencies.logger.debug(`Processing queue`); this.hasSetup = true; - this.dependencies.logger.info(`Indexing ${this.entryQueue.length} queued entries into KB`); + this.dependencies.logger.info(`Processing ${this._queue.length} queue operations`); const limiter = pLimit(5); - const entries = this.entryQueue.concat(); + const operations = this._queue.concat(); await Promise.all( - entries.map((entry) => - limiter(() => { - this.entryQueue.splice(entries.indexOf(entry), 1); - return this.summarise({ entry }); + operations.map((operation) => + limiter(async () => { + this._queue.splice(operations.indexOf(operation), 1); + await this.processOperation(operation); }) ) ); - this.dependencies.logger.info('Indexed all queued entries into KB'); + this.dependencies.logger.info('Processed all queued operations'); } - async store(entries: KnowledgeBaseEntry[]) { - if (!entries.length) { + queue(operations: KnowledgeBaseEntryOperation[]): void { + if (!operations.length) { return; } if (!this.hasSetup) { - this.entryQueue.push(...entries); + this._queue.push(...operations); return; } const limiter = pLimit(5); - const limitedFunctions = entries.map((entry) => limiter(() => this.summarise({ entry }))); + const limitedFunctions = this._queue.map((operation) => + limiter(() => this.processOperation(operation)) + ); Promise.all(limitedFunctions).catch((err) => { - this.dependencies.logger.error(`Failed to index all knowledge base entries`); + this.dependencies.logger.error(`Failed to process all queued operations`); this.dependencies.logger.error(err); }); } @@ -122,9 +170,11 @@ export class KnowledgeBaseService { query: string; user: { name: string }; namespace: string; - }): Promise<{ entries: KnowledgeBaseEntry[] }> => { + }): Promise<{ entries: Array> }> => { try { - const response = await this.dependencies.esClient.search({ + const response = await this.dependencies.esClient.search< + Pick + >({ index: this.dependencies.resources.aliases.kb, query: { bool: { @@ -185,6 +235,7 @@ export class KnowledgeBaseService { namespace, }, pipeline: this.dependencies.resources.pipelines.kb, + refresh: false, }); } catch (error) { if (error instanceof errors.ResponseError && error.body.error.type === 'status_exception') { @@ -261,8 +312,13 @@ export class KnowledgeBaseService { wait_for: 'fully_allocated', }); } catch (error) { + this.dependencies.logger.debug('Error starting model deployment'); + this.dependencies.logger.debug(error); if ( - !(error instanceof errors.ResponseError && error.body.error.type === 'status_exception') + !( + (error instanceof errors.ResponseError && error.body.error.type === 'status_exception') || + error.body.error.type === 'resource_not_found_exception' + ) ) { throw error; } @@ -282,10 +338,11 @@ export class KnowledgeBaseService { } this.dependencies.logger.debug('Model is not allocated yet'); + this.dependencies.logger.debug(JSON.stringify(response)); return Promise.reject(new Error('Not Ready')); }, - { factor: 1, minTimeout: 10000, maxRetryTime: 20 * 60 * 1000 } + { factor: 1, minTimeout: 10000, retries: 12 } ); this.dependencies.logger.info('Model is ready'); diff --git a/x-pack/plugins/observability_ai_assistant/server/service/kb_service/kb_docs/lens.ts b/x-pack/plugins/observability_ai_assistant/server/service/kb_service/kb_docs/lens.ts index aa0c6e3ffb9373..e4fdc8969c0104 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/kb_service/kb_docs/lens.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/kb_service/kb_docs/lens.ts @@ -12,9 +12,8 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { service.addToKnowledgeBase([ { id: 'lens_formulas_how_it_works', - text: dedent(`## How it works - - Lens formulas let you do math using a combination of Elasticsearch aggregations and + texts: [ + `Lens formulas let you do math using a combination of Elasticsearch aggregations and math functions. There are three main types of functions: * Elasticsearch metrics, like \`sum(bytes)\` @@ -30,8 +29,8 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { kql='datacenter.name: east*' )) \`\`\` - - Elasticsearch functions take a field name, which can be in quotes. \`sum(bytes)\` is the same + `, + `Elasticsearch functions take a field name, which can be in quotes. \`sum(bytes)\` is the same as \`sum('bytes')\`. Some functions take named arguments, like \`moving_average(count(), window=5)\`. @@ -42,25 +41,23 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Math functions can take positional arguments, like pow(count(), 3) is the same as count() * count() * count() - Use the symbols +, -, /, and * to perform basic math.`), + Use the symbols +, -, /, and * to perform basic math.`, + ], }, { id: 'lens_common_formulas', - text: dedent(`## Common formulas - - The most common formulas are dividing two values to produce a percent. To display accurately, set - "value format" to "percent". - - ### Filter ratio: + texts: [ + `The most common formulas are dividing two values to produce a percent. To display accurately, set + "value format" to "percent"`, + `### Filter ratio: Use \`kql=''\` to filter one set of documents and compare it to other documents within the same grouping. For example, to see how the error rate changes over time: \`\`\` count(kql='response.status_code > 400') / count() - \`\`\` - - ### Week over week: + \`\`\``, + `### Week over week: Use \`shift='1w'\` to get the value of each grouping from the previous week. Time shift should not be used with the *Top values* function. @@ -68,18 +65,18 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { \`\`\` percentile(system.network.in.bytes, percentile=99) / percentile(system.network.in.bytes, percentile=99, shift='1w') - \`\`\` + \`\`\``, - ### Percent of total + `### Percent of total Formulas can calculate \`overall_sum\` for all the groupings, which lets you convert each grouping into a percent of total: \`\`\` sum(products.base_price) / overall_sum(sum(products.base_price)) - \`\`\` + \`\`\``, - ### Recent change + `### Recent change Use \`reducedTimeRange='30m'\` to add an additional filter on the time range of a metric aligned with the end of the global time range. @@ -88,27 +85,28 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { \`\`\` max(system.network.in.bytes, reducedTimeRange="30m") - min(system.network.in.bytes, reducedTimeRange="30m") - \`\`\` - - `), + \`\`\` + `, + ], }, { id: 'lens_formulas_elasticsearch_functions', - text: dedent(`## Elasticsearch functions + texts: [ + `## Elasticsearch functions These functions will be executed on the raw documents for each row of the resulting table, aggregating all documents matching the break down - dimensions into a single value. + dimensions into a single value.`, - #### average(field: string) + `#### average(field: string) Returns the average of a field. This function only works for number fields. Example: Get the average of price: \`average(price)\` Example: Get the average of price for orders from the UK: \`average(price, - kql='location:UK')\` + kql='location:UK')\``, - #### count([field: string]) + `#### count([field: string]) The total number of documents. When you provide a field, the total number of field values is counted. When you use the Count function for fields that have multiple values in a single document, all values are counted. @@ -118,57 +116,57 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { To calculate the number of products in all orders, use \`count(products.id)\`. To calculate the number of documents that match a specific filter, use - \`count(kql='price > 500')\`. + \`count(kql='price > 500')\`.`, - #### last_value(field: string) + `#### last_value(field: string) Returns the value of a field from the last document, ordered by the default time field of the data view. This function is usefull the retrieve the latest state of an entity. Example: Get the current status of server A: \`last_value(server.status, - kql='server.name="A"')\` + kql='server.name="A"')\``, - #### max(field: string) + `#### max(field: string) Returns the max of a field. This function only works for number fields. Example: Get the max of price: \`max(price)\` Example: Get the max of price for orders from the UK: \`max(price, - kql='location:UK')\` + kql='location:UK')\``, - #### median(field: string) + `#### median(field: string) Returns the median of a field. This function only works for number fields. Example: Get the median of price: \`median(price)\` Example: Get the median of price for orders from the UK: \`median(price, - kql='location:UK')\` + kql='location:UK')\``, - #### min(field: string) + `#### min(field: string) Returns the min of a field. This function only works for number fields. Example: Get the min of price: \`min(price)\` Example: Get the min of price for orders from the UK: \`min(price, - kql='location:UK')\` + kql='location:UK')\``, - #### percentile(field: string, [percentile]: number) + `#### percentile(field: string, [percentile]: number) Returns the specified percentile of the values of a field. This is the value n percent of the values occuring in documents are smaller. Example: Get the number of bytes larger than 95 % of values: - \`percentile(bytes, percentile=95)\` + \`percentile(bytes, percentile=95)\``, - #### percentile_rank(field: string, [value]: number) + `#### percentile_rank(field: string, [value]: number) Returns the percentage of values which are below a certain value. For example, if a value is greater than or equal to 95% of the observed values it is said to be at the 95th percentile rank Example: Get the percentage of values which are below of 100: - \`percentile_rank(bytes, value=100)\` + \`percentile_rank(bytes, value=100)\``, - #### standard_deviation(field: string) + `#### standard_deviation(field: string) Returns the amount of variation or dispersion of the field. The function works only for number fields. @@ -176,17 +174,17 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { \`standard_deviation(price).\` Example: To get the variance of price for orders from the UK, use - \`square(standard_deviation(price, kql='location:UK'))\`. + \`square(standard_deviation(price, kql='location:UK'))\`.`, - #### sum(field: string) + `#### sum(field: string) Returns the sum of a field. This function only works for number fields. Example: Get the sum of price: sum(price) Example: Get the sum of price for orders from the UK: \`sum(price, - kql='location:UK')\` + kql='location:UK')\``, - #### unique_count(field: string) + `#### unique_count(field: string) Calculates the number of unique values of a specified field. Works for number, string, date and boolean values. @@ -196,15 +194,17 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Example: Calculate the number of different products from the "clothes" group: \`unique_count(product.name, kql='product.group=clothes')\` - `), + `, + ], }, { id: 'lens_formulas_column_functions', - text: dedent(`## Column calculations + texts: [ + `## Column calculations These functions are executed for each row, but are provided with the whole - column as context. This is also known as a window function. - - #### counter_rate(metric: number) + column as context. This is also known as a window function.`, + + `#### counter_rate(metric: number) Calculates the rate of an ever increasing counter. This function will only yield helpful results on counter metric fields which contain a measurement of some kind monotonically growing over time. If the value does get smaller, it @@ -215,9 +215,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { or top values dimensions. It uses the current interval when used in Formula. Example: Visualize the rate of bytes received over time by a memcached server: - counter_rate(max(memcached.stats.read.bytes)) - - cumulative_sum(metric: number) + counter_rate(max(memcached.stats.read.bytes))`, + + `cumulative_sum(metric: number) Calculates the cumulative sum of a metric over time, adding all previous values of a series to each value. To use this function, you need to configure a date histogram dimension as well. @@ -226,9 +226,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { or top values dimensions. Example: Visualize the received bytes accumulated over time: - cumulative_sum(sum(bytes)) - - differences(metric: number) + cumulative_sum(sum(bytes))`, + + `differences(metric: number) Calculates the difference to the last value of a metric over time. To use this function, you need to configure a date histogram dimension as well. Differences requires the data to be sequential. If your data is empty when using @@ -238,9 +238,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { or top values dimensions. Example: Visualize the change in bytes received over time: - differences(sum(bytes)) - - moving_average(metric: number, [window]: number) + differences(sum(bytes))`, + + `moving_average(metric: number, [window]: number) Calculates the moving average of a metric over time, averaging the last n-th values to calculate the current value. To use this function, you need to configure a date histogram dimension as well. The default window value is 5. @@ -251,9 +251,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Takes a named parameter window which specifies how many last values to include in the average calculation for the current value. - Example: Smooth a line of measurements: moving_average(sum(bytes), window=5) - - normalize_by_unit(metric: number, unit: s|m|h|d|w|M|y) + Example: Smooth a line of measurements: moving_average(sum(bytes), window=5)`, + + `normalize_by_unit(metric: number, unit: s|m|h|d|w|M|y) This advanced function is useful for normalizing counts and sums to a specific time interval. It allows for integration with metrics that are stored already normalized to a specific time interval. @@ -264,9 +264,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Example: A ratio comparing an already normalized metric to another metric that needs to be normalized. normalize_by_unit(counter_rate(max(system.diskio.write.bytes)), unit='s') / - last_value(apache.status.bytes_per_second) - - overall_average(metric: number) + last_value(apache.status.bytes_per_second)`, + + `overall_average(metric: number) Calculates the average of a metric for all data points of a series in the current chart. A series is defined by a dimension using a date histogram or interval function. Other dimensions breaking down the data like top values or @@ -276,9 +276,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { overall_average is calculating the average over all dimensions no matter the used function - Example: Divergence from the mean: sum(bytes) - overall_average(sum(bytes)) - - overall_max(metric: number) + Example: Divergence from the mean: sum(bytes) - overall_average(sum(bytes))`, + + `overall_max(metric: number) Calculates the maximum of a metric for all data points of a series in the current chart. A series is defined by a dimension using a date histogram or interval function. Other dimensions breaking down the data like top values or @@ -289,9 +289,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { function Example: Percentage of range (sum(bytes) - overall_min(sum(bytes))) / - (overall_max(sum(bytes)) - overall_min(sum(bytes))) - - overall_min(metric: number) + (overall_max(sum(bytes)) - overall_min(sum(bytes)))`, + + `overall_min(metric: number) Calculates the minimum of a metric for all data points of a series in the current chart. A series is defined by a dimension using a date histogram or interval function. Other dimensions breaking down the data like top values or @@ -302,9 +302,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { function Example: Percentage of range (sum(bytes) - overall_min(sum(bytes)) / - (overall_max(sum(bytes)) - overall_min(sum(bytes))) - - overall_sum(metric: number) + (overall_max(sum(bytes)) - overall_min(sum(bytes)))`, + + `overall_sum(metric: number) Calculates the sum of a metric of all data points of a series in the current chart. A series is defined by a dimension using a date histogram or interval function. Other dimensions breaking down the data like top values or filter are @@ -314,19 +314,21 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { overall_sum is calculating the sum over all dimensions no matter the used function. - Example: Percentage of total sum(bytes) / overall_sum(sum(bytes))`), + Example: Percentage of total sum(bytes) / overall_sum(sum(bytes))`, + ], }, { id: 'lens_formulas_math_functions', - text: dedent(`Math - These functions will be executed for reach row of the resulting table using single values from the same row calculated using other functions. - - abs([value]: number) + texts: [ + `Math + These functions will be executed for reach row of the resulting table using single values from the same row calculated using other functions.`, + + `abs([value]: number) Calculates absolute value. A negative value is multiplied by -1, a positive value stays the same. - Example: Calculate average distance to sea level abs(average(altitude)) - - add([left]: number, [right]: number) + Example: Calculate average distance to sea level abs(average(altitude))`, + + `add([left]: number, [right]: number) Adds up two numbers. Also works with + symbol. @@ -337,9 +339,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Example: Offset count by a static value - add(count(), 5) - - cbrt([value]: number) + add(count(), 5)`, + + `cbrt([value]: number) Cube root of value. Example: Calculate side length from volume @@ -351,9 +353,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Example: Round up price to the next dollar - ceil(sum(price)) - - clamp([value]: number, [min]: number, [max]: number) + ceil(sum(price))`, + + `clamp([value]: number, [min]: number, [max]: number) Limits the value from a minimum to maximum. Example: Make sure to catch outliers @@ -362,22 +364,22 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { average(bytes), percentile(bytes, percentile=5), percentile(bytes, percentile=95) - ) - cube([value]: number) + )`, + `cube([value]: number) Calculates the cube of a number. Example: Calculate volume from side length - cube(last_value(length)) - - defaults([value]: number, [default]: number) + cube(last_value(length))`, + + `defaults([value]: number, [default]: number) Returns a default numeric value when value is null. Example: Return -1 when a field has no data - defaults(average(bytes), -1) - - divide([left]: number, [right]: number) + defaults(average(bytes), -1)`, + + `divide([left]: number, [right]: number) Divides the first number by the second number. Also works with / symbol @@ -386,44 +388,44 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { sum(profit) / sum(revenue) - Example: divide(sum(bytes), 2) - - exp([value]: number) + Example: divide(sum(bytes), 2)`, + + `exp([value]: number) Raises e to the nth power. Example: Calculate the natural exponential function - exp(last_value(duration)) - - fix([value]: number) + exp(last_value(duration))`, + + `fix([value]: number) For positive values, takes the floor. For negative values, takes the ceiling. Example: Rounding towards zero - fix(sum(profit)) - - floor([value]: number) + fix(sum(profit))`, + + `floor([value]: number) Round down to nearest integer value Example: Round down a price - floor(sum(price)) - - log([value]: number, [base]?: number) + floor(sum(price))`, + + `log([value]: number, [base]?: number) Logarithm with optional base. The natural base e is used as default. Example: Calculate number of bits required to store values log(sum(bytes)) - log(sum(bytes), 2) - mod([value]: number, [base]: number) + log(sum(bytes), 2)`, + `mod([value]: number, [base]: number) Remainder after dividing the function by a number Example: Calculate last three digits of a value - mod(sum(price), 1000) - - multiply([left]: number, [right]: number) + mod(sum(price), 1000)`, + + `multiply([left]: number, [right]: number) Multiplies two numbers. Also works with * symbol. @@ -434,63 +436,67 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { Example: Calculate price after constant tax rate - multiply(sum(price), 1.2) - - pick_max([left]: number, [right]: number) + multiply(sum(price), 1.2)`, + + `pick_max([left]: number, [right]: number) Finds the maximum value between two numbers. Example: Find the maximum between two fields averages - pick_max(average(bytes), average(memory)) - - pick_min([left]: number, [right]: number) + pick_max(average(bytes), average(memory))`, + + `pick_min([left]: number, [right]: number) Finds the minimum value between two numbers. Example: Find the minimum between two fields averages - pick_min(average(bytes), average(memory)) - - pow([value]: number, [base]: number) + pick_min(average(bytes), average(memory))`, + + `pow([value]: number, [base]: number) Raises the value to a certain power. The second argument is required Example: Calculate volume based on side length - pow(last_value(length), 3) - - round([value]: number, [decimals]?: number) + pow(last_value(length), 3)`, + + `round([value]: number, [decimals]?: number) Rounds to a specific number of decimal places, default of 0 Examples: Round to the cent round(sum(bytes)) - round(sum(bytes), 2) - sqrt([value]: number) + round(sum(bytes), 2)`, + `sqrt([value]: number) Square root of a positive value only Example: Calculate side length based on area - sqrt(last_value(area)) - - square([value]: number) + sqrt(last_value(area))`, + + `square([value]: number) Raise the value to the 2nd power Example: Calculate area based on side length - square(last_value(length)) - - subtract([left]: number, [right]: number) + square(last_value(length))`, + + `subtract([left]: number, [right]: number) Subtracts the first number from the second number. Also works with - symbol. Example: Calculate the range of a field - subtract(max(bytes), min(bytes)) - - Comparison - These functions are used to perform value comparison. - - eq([left]: number, [right]: number) + subtract(max(bytes), min(bytes))`, + ], + }, + { + id: 'lens_formulas_comparison_functions', + texts: [ + `Comparison + These functions are used to perform value comparison.`, + + `eq([left]: number, [right]: number) Performs an equality comparison between two values. To be used as condition for ifelse comparison function. @@ -501,9 +507,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { average(bytes) == average(memory) - Example: eq(sum(bytes), 1000000) - - gt([left]: number, [right]: number) + Example: eq(sum(bytes), 1000000)`, + + `gt([left]: number, [right]: number) Performs a greater than comparison between two values. To be used as condition for ifelse comparison function. @@ -514,9 +520,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { average(bytes) > average(memory) - Example: gt(average(bytes), 1000) - - gte([left]: number, [right]: number) + Example: gt(average(bytes), 1000)`, + + `gte([left]: number, [right]: number) Performs a greater than comparison between two values. To be used as condition for ifelse comparison function. @@ -527,16 +533,16 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { average(bytes) >= average(memory) - Example: gte(average(bytes), 1000) - - ifelse([condition]: boolean, [left]: number, [right]: number) + Example: gte(average(bytes), 1000)`, + + `ifelse([condition]: boolean, [left]: number, [right]: number) Returns a value depending on whether the element of condition is true or false. Example: Average revenue per customer but in some cases customer id is not provided which counts as additional customer - sum(total)/(unique_count(customer_id) + ifelse( count() > count(kql='customer_id:*'), 1, 0)) - - lt([left]: number, [right]: number) + sum(total)/(unique_count(customer_id) + ifelse( count() > count(kql='customer_id:*'), 1, 0))`, + + `lt([left]: number, [right]: number) Performs a lower than comparison between two values. To be used as condition for ifelse comparison function. @@ -547,9 +553,9 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { average(bytes) <= average(memory) - Example: lt(average(bytes), 1000) - - lte([left]: number, [right]: number) + Example: lt(average(bytes), 1000)`, + + `lte([left]: number, [right]: number) Performs a lower than or equal comparison between two values. To be used as condition for ifelse comparison function. @@ -560,7 +566,8 @@ export function addLensDocsToKb(service: ObservabilityAIAssistantService) { average(bytes) <= average(memory) - Example: lte(average(bytes), 1000)`), + Example: lte(average(bytes), 1000)`, + ], }, { id: 'lens_formulas_kibana_context', diff --git a/x-pack/plugins/observability_ai_assistant/server/service/util/split_kb_text.ts b/x-pack/plugins/observability_ai_assistant/server/service/util/split_kb_text.ts new file mode 100644 index 00000000000000..e2b5b7c2c5784c --- /dev/null +++ b/x-pack/plugins/observability_ai_assistant/server/service/util/split_kb_text.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { merge } from 'lodash'; +import type { KnowledgeBaseEntry } from '../../../common/types'; +import { type KnowledgeBaseEntryOperation, KnowledgeBaseEntryOperationType } from '../kb_service'; + +export function splitKbText({ + id, + texts, + ...rest +}: Omit & { texts: string[] }): KnowledgeBaseEntryOperation[] { + return [ + { + type: KnowledgeBaseEntryOperationType.Delete, + labels: { + document_id: id, + }, + }, + ...texts.map((text, index) => ({ + type: KnowledgeBaseEntryOperationType.Index, + document: merge({}, rest, { + id: [id, index].join('_'), + labels: { + document_id: id, + }, + text, + }), + })), + ]; +} diff --git a/x-pack/plugins/observability_ai_assistant/tsconfig.json b/x-pack/plugins/observability_ai_assistant/tsconfig.json index 8c49398e2deab9..ddbd38c21bc5de 100644 --- a/x-pack/plugins/observability_ai_assistant/tsconfig.json +++ b/x-pack/plugins/observability_ai_assistant/tsconfig.json @@ -42,7 +42,9 @@ "@kbn/field-formats-plugin", "@kbn/lens-plugin", "@kbn/data-views-plugin", - "@kbn/task-manager-plugin" + "@kbn/task-manager-plugin", + "@kbn/es-query", + "@kbn/rule-registry-plugin" ], "exclude": ["target/**/*"] }
+ + + {children} + + +
+
+ + {children} + +
+