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

Obs AI Assistant Fetch user instructions using user_id #200137

Conversation

arturoliduena
Copy link
Contributor

@arturoliduena arturoliduena commented Nov 14, 2024

Summary

[Obs AI Assistant] Fetch user instructions using id instead of username for knowledge base instructions #192701

To avoid potential collisions when fetching data, we should query for the user id instead of the user name when getting instructions.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_node:* label is applied per the guidelines

@arturoliduena arturoliduena added release_note:fix backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Team:Obs AI Assistant Observability AI Assistant labels Nov 14, 2024
@arturoliduena arturoliduena requested a review from a team as a code owner November 14, 2024 10:25
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant)

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Nov 14, 2024
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@arturoliduena arturoliduena force-pushed the 192701-Obs-AI-Assistant-get-user-instructions-by-id branch from 2cbe5be to 791b51c Compare November 18, 2024 08:33
@arturoliduena arturoliduena enabled auto-merge (squash) November 18, 2024 13:09
@arturoliduena arturoliduena force-pushed the 192701-Obs-AI-Assistant-get-user-instructions-by-id branch from 6523db4 to cc23a7c Compare November 19, 2024 13:30
@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 19, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: cc23a7c
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-200137-cc23a7c28ea3

Failed CI Steps

Metrics [docs]

✅ unchanged

History

@arturoliduena arturoliduena merged commit 518dc25 into elastic:main Nov 19, 2024
25 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11916076008

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 19, 2024
## Summary

[Obs AI Assistant] Fetch user instructions using id instead of username
for knowledge base instructions elastic#192701

To avoid potential collisions when fetching data, we should query for
the user id instead of the user name when getting instructions.

(cherry picked from commit 518dc25)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 19, 2024
#200759)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Obs AI Assistant Fetch user instructions using user_id
(#200137)](#200137)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Arturo
Lidueña","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-19T15:16:32Z","message":"Obs
AI Assistant Fetch user instructions using user_id (#200137)\n\n##
Summary\r\n\r\n[Obs AI Assistant] Fetch user instructions using id
instead of username\r\nfor knowledge base instructions #192701\r\n\r\nTo
avoid potential collisions when fetching data, we should query
for\r\nthe user id instead of the user name when getting
instructions.","sha":"518dc2591f845b9e0772d367f71065cd787ad9bf","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","backport:prev-minor","Team:Obs
AI Assistant","ci:project-deploy-observability"],"title":"Obs AI
Assistant Fetch user instructions using user_id
","number":200137,"url":"https://github.com/elastic/kibana/pull/200137","mergeCommit":{"message":"Obs
AI Assistant Fetch user instructions using user_id (#200137)\n\n##
Summary\r\n\r\n[Obs AI Assistant] Fetch user instructions using id
instead of username\r\nfor knowledge base instructions #192701\r\n\r\nTo
avoid potential collisions when fetching data, we should query
for\r\nthe user id instead of the user name when getting
instructions.","sha":"518dc2591f845b9e0772d367f71065cd787ad9bf"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200137","number":200137,"mergeCommit":{"message":"Obs
AI Assistant Fetch user instructions using user_id (#200137)\n\n##
Summary\r\n\r\n[Obs AI Assistant] Fetch user instructions using id
instead of username\r\nfor knowledge base instructions #192701\r\n\r\nTo
avoid potential collisions when fetching data, we should query
for\r\nthe user id instead of the user name when getting
instructions.","sha":"518dc2591f845b9e0772d367f71065cd787ad9bf"}}]}]
BACKPORT-->

Co-authored-by: Arturo Lidueña <[email protected]>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
## Summary

[Obs AI Assistant] Fetch user instructions using id instead of username
for knowledge base instructions elastic#192701

To avoid potential collisions when fetching data, we should query for
the user id instead of the user name when getting instructions.
Comment on lines +161 to +165
await supertestWithoutAuth
.post(endpoint)
.set('kbn-xsrf', 'xxx')
.set('Cookie', cookie)
.send(params.body);
Copy link
Member

Choose a reason for hiding this comment

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

@arturoliduena Just noticed this while looking at @viduni94's PR. We should aim to use observabilityAIAssistantAPIClient when possible because it comes with type safety, making it easier to use, and "fails faster" when an endpoint is changed:

const fullConversation = await observabilityAIAssistantAPIClient.noAuth({
  endpoint: "GET /internal/observability_ai_assistant/conversation",
  params: { 
    // ... 
  },
});

noAuth user doesn't exist but can be created here

CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
## Summary

[Obs AI Assistant] Fetch user instructions using id instead of username
for knowledge base instructions elastic#192701

To avoid potential collisions when fetching data, we should query for
the user id instead of the user name when getting instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) ci:project-deploy-observability Create an Observability project release_note:fix Team:Obs AI Assistant Observability AI Assistant v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants