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
[Obs AI Assistant] Perform functions and LLM interactions on the server #172590
[Obs AI Assistant] Perform functions and LLM interactions on the server #172590
Conversation
…r/kibana into obs-ai-assistant-use-chat-hook
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
…t-server-conversations
Pinging @elastic/apm-ui (Team:APM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Core changes LGTM (code review only)
…ieselaar/kibana into obs-ai-assistant-server-conversations
…t-server-conversations
Verified the apm functions work as expected |
return axios({ | ||
method, | ||
headers: request.headers, | ||
url: format(nextUrl), | ||
data: body ? JSON.stringify(body) : undefined, | ||
signal, | ||
}).then((response) => { | ||
return { content: response.data }; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…t-server-conversations
…t-server-conversations
x-pack/plugins/observability_ai_assistant/server/service/index.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/server/assistant_functions/get_apm_downstream_dependencies.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/public/functions/lens.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/public/service/create_chat_service.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/public/utils/builders.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/public/utils/storybook_decorator.tsx
Outdated
Show resolved
Hide resolved
// eslint-disable-next-line @kbn/i18n/strings_should_be_translated_with_i18n | ||
<div>Hello! {name}</div> | ||
renderFunction: (name) => ( | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div> | |
// eslint-disable-next-line @kbn/i18n/strings_should_be_translated_with_i18n | |
<div>Hello! {name}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked at the code in server
only, so far it looks good.
Left a mix of nits and questions mostly
x-pack/plugins/observability_ai_assistant/server/service/util/stream_into_observable.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/functions/get_dataset_info.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts
Show resolved
Hide resolved
…t-server-conversations
…t-server-conversations
export function processOpenAiStream() { | ||
return (source: Observable<string>): Observable<CreateChatCompletionResponseChunk> => | ||
source.pipe( | ||
map((line) => line.substring(6)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the first 6 characters that we drop?
x-pack/plugins/observability_ai_assistant/server/service/client/index.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/index.ts
Show resolved
Hide resolved
x-pack/plugins/observability_ai_assistant/server/service/client/handle_llm_response.ts
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsasync chunk count
ESLint disabled in files
ESLint disabled line counts
History
To update your PR or re-run it, just comment with: |
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 56b36b9)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… (#172824) # Backport This will backport the following commits from `main` to `8.12`: - [[Obs AI Assistant] Perform functions etc on the server (#172590)](#172590) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Dario Gieselaar","email":"dario.gieselaar@elastic.co"},"sourceCommit":{"committedDate":"2023-12-07T14:18:41Z","message":"[Obs AI Assistant] Perform functions etc on the server (#172590)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"56b36b9042b42c702a57568f1612af3d433d2df1","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:APM","v8.12.0","apm:review","v8.13.0"],"number":172590,"url":"#172590 AI Assistant] Perform functions etc on the server (#172590)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"56b36b9042b42c702a57568f1612af3d433d2df1"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"#172590 AI Assistant] Perform functions etc on the server (#172590)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"56b36b9042b42c702a57568f1612af3d433d2df1"}}]}] BACKPORT--> Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Adds a /complete endpoint that handles function execution and LLM interactions on the server. This removes the need for a browser to have a conversation with the Assistant, which makes it easier to test and allows the user to script interactions. This is part of our GA effort for 8.12.
There are two open items:
I've removed the Kibana function because it's no longer reasonable to use http to call any Kibana API. Will look into alternatives.I have reinstated the Kibana function with a disgusting workaround 🌚