-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[8.19] [Obs AI Assistant] Anonymization support (#223351) #224100
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
Conversation
Re-submit of elastic#216352 as it has merge conflicts and we don't have write permissions for Sandra's remote. To test, add the following to your kibana.yml: ``` uiSettings: overrides: "observability:aiAssistantAnonymizationRules": - id: "ner" type: "ner" enabled: true - id: "beach" type: "regex" enabled: true pattern: "sandy" ``` --------- Co-authored-by: Sandra Gonzales <sandra.gonzales@elastic.co> Co-authored-by: Sandra G <neptunian@users.noreply.github.com> (cherry picked from commit 71ec37a) # Conflicts: # x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_timeline.tsx # x-pack/platform/plugins/shared/observability_ai_assistant/server/service/client/index.ts
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
ecb5e38
to
8dd1022
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
History
|
@@ -27,7 +27,19 @@ import { ChatItemActions } from './chat_item_actions'; | |||
import { ChatItemAvatar } from './chat_item_avatar'; | |||
import { ChatItemContentInlinePromptEditor } from './chat_item_content_inline_prompt_editor'; | |||
import { ChatTimelineItem } from './chat_timeline'; | |||
|
|||
// Helper function to extract plain text from a React node. |
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.
// Helper function to extract plain text from a React node. | |
// Helper function to extract plain text from a React node. |
return extractTextFromReactNode(node.props.children); | ||
} | ||
return ''; | ||
} |
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.
} | |
} | |
parts.push(content.substring(lastIndex)); | ||
} | ||
return parts; | ||
} |
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.
} | |
} | |
import { DetectedEntity } from '../../types'; | ||
/** Regex matching object‑hash placeholders (40 hex chars) */ | ||
export const HASH_REGEX = /[0-9a-f]{40}/g; | ||
/** |
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.
/** | |
/** |
}) | ||
from(this.dependencies.anonymizationService.redactMessages(messages)).pipe( | ||
switchMap(({ redactedMessages }) => { | ||
this.dependencies.logger.debug( |
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.
We can remove this debug line I think as it's the same as the debug line in L496
|
||
return redacted; | ||
} | ||
/** |
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.
/** | |
/** |
@@ -35,7 +35,16 @@ export type ChatCompletionMessageEvent<TToolOptions extends ToolOptions = ToolOp | |||
toolCalls: ToolCallsOf<TToolOptions>['toolCalls']; | |||
} | |||
>; | |||
|
|||
// with unredactions |
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.
// with unredactions | |
// with unredactions |
class_name: string; | ||
hash: string; | ||
}>; | ||
} |
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.
} | |
} | |
} | ||
return { unredactedMessages: messages }; | ||
} | ||
unredactChatCompletionEvent(): OperatorFunction< |
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.
unredactChatCompletionEvent(): OperatorFunction< | |
unredactChatCompletionEvent(): OperatorFunction< |
content: message.message.content, | ||
}; | ||
} | ||
export function getRedactableMessageEventParts(event: ChatCompletionMessageEvent) { |
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.
export function getRedactableMessageEventParts(event: ChatCompletionMessageEvent) { | |
export function getRedactableMessageEventParts(event: ChatCompletionMessageEvent) { |
Backport
This will backport the following commits from
main
to8.19
:Questions ?
Please refer to the Backport tool documentation