Skip to content

[8.19] [Obs AI Assistant] Anonymization support (#223351)#224100

Merged
neptunian merged 3 commits intoelastic:8.19from
neptunian:backport/8.19/pr-223351
Jun 16, 2025
Merged

[8.19] [Obs AI Assistant] Anonymization support (#223351)#224100
neptunian merged 3 commits intoelastic:8.19from
neptunian:backport/8.19/pr-223351

Conversation

@neptunian
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

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
@neptunian neptunian requested a review from kibanamachine as a code owner June 16, 2025 16:06
@neptunian neptunian added the backport This PR is a backport of another PR label Jun 16, 2025
@neptunian neptunian enabled auto-merge (squash) June 16, 2025 16:06
@botelastic botelastic bot added the Team:Obs AI Assistant Observability AI Assistant label Jun 16, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@neptunian neptunian force-pushed the backport/8.19/pr-223351 branch from ecb5e38 to 8dd1022 Compare June 16, 2025 16:43
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityAIAssistant 109 110 +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 427 443 +16

Async chunks

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

id before after diff
observabilityAIAssistantApp 274.4KB 275.4KB +1014.0B
searchAssistant 175.8KB 176.8KB +1008.0B
total +2.0KB

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 30 +3

Page load bundle

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

id before after diff
observabilityAIAssistant 42.7KB 43.1KB +485.0B
Unknown metric groups

API count

id before after diff
observabilityAIAssistant 429 447 +18

History

import { ChatItemContentInlinePromptEditor } from './chat_item_content_inline_prompt_editor';
import { ChatTimelineItem } from './chat_timeline';

// Helper function to extract plain text from a React node.
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.

Suggested change
// 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 '';
}
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.

Suggested change
}
}

parts.push(content.substring(lastIndex));
}
return parts;
}
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.

Suggested change
}
}

import { DetectedEntity } from '../../types';
/** Regex matching object‑hash placeholders (40 hex chars) */
export const HASH_REGEX = /[0-9a-f]{40}/g;
/**
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.

Suggested change
/**
/**

})
from(this.dependencies.anonymizationService.redactMessages(messages)).pipe(
switchMap(({ redactedMessages }) => {
this.dependencies.logger.debug(
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.

We can remove this debug line I think as it's the same as the debug line in L496


return redacted;
}
/**
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.

Suggested change
/**
/**

}
>;

// with unredactions
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.

Suggested change
// with unredactions
// with unredactions

class_name: string;
hash: string;
}>;
}
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.

Suggested change
}
}

}
return { unredactedMessages: messages };
}
unredactChatCompletionEvent(): OperatorFunction<
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.

Suggested change
unredactChatCompletionEvent(): OperatorFunction<
unredactChatCompletionEvent(): OperatorFunction<

content: message.message.content,
};
}
export function getRedactableMessageEventParts(event: ChatCompletionMessageEvent) {
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.

Suggested change
export function getRedactableMessageEventParts(event: ChatCompletionMessageEvent) {
export function getRedactableMessageEventParts(event: ChatCompletionMessageEvent) {

@neptunian neptunian merged commit aac6c9e into elastic:8.19 Jun 16, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Team:Obs AI Assistant Observability AI Assistant

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants