-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Streams] Make feature detection prompt route #244094
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
base: main
Are you sure you want to change the base?
Conversation
4fdc5ec to
cb04a27
Compare
…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
x-pack/platform/packages/shared/kbn-streams-ai/src/significant_events/prompt.ts
Outdated
Show resolved
Hide resolved
...latform/packages/shared/kbn-streams-ai/src/significant_events/generate_significant_events.ts
Outdated
Show resolved
Hide resolved
miltonhultgren
left a comment
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.
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.
x-pack/platform/packages/shared/kbn-streams-ai/src/significant_events/prompt.ts
Outdated
Show resolved
Hide resolved
.../plugins/shared/streams/server/lib/saved_objects/significant_events/promps_config_service.ts
Outdated
Show resolved
Hide resolved
...platform/plugins/shared/streams/server/lib/significant_events/generate_significant_events.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/streams/server/routes/internal/streams/features/route.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/streams/server/routes/internal/streams/features/route.ts
Outdated
Show resolved
Hide resolved
…into config-prompts
.../plugins/shared/streams/server/lib/saved_objects/significant_events/promps_config_service.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/streams/server/routes/internal/streams/features/route.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/streams/server/routes/internal/streams/features/route.ts
Outdated
Show resolved
Hide resolved
💔 Build Failed
Failed CI StepsHistory
|
| ...setFeaturesPromptRoute, | ||
| ...getFeaturesPromptRoute, | ||
| ...resetFeaturesPromptRoute, |
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 Features from the names
|
|
||
| import { getSignificantEventPrompts } from './significant_events/prompts_config'; | ||
|
|
||
| export const readStreamSavedObjects = (savedObjectsService: SavedObjectsServiceSetup) => { |
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.
registerStreamsSavedObjects ?
| */ | ||
| import type { SavedObjectsType } from '@kbn/core/server'; | ||
|
|
||
| export const significantEventsPromptsType = 'significant-events-prompts'; |
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.
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 |
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.
is this true ? seems like we always force an id
| significantEventsPromptsType, | ||
| SINGLETON_PROMPTS_ID |
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.
perhaps the first one should be more generic streamsPromptsType and the second one more specific SIGNIFICANT_EVENTS_PROMPTS_ID
| type: { | ||
| type: 'keyword', | ||
| }, |
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 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) { |
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.
nit but this does an upsert
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/_promptsit will return default prompt if it hasn't been modified yet
Set route