import { APIResource } from "../core/resource.mjs"; import * as CompletionsAPI from "./chat/completions.mjs"; import * as EvaluationsAPI from "./evaluations/evaluations.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { CursorPage, type CursorPageParams, PagePromise } from "../core/pagination.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; export declare class EvaluationGroups extends APIResource { /** * Create a new evaluation group bundling one or more existing evaluations. * * The request must list at least one evaluation ID, and duplicate IDs are * rejected. Every listed evaluation is validated for existence and account access * before the group is created; an unknown or inaccessible evaluation ID fails the * whole request with a 400 rather than creating a partial group. The named * evaluations are added as group members in the same transaction, and any supplied * row_identifiers (an evaluation_id-to-column-name mapping used for cross-dataset * joins) are persisted alongside them, ignoring entries for evaluation IDs not in * the group. The returned group includes its members enriched with each * evaluation's name, tags, and creation time. Unlike the PUT and PATCH update * endpoints, creation does not trigger any dashboard-widget recomputation. * * @example * ```ts * const evaluationGroup = * await client.evaluationGroups.create({ * evaluation_ids: ['string'], * name: 'name', * }); * ``` */ create(body: EvaluationGroupCreateParams, options?: RequestOptions): APIPromise; /** * Fetch a single evaluation group by its ID. * * By default only non-archived groups are returned; set include_deleted to also * resolve a soft-deleted group, whose response includes its soft-deleted member * rows. * * `members` is always returned, so a client can confirm membership without passing * a view, and `views` adds further expansions on top (e.g. views=row_identifiers). * The full member set is returned with no cap, and each member is enriched with * its evaluation's name, tags, and creation time where that evaluation is readable * from this account; those fields are null otherwise. Use the schema endpoint * instead when you need the per-evaluation column schemas of the group's members. * * @example * ```ts * const evaluationGroup = * await client.evaluationGroups.retrieve('group_id'); * ``` */ retrieve(groupID: string, query?: EvaluationGroupRetrieveParams | null | undefined, options?: RequestOptions): APIPromise; /** * Partially update an evaluation group's attributes. * * Only the fields present in the request are changed; unset fields are left * untouched. Unlike the PUT endpoint, metadata is merged into the existing * metadata key-by-key rather than replaced wholesale, and group membership * (evaluation_ids) cannot be changed here -- use PUT to replace members. At least * one field must be supplied or the request fails with a 400. Supplying * row_identifiers replaces the group's entire row identifier set (an * evaluation_id-to-column-name mapping for cross-dataset joins); passing an empty * mapping clears it. * * @example * ```ts * const evaluationGroup = * await client.evaluationGroups.update('group_id'); * ``` */ update(groupID: string, body: EvaluationGroupUpdateParams, options?: RequestOptions): APIPromise; /** * List the calling account's evaluation groups with optional filters. * * Results are paginated and scoped to the authenticated account. The optional * filters combine with AND semantics: name does a case-insensitive partial * (substring) match on the group name, tags returns only groups whose tag list * contains all of the supplied tags, and evaluation_id returns only groups that * have the given evaluation as an active member. By default archived * (soft-deleted) groups are excluded; set include_deleted to include them. The * views parameter optionally expands each group with its members and/or * row_identifiers, and returned members are enriched with each evaluation's name, * tags, and creation time. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const evaluationGroup of client.evaluationGroups.list()) { * // ... * } * ``` */ list(query?: EvaluationGroupListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Archive (soft-delete) an evaluation group and its dependent records. * * This is a soft delete: the group is marked deleted rather than removed, so it no * longer appears in default list/get results but can still be fetched with the * include-deleted flags. The same delete timestamp cascades as a soft delete to * the group's members, row identifiers, and its dashboard charts and their chart * columns; the member evaluations themselves are not affected. The archived group * is returned in the response. * * @example * ```ts * const evaluationGroup = * await client.evaluationGroups.archive('group_id'); * ``` */ archive(groupID: string, options?: RequestOptions): APIPromise; /** * Replace an evaluation group's attributes and, optionally, its membership. * * This is a full replacement of the group's attributes: every attribute field * (name, description, tags, metadata) is written from the request, so omitting an * optional field clears it rather than leaving it unchanged. Use PATCH instead to * update only selected fields and to merge (rather than overwrite) metadata. * Membership is replaced only when evaluation_ids is supplied: the resulting * members become exactly that set (added/removed by diff against the current * members), it must contain at least one ID with no duplicates, and every ID is * validated for existence and account access or the request fails with a 400. When * membership actually changes, a best-effort Temporal workflow is started to * recompute the group's dashboard widgets; this is fire-and-forget and its failure * does not fail the request. Removing members hard-deletes the corresponding chart * columns and any charts left with no columns. * * @example * ```ts * const evaluationGroup = * await client.evaluationGroups.replace('group_id'); * ``` */ replace(groupID: string, body: EvaluationGroupReplaceParams, options?: RequestOptions): APIPromise; /** * Return a separate column schema for each active member evaluation of the group. * * Rather than a single merged schema, the response holds one schema entry per * active member evaluation (each with its field list, total item count, and * sampling info), which lets a caller filter columns down to a chosen subset of * the group's evaluations. Schemas are computed from the member evaluations' * items; include_archived controls whether archived items are counted in that * analysis. A group with no active members returns an empty schema list. This * differs from the plain get endpoint, which returns group metadata and members * but not their column schemas. * * @example * ```ts * const response = * await client.evaluationGroups.retrieveSchema('group_id'); * ``` */ retrieveSchema(groupID: string, query?: EvaluationGroupRetrieveSchemaParams | null | undefined, options?: RequestOptions): APIPromise; } export type EvaluationGroupsCursorPage = CursorPage; /** * Response model for evaluation group */ export interface EvaluationGroup { /** * Unique identifier of the evaluation group */ id: string; /** * Account that owns this evaluation group */ account_id: string; /** * When the group was created */ created_at: string; /** * Name of the evaluation group */ name: string; /** * The tags associated with the entity */ tags: Array | null; /** * When the group was soft-deleted */ deleted_at?: string; /** * Optional description */ description?: string; /** * Evaluation members in this group. Returned by default on GET by id; on list * endpoints, populated only with the 'members' view. */ members?: Array; /** * Optional metadata key-value pairs */ metadata?: { [key: string]: unknown; }; object?: 'evaluation_group'; /** * Row identifier mappings. Populated with 'row_identifiers' view. */ row_identifiers?: Array; } /** * Response model for evaluation group member */ export interface EvaluationGroupMember { /** * Unique identifier of the member record */ id: string; /** * When this member was added to the group */ created_at: string; /** * ID of the evaluation group */ evaluation_group_id: string; /** * ID of the evaluation */ evaluation_id: string; /** * When this membership was soft-deleted (if applicable) */ deleted_at?: string; /** * When the evaluation was created */ evaluation_created_at?: string; /** * Name of the evaluation */ evaluation_name?: string; /** * Tags of the evaluation */ evaluation_tags?: Array; object?: 'evaluation_group.member'; } /** * Response model for evaluation group row identifier */ export interface EvaluationGroupRowIdentifier { /** * Name of the column used as row identifier */ column_name: string; /** * ID of the evaluation */ evaluation_id: string; object?: 'evaluation_group.row_identifier'; } /** * Views for evaluation group responses */ export type EvaluationGroupViews = 'members' | 'row_identifiers'; /** * Per-evaluation schemas for all members of an evaluation group */ export interface EvaluationGroupRetrieveSchemaResponse { /** * The ID of the evaluation group */ evaluation_group_id: string; /** * Schema for each member evaluation in the group, one entry per active evaluation */ evaluation_schemas: Array; object?: 'evaluation_group_schema'; } export interface EvaluationGroupCreateParams { /** * List of evaluation IDs to include in the group */ evaluation_ids: Array; /** * Name of the evaluation group */ name: string; /** * Optional description */ description?: string; /** * Optional metadata key-value pairs */ metadata?: { [key: string]: unknown; }; /** * Optional mapping of evaluation_id to column name for cross-dataset joins */ row_identifiers?: { [key: string]: string; }; /** * The tags associated with the entity */ tags?: Array; } export interface EvaluationGroupRetrieveParams { include_deleted?: boolean; /** * Additional relationships to include; 'members' is always returned */ views?: Array; } export interface EvaluationGroupUpdateParams { /** * Optional description */ description?: string; /** * Optional metadata key-value pairs */ metadata?: { [key: string]: unknown; }; /** * Name of the evaluation group */ name?: string; /** * Optional mapping of evaluation_id to column name for cross-dataset joins */ row_identifiers?: { [key: string]: string; }; /** * The tags associated with the entity */ tags?: Array; } export interface EvaluationGroupListParams extends CursorPageParams { /** * Filter to groups containing this evaluation ID */ evaluation_id?: string; include_deleted?: boolean; name?: string; sort_by?: string; sort_order?: CompletionsAPI.SortOrder; tags?: Array; /** * Optional relationships to include: 'members', 'row_identifiers' */ views?: Array; } export interface EvaluationGroupReplaceParams { /** * Optional description */ description?: string; /** * Complete list of evaluation IDs to include in group (replaces existing members) */ evaluation_ids?: Array; /** * Optional metadata key-value pairs */ metadata?: { [key: string]: unknown; }; /** * Name of the evaluation group */ name?: string; /** * Optional mapping of evaluation_id to column name for cross-dataset joins */ row_identifiers?: { [key: string]: string; }; /** * The tags associated with the entity */ tags?: Array; } export interface EvaluationGroupRetrieveSchemaParams { /** * Include archived items in schema analysis */ include_archived?: boolean; } export declare namespace EvaluationGroups { export { type EvaluationGroup as EvaluationGroup, type EvaluationGroupMember as EvaluationGroupMember, type EvaluationGroupRowIdentifier as EvaluationGroupRowIdentifier, type EvaluationGroupViews as EvaluationGroupViews, type EvaluationGroupRetrieveSchemaResponse as EvaluationGroupRetrieveSchemaResponse, type EvaluationGroupsCursorPage as EvaluationGroupsCursorPage, type EvaluationGroupCreateParams as EvaluationGroupCreateParams, type EvaluationGroupRetrieveParams as EvaluationGroupRetrieveParams, type EvaluationGroupUpdateParams as EvaluationGroupUpdateParams, type EvaluationGroupListParams as EvaluationGroupListParams, type EvaluationGroupReplaceParams as EvaluationGroupReplaceParams, type EvaluationGroupRetrieveSchemaParams as EvaluationGroupRetrieveSchemaParams, }; } //# sourceMappingURL=evaluation-groups.d.mts.map