Skip to content

Conversation

@shahzad31
Copy link
Contributor

@shahzad31 shahzad31 commented Nov 25, 2025

Summary

Fixes #244823

Added a route for setting and getting a prompt for features detection , prompt is for now called systemPromptTemplate, perhaps should be more generic?

Get Route

GET /internal/streams/_prompts

it will return default prompt if it hasn't been modified yet

Set route

PUT kbn:/internal/streams/_prompts
{
    "systemPromptTemplate":"test"
}

@github-actions github-actions bot added the author:actionable-obs PRs authored by the actionable obs team label Nov 25, 2025
@shahzad31 shahzad31 changed the title [Significant Events] Make generation configurable [Streams] Make feature detection prompt route Dec 3, 2025
@shahzad31 shahzad31 marked this pull request as ready for review December 3, 2025 07:37
@shahzad31 shahzad31 requested review from a team as code owners December 3, 2025 07:37
@shahzad31 shahzad31 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Dec 3, 2025
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner December 3, 2025 07:52
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner December 3, 2025 08:06
Copy link
Contributor

@miltonhultgren miltonhultgren left a comment

Choose a reason for hiding this comment

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

Tested locally, works as expected ✅

I feel like some of the naming makes it to bound to significant events, perhaps we need to make this just a bit more generic so we can tweak the prompts for feature identification and other use cases in the future?
We can also do that in a follow up PR if you feel it would be much work.

@elasticmachine
Copy link
Contributor

elasticmachine commented Dec 3, 2025

💔 Build Failed

Failed CI Steps

History

Comment on lines +110 to +112
...setFeaturesPromptRoute,
...getFeaturesPromptRoute,
...resetFeaturesPromptRoute,
Copy link
Contributor

Choose a reason for hiding this comment

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

we can remove Features from the names


import { getSignificantEventPrompts } from './significant_events/prompts_config';

export const readStreamSavedObjects = (savedObjectsService: SavedObjectsServiceSetup) => {
Copy link
Contributor

@klacabane klacabane Dec 3, 2025

Choose a reason for hiding this comment

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

registerStreamsSavedObjects ?

*/
import type { SavedObjectsType } from '@kbn/core/server';

export const significantEventsPromptsType = 'significant-events-prompts';
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason to bind this naming to significant events ? should likely be more generic

const existing = await this.getPrompt();

this.logger.debug('Creating significant events prompt');
// pass options through so callers can set id if they want; don't force overwrite
Copy link
Contributor

Choose a reason for hiding this comment

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

is this true ? seems like we always force an id

Comment on lines +68 to +69
significantEventsPromptsType,
SINGLETON_PROMPTS_ID
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps the first one should be more generic streamsPromptsType and the second one more specific SIGNIFICANT_EVENTS_PROMPTS_ID

Comment on lines +19 to +21
type: {
type: 'keyword',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this type property, I don't see it persisted in the attributes

* attributes is a plain object (e.g. { name, systemPromptTemplate, userPromptTemplate, inputExample })
* Note: no forced singleton id/overwrite — allow multiple prompt objects (user-created).
*/
async createPrompt(attributes: PromptsConfigAttributes, options?: SavedObjectsCreateOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit but this does an upsert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:actionable-obs PRs authored by the actionable obs team backport:skip This PR does not require backporting Feature:SignificantEvents release_note:skip Skip the PR/issue when compiling release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Significant events] Prompt Management and Testing for Deployed Clusters

7 participants