Skip to content

[SigEvents][Evals] Convert feature duplication evals to the @kbn/evals evaluator formatΒ #255869

@viduni94

Description

@viduni94

Check whether inference.output usage in feature duplication evals can be converted to the common evaluator format that @kbn/evals follow.

Proposal

Below are some examples of how we could achieve this.

Semantic uniqueness evaluator

  1. Create a prompt definition
const SemanticUniquenessPrompt = createPrompt({
  name: 'semantic_uniqueness_analysis',
  input: z.object({
    stream_name: z.string(),
    totals: z.string(),
    unique_features_by_id: z.string(),
  }),
})
  .version({
    system: { mustache: { template: '...(your system prompt)...' } },
    template: { mustache: { template: '...(user template)...' } },
    tools: {
      analyze: {
        description: 'Return semantic uniqueness analysis',
        schema: SEMANTIC_UNIQUENESS_OUTPUT_SCHEMA,
      },
    },
  } as const)
  .get();
  1. Use executeUntilValid in the evaluator
const response = await executeUntilValid({
  prompt: SemanticUniquenessPrompt,
  inferenceClient,
  input: { stream_name, totals, unique_features_by_id },
  finalToolChoice: { function: 'analyze' },
  maxRetries: 3,
  toolCallbacks: {
    analyze: async (toolCall) => ({ response: toolCall.function.arguments }),
  },
});
const { k, explanation, duplicate_clusters } = response.toolCalls[0].function.arguments;

These are only suggestions, therefore feel free to update to best fit the required approach.

Metadata

Metadata

Assignees

Labels

Feature:SigEventsSignificant events feature, related to streams and rules/alerts (RnA)Team:SigEventsProject team working on Significant Events

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions