Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allows AI assistant to get info about available indices and their fields #165952

Merged
merged 35 commits into from
Oct 20, 2023

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Sep 7, 2023

Summary

allow AI assistant to get into about available indices and their fields

get_dataset_info(index?: string)

if index is not passed, list of all indices is returned. if index is given fields for that index are returned.

example screenshot:
screenshot-localhost_5601-2023 09 13-09_54_33

@ppisljar ppisljar marked this pull request as ready for review September 18, 2023 11:33
@ppisljar ppisljar requested a review from a team as a code owner September 18, 2023 11:33
@ppisljar ppisljar changed the title allows AI assistant to get info about available dataviews and their fields allows AI assistant to get info about available indices and their fields Sep 18, 2023
@ppisljar ppisljar added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.11.0 labels Sep 18, 2023
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

I was not able to test it locally but changes look good to me. I think is a great enhancement for the ai assistant and is much more generic that it works with indices instead of dataviews (also will be super helpful for creating ESQL queries as they work with indices and not dataviews)

@stratoula
Copy link
Contributor

I am playing with it. I have a question, here I am giving just a substring of my dataset. I give flights and my index is kibana_sample_data_flights

image

Can we make it smarter and instead of trying to find an exact match return the index(indices) which contain this string ?

@stratoula
Copy link
Contributor

I tested your latest changes Peter and is much better experience now. It is much smarter, I really like it!

@@ -263,6 +271,8 @@ export function registerLensFunction({
},
});

if (!timeField) return;
Copy link
Member

Choose a reason for hiding this comment

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

should we not default to @timestamp in this case? Have you seen the LLM respond with an empty string?

Copy link
Member Author

Choose a reason for hiding this comment

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

for some reason lens function gets executed multiple times sometimes, where first time (or not the last time) is missing properties. seems to be a bug somewhere else in our rendering, but i wasn't able to find it, so i added a check here to make sure we only render the chart once timefield is set.

timefield should actually never be empty as it has default value set.

Copy link
Member

Choose a reason for hiding this comment

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

for some reason lens function gets executed multiple times sometimes, where first time (or not the last time) is missing properties. seems to be a bug somewhere else in our rendering, but i wasn't able to find it, so i added a check here to make sure we only render the chart once timefield is set.

Not sure if I follow. Why is it a problem if it renders multiple times? (I assume it renders multiple times, but to the same element)

Copy link
Member Author

Choose a reason for hiding this comment

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

not on its own, but lens seems to be doing multiple requests then, which is a performance hit if nothing else. i think its safe to not render until we get all the required properties

@dgieselaar dgieselaar requested a review from a team as a code owner October 14, 2023 17:40
@dgieselaar
Copy link
Member

@ppisljar I made some changes - hopefully that's it for now. I no longer compress the fields - the LLM was struggling with decoding the fields and it started hallucinating. As a compromise, I don't send over the field types anymore (when asking the LLM to filter) - I don't think the LLM needs it and that saves a bunch of tokens as well. I feel like it works pretty good now!

@ppisljar
Copy link
Member Author

@dgieselaar sounds good for now, if we figure out we need types we can always add them later and maybe compress the type string to a character or sth.

@ppisljar ppisljar added v8.12.0 and removed v8.11.0 labels Oct 16, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityAIAssistant 217 218 +1

Async chunks

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

id before after diff
observabilityAIAssistant 201.2KB 204.5KB +3.2KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

LGTM on connector changes

@ppisljar ppisljar merged commit 89562db into elastic:main Oct 20, 2023
29 checks passed
benakansara pushed a commit to benakansara/kibana that referenced this pull request Oct 22, 2023
benakansara pushed a commit to benakansara/kibana that referenced this pull request Oct 22, 2023
@ppisljar ppisljar added v8.11.0 and removed backport:skip This commit does not require backporting labels Oct 26, 2023
@ppisljar
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.11

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

ppisljar added a commit to ppisljar/kibana that referenced this pull request Oct 26, 2023
…lds (elastic#165952)

(cherry picked from commit 89562db)

# Conflicts:
#	x-pack/plugins/observability_ai_assistant/public/functions/index.ts
ppisljar added a commit that referenced this pull request Oct 26, 2023
…eir fields (#165952) (#169908)

# Backport

This will backport the following commits from `main` to `8.11`:
- [allows AI assistant to get info about available indices and their
fields (#165952)](#165952)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Peter
Pisljar","email":"peter.pisljar@elastic.co"},"sourceCommit":{"committedDate":"2023-10-20T04:20:06Z","message":"allows
AI assistant to get info about available indices and their fields
(#165952)","sha":"89562dbac35bb9f4e05785bd0bf96a2e94d71565","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v8.11.0","v8.12.0"],"number":165952,"url":"#165952
AI assistant to get info about available indices and their fields
(#165952)","sha":"89562dbac35bb9f4e05785bd0bf96a2e94d71565"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"#165952
AI assistant to get info about available indices and their fields
(#165952)","sha":"89562dbac35bb9f4e05785bd0bf96a2e94d71565"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v8.11.0 v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants