import { ConversationSelect, DatasetItemSelect, EvaluationResultSelect, EvaluatorSelect } from "@inkeep/agents-core";

//#region src/domains/evals/services/EvaluationService.d.ts
interface RunDatasetItemOptions {
  tenantId: string;
  projectId: string;
  agentId: string;
  datasetItem: DatasetItemSelect;
  datasetRunId: string;
  conversationId?: string;
  apiKey?: string;
}
interface ChatApiResponse {
  conversationId?: string;
  response?: string;
  error?: string;
}
/**
 * Service for running dataset items through the chat API endpoint
 */
declare class EvaluationService {
  private readonly agentsApiUrl;
  private readonly runApiBypassSecret;
  constructor();
  /**
   * Run a dataset item through the chat API endpoint
   * Supports multi-turn conversations with simulation agents
   */
  runDatasetItem(options: RunDatasetItemOptions): Promise<ChatApiResponse>;
  /**
   * Run a single-turn conversation (original behavior)
   */
  private runSingleTurn;
  /**
   * Run a multi-turn conversation with simulation agent
   */
  private runDatasetItemWithSimulation;
  /**
   * Build prompt for simulation agent based on persona and conversation history
   */
  private buildSimulationPrompt;
  /**
   * Extract messages from dataset item input
   */
  private extractMessagesFromDatasetItem;
  /**
   * Parse SSE (Server-Sent Events) response from chat API
   * Handles text deltas, error operations, and other data operations
   */
  private parseSSEResponse;
  /**
   * Run an evaluation job based on an evaluation job config
   * Filters conversations based on jobFilters and runs evaluations with configured evaluators
   */
  runEvaluationJob(params: {
    tenantId: string;
    projectId: string;
    evaluationJobConfigId: string;
    sampleRate?: number | null;
  }): Promise<Array<EvaluationResultSelect>>;
  /**
   * Apply sample rate to conversations
   */
  applySampleRate<T>(items: T[], sampleRate: number | null | undefined): T[];
  /**
   * Execute an evaluation by calling the LLM with the evaluator prompt and conversation data
   */
  executeEvaluation(params: {
    conversation: ConversationSelect;
    evaluator: EvaluatorSelect;
    tenantId: string;
    projectId: string;
    expectedOutput?: unknown;
  }): Promise<{
    output: any;
    metadata: Record<string, unknown>;
  }>;
  /**
   * Build evaluation prompt with agent definition, conversation history, trace, and expected output
   */
  private buildEvalInputEvaluationPrompt;
  /**
   * Call LLM API using AI SDK's generateObject for structured output
   */
  private callLLM;
  /**
   * Fetch trace from SigNoz (similar to the example)
   */
  private fetchTraceFromSigNoz;
  /**
   * Format conversation detail as prettified trace
   */
  private formatConversationAsPrettifiedTrace;
}
//#endregion
export { ChatApiResponse, EvaluationService, RunDatasetItemOptions };