import { APIResource } from '../../core/resource.js'; import * as RunsAPI_ from '../runs/runs.js'; import { APIPromise } from '../../core/api-promise.js'; import { RequestOptions } from '../../internal/request-options.js'; export declare class Runs extends APIResource { /** * Fetch examples for a dataset, and fetch the runs for each example if they are * associated with the given session_ids. */ create(datasetID: string, params: RunCreateParams, options?: RequestOptions): APIPromise; /** * Fetch the number of regressions/improvements for each example in a dataset, * between sessions[0] and sessions[1]. */ delta(datasetID: string, body: RunDeltaParams, options?: RequestOptions): APIPromise; } /** * Example schema with list of runs from ClickHouse. * * For non-grouped endpoint (/datasets/{dataset_id}/runs): runs from single * session. For grouped endpoint (/datasets/{dataset_id}/group/runs): flat array of * runs from all sessions, where each run has a session_id field for frontend to * determine column placement. */ export interface ExampleWithRunsCh { id: string; dataset_id: string; inputs: { [key: string]: unknown; }; name: string; runs: Array; attachment_urls?: { [key: string]: unknown; } | null; created_at?: string; metadata?: { [key: string]: unknown; } | null; modified_at?: string | null; outputs?: { [key: string]: unknown; } | null; source_run_id?: string | null; } export declare namespace ExampleWithRunsCh { /** * Run schema for comparison view. */ interface Run { id: string; name: string; /** * Enum for run types. */ run_type: RunsAPI_.RunTypeEnum; session_id: string; status: string; trace_id: string; app_path?: string | null; completion_cost?: string | null; completion_tokens?: number | null; dotted_order?: string | null; end_time?: string | null; error?: string | null; events?: Array<{ [key: string]: unknown; }> | null; execution_order?: number; extra?: { [key: string]: unknown; } | null; feedback_stats?: { [key: string]: { [key: string]: unknown; }; } | null; first_token_time?: string | null; inputs?: { [key: string]: unknown; } | null; inputs_preview?: string | null; inputs_s3_urls?: { [key: string]: unknown; } | null; manifest_id?: string | null; manifest_s3_id?: string | null; outputs?: { [key: string]: unknown; } | null; outputs_preview?: string | null; outputs_s3_urls?: { [key: string]: unknown; } | null; parent_run_id?: string | null; prompt_cost?: string | null; prompt_tokens?: number | null; reference_example_id?: string | null; s3_urls?: { [key: string]: unknown; } | null; serialized?: { [key: string]: unknown; } | null; start_time?: string; tags?: Array | null; total_cost?: string | null; total_tokens?: number | null; trace_max_start_time?: string | null; trace_min_start_time?: string | null; } } export interface QueryExampleSchemaWithRuns { session_ids: Array; comparative_experiment_id?: string | null; example_ids?: Array | null; filters?: { [key: string]: Array; } | null; include_annotator_detail?: boolean; limit?: number; offset?: number; preview?: boolean; sort_params?: SortParamsForRunsComparisonView | null; } export interface QueryFeedbackDelta { baseline_session_id: string; comparison_session_ids: Array; feedback_key: string; comparative_experiment_id?: string | null; filters?: { [key: string]: Array; } | null; limit?: number; offset?: number; } /** * List of feedback keys with number of improvements and regressions for each. */ export interface SessionFeedbackDelta { feedback_deltas: { [key: string]: SessionFeedbackDelta.FeedbackDeltas; }; } export declare namespace SessionFeedbackDelta { /** * Feedback key with number of improvements and regressions. */ interface FeedbackDeltas { improved_examples: Array; regressed_examples: Array; } } export interface SortParamsForRunsComparisonView { sort_by: string; sort_order?: 'ASC' | 'DESC'; } export type RunCreateResponse = Array; export interface RunCreateParams { /** * Body param */ session_ids: Array; /** * Query param: Response format, e.g., 'csv' */ format?: 'csv' | null; /** * Body param */ comparative_experiment_id?: string | null; /** * Body param */ example_ids?: Array | null; /** * Body param */ filters?: { [key: string]: Array; } | null; /** * Body param */ include_annotator_detail?: boolean; /** * Body param */ limit?: number | null; /** * Body param */ offset?: number; /** * Body param */ preview?: boolean; /** * Body param */ sort_params?: SortParamsForRunsComparisonView | null; } export interface RunDeltaParams { baseline_session_id: string; comparison_session_ids: Array; feedback_key: string; comparative_experiment_id?: string | null; filters?: { [key: string]: Array; } | null; limit?: number; offset?: number; } export declare namespace Runs { export { type ExampleWithRunsCh as ExampleWithRunsCh, type QueryExampleSchemaWithRuns as QueryExampleSchemaWithRuns, type QueryFeedbackDelta as QueryFeedbackDelta, type SessionFeedbackDelta as SessionFeedbackDelta, type SortParamsForRunsComparisonView as SortParamsForRunsComparisonView, type RunCreateResponse as RunCreateResponse, type RunCreateParams as RunCreateParams, type RunDeltaParams as RunDeltaParams, }; }