Skip to content

[Obs AI Assistant] Expose recall function as API#185058

Merged
dgieselaar merged 5 commits intoelastic:mainfrom
dgieselaar:obs-ai-assistant-recall-esql-apis
Jun 15, 2024
Merged

[Obs AI Assistant] Expose recall function as API#185058
dgieselaar merged 5 commits intoelastic:mainfrom
dgieselaar:obs-ai-assistant-recall-esql-apis

Conversation

@dgieselaar
Copy link
Copy Markdown
Contributor

@dgieselaar dgieselaar commented Jun 8, 2024

Exposes a POST /internal/observability_ai_assistant/chat/recall endpoint for Investigate UI . It is mostly just moving stuff around, some small refactorings and a new way to generate short ids. Previously we were using indexes for scoring suggestions, we are now generating a short but unique id (ie 4-5 chars) which generates a fairly unique token which strengthens the relationship between the id and the object but still allows for quick output. LLMs are slow to generate UUIDs, but indexes are very generic and the LLM might not pay a lot of attention to it.

@dgieselaar dgieselaar force-pushed the obs-ai-assistant-recall-esql-apis branch from c9f3344 to 45a4f1f Compare June 8, 2024 10:16
@dgieselaar dgieselaar changed the title [Obs AI Assistant] Expose recall and esql functions as APIs [Obs AI Assistant] Expose recall function as API Jun 8, 2024
@dgieselaar dgieselaar force-pushed the obs-ai-assistant-recall-esql-apis branch 4 times, most recently from faa5f3a to 8691972 Compare June 10, 2024 08:56
@dgieselaar dgieselaar force-pushed the obs-ai-assistant-recall-esql-apis branch from 8691972 to 53d2a00 Compare June 10, 2024 09:03
@dgieselaar dgieselaar added release_note:skip Skip the PR/issue when compiling release notes v8.15.0 labels Jun 10, 2024
@dgieselaar dgieselaar self-assigned this Jun 10, 2024
@dgieselaar dgieselaar added the Team:Obs AI Assistant Observability AI Assistant label Jun 10, 2024
@dgieselaar dgieselaar marked this pull request as ready for review June 10, 2024 09:15
@dgieselaar dgieselaar requested a review from a team as a code owner June 10, 2024 09:15
@dgieselaar
Copy link
Copy Markdown
Contributor Author

/ci

Comment on lines +155 to +157
if (typeof disableFunctions === 'object') {
systemFunctions = systemFunctions.filter((fn) => disableFunctions.except.includes(fn.name));
}
Copy link
Copy Markdown
Contributor

@sorenlouv sorenlouv Jun 12, 2024

Choose a reason for hiding this comment

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

I find this API weird. What about keeping disableFunctions: boolean, then have a separate allowedFunctions: string[]. By default all functions are included. With disableFunctions=true no functions are included. And with allowedFunctions=func1,func2 only specified functions are included.

The allowedFunctions and disableFunctions should be mutually exclusive (although we don't have to enforce it).

Btw We could also have disallowedFunctions but I'm not sure that's really necessary

Copy link
Copy Markdown
Contributor Author

@dgieselaar dgieselaar Jun 12, 2024

Choose a reason for hiding this comment

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

Agree that it is a little weird, but I use this structure precisely so we don't have to add any type or runtime guards around it. Plus indeed we might end up wanting to disable only specific functions (which would be disableFunctions.only). But maybe it's not worth it, WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@sorenlouv I will just merge this in, in the interest of time but I'm happy to make this change separately if you feel it's worth it.

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Jun 12, 2024
Comment on lines +484 to +485
const mappedQueries = queries.map((query) =>
typeof query === 'string' ? { boost: 1, text: query } : query
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When is query a string and not an object?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leftover from merging your work into mine I think. Will fix!

@dgieselaar dgieselaar enabled auto-merge (squash) June 12, 2024 21:46
@dgieselaar
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

kibana-ci commented Jun 15, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #3 / edit package policy page should disable submit button on invalid form with empty package var

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityAIAssistant 92 93 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
observabilityAIAssistant 259 288 +29

Async chunks

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

id before after diff
observabilityAIAssistant 17.8KB 17.7KB -78.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
observabilityAIAssistant 27 26 -1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observabilityAIAssistant 46.1KB 46.7KB +653.0B
Unknown metric groups

API count

id before after diff
observabilityAIAssistant 261 290 +29

History

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

cc @dgieselaar

@dgieselaar dgieselaar merged commit 1338287 into elastic:main Jun 15, 2024
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:Obs AI Assistant Observability AI Assistant v8.15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants