@mastra/core
Version:
124 lines • 4.53 kB
TypeScript
import type { Mastra } from '../mastra/index.js';
import type { TargetType } from '../storage/types.js';
import { Dataset } from './dataset.js';
/**
* Public API for managing datasets.
*
* Provides methods for dataset CRUD and cross-dataset experiment operations.
* Typically accessed via `mastra.datasets` (Phase 4).
*/
export declare class DatasetsManager {
#private;
constructor(mastra: Mastra);
/**
* Create a new dataset.
*
* Accepts Zod schemas for `inputSchema` / `groundTruthSchema` (typed as
* `unknown` here); they are normalized to JSON Schema via `zodToJsonSchema`
* before being forwarded to the storage-canonical
* {@link import('../storage/types.js').CreateDatasetInput} shape. All other
* fields mirror `CreateDatasetInput` exactly.
*/
create(input: {
name: string;
description?: string;
inputSchema?: unknown;
groundTruthSchema?: unknown;
requestContextSchema?: Record<string, unknown> | null;
metadata?: Record<string, unknown>;
targetType?: TargetType;
targetIds?: string[];
scorerIds?: string[];
organizationId?: string | null;
projectId?: string | null;
candidateKey?: string | null;
candidateId?: string | null;
}): Promise<Dataset>;
/**
* Get an existing dataset by ID, optionally scoped to a tenant.
*
* When `organizationId` / `projectId` are provided, the read is scoped to
* that tenancy: a dataset row that exists but belongs to a different tenant
* returns NOT_FOUND (same 404 as a truly missing row) rather than leaking
* cross-tenant existence. The returned {@link Dataset} handle carries the
* scope forward on all subsequent reads and item mutations.
*/
get(args: {
id: string;
organizationId?: string;
projectId?: string;
}): Promise<Dataset>;
/**
* List all datasets with pagination.
*
* Supports optional tenancy and candidate-identity filters. When omitted, all
* datasets visible to the configured storage instance are returned.
*/
list(args?: {
page?: number;
perPage?: number;
filters?: {
organizationId?: string;
projectId?: string;
candidateKey?: string;
candidateId?: string;
/** Filter by dataset target type. */
targetType?: TargetType;
/**
* Filter to datasets whose `targetIds` intersect this list (any overlap matches).
*/
targetIds?: string[];
/** Substring match on dataset `name`, case-insensitive. */
name?: string;
};
}): Promise<import("../storage/types.js").ListDatasetsOutput>;
/**
* Delete a dataset by ID, optionally scoped to a tenant.
*
* When `organizationId` / `projectId` are provided, the delete is scoped to
* that tenancy: a dataset row in another tenant is a silent no-op (no error)
* so cross-tenant existence is not leaked via error timing/text.
*/
delete(args: {
id: string;
organizationId?: string;
projectId?: string;
}): Promise<void>;
/**
* Get a specific experiment (run) by ID, optionally scoped to a tenant.
*
* When `organizationId` / `projectId` are provided, the read is scoped to
* that tenancy: an experiment row that exists but belongs to a different
* tenant returns `null` (same as a truly missing row) rather than leaking
* cross-tenant existence via error timing/text.
*/
getExperiment(args: {
experimentId: string;
organizationId?: string;
projectId?: string;
}): Promise<import("../storage/types.js").Experiment | null>;
/**
* Compare two or more experiments.
*
* Uses the internal `compareExperiments` function for pairwise comparison,
* then enriches results with per-item input/groundTruth/output data.
*/
compareExperiments(args: {
experimentIds: string[];
baselineId?: string;
}): Promise<{
baselineId: string;
items: {
itemId: string;
input: {} | null;
groundTruth: {} | null;
results: {
[x: string]: {
output: unknown;
scores: Record<string, number | null>;
} | null;
};
}[];
}>;
}
//# sourceMappingURL=manager.d.ts.map