import { APIResource } from '../../core/resource.js'; import * as ComparativeAPI from './comparative.js'; import { Comparative, ComparativeCreateParams, ComparativeCreateResponse, ComparativeDeleteResponse, SimpleExperimentInfo, SortByComparativeExperimentColumn } from './comparative.js'; import * as ExperimentsAPI from './experiments.js'; import { ExperimentGroupedParams, ExperimentGroupedResponse, Experiments } from './experiments.js'; import * as GroupAPI from './group.js'; import { Group, GroupRunsParams, GroupRunsResponse } from './group.js'; import * as RunsAPI from './runs.js'; import { ExampleWithRunsCh, QueryExampleSchemaWithRuns, QueryFeedbackDelta, RunCreateParams, RunCreateResponse, RunDeltaParams, Runs, SessionFeedbackDelta, SortParamsForRunsComparisonView } from './runs.js'; import * as ShareAPI from './share.js'; import { DatasetShareSchema, Share, ShareCreateParams, ShareDeleteAllResponse } from './share.js'; import * as SplitsAPI from './splits.js'; import { SplitCreateParams, SplitCreateResponse, SplitRetrieveParams, SplitRetrieveResponse, Splits } from './splits.js'; import * as VersionsAPI from './versions.js'; import { VersionListParams, VersionRetrieveDiffParams, VersionRetrieveDiffResponse, Versions } from './versions.js'; import * as ExamplesAPI from '../examples/examples.js'; import * as FeedbackAPI from '../feedback/feedback.js'; import { APIPromise } from '../../core/api-promise.js'; import { OffsetPaginationTopLevelArray, type OffsetPaginationTopLevelArrayParams, PagePromise } from '../../core/pagination.js'; import { type Uploadable } from '../../core/uploads.js'; import { RequestOptions } from '../../internal/request-options.js'; export declare class Datasets extends APIResource { versions: VersionsAPI.Versions; runs: RunsAPI.Runs; group: GroupAPI.Group; experiments: ExperimentsAPI.Experiments; share: ShareAPI.Share; comparative: ComparativeAPI.Comparative; splits: SplitsAPI.Splits; /** * Create a new dataset. */ create(body: DatasetCreateParams, options?: RequestOptions): APIPromise; /** * Get a specific dataset. */ retrieve(datasetID: string, options?: RequestOptions): APIPromise; /** * Update a specific dataset. */ update(datasetID: string, body: DatasetUpdateParams, options?: RequestOptions): APIPromise; /** * Get all datasets by query params and owner. */ list(params?: DatasetListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Delete a specific dataset. */ delete(datasetID: string, options?: RequestOptions): APIPromise; /** * Clone a dataset. */ clone(body: DatasetCloneParams, options?: RequestOptions): APIPromise; /** * Download a dataset as CSV format. */ retrieveCsv(datasetID: string, query?: DatasetRetrieveCsvParams | null | undefined, options?: RequestOptions): APIPromise; /** * Download a dataset as CSV format. */ retrieveJSONL(datasetID: string, query?: DatasetRetrieveJSONLParams | null | undefined, options?: RequestOptions): APIPromise; /** * Download a dataset as OpenAI Evals Jsonl format. */ retrieveOpenAI(datasetID: string, query?: DatasetRetrieveOpenAIParams | null | undefined, options?: RequestOptions): APIPromise; /** * Download a dataset as OpenAI Jsonl format. */ retrieveOpenAIFt(datasetID: string, query?: DatasetRetrieveOpenAIFtParams | null | undefined, options?: RequestOptions): APIPromise; /** * Get dataset version by as_of or exact tag. */ retrieveVersion(datasetID: string, query?: DatasetRetrieveVersionParams | null | undefined, options?: RequestOptions): APIPromise; /** * Set a tag on a dataset version. */ updateTags(datasetID: string, body: DatasetUpdateTagsParams, options?: RequestOptions): APIPromise; /** * Create a new dataset from a CSV or JSONL file. */ upload(body: DatasetUploadParams, options?: RequestOptions): APIPromise; } export type DatasetsOffsetPaginationTopLevelArray = OffsetPaginationTopLevelArray; export type DatasetVersionsOffsetPaginationTopLevelArray = OffsetPaginationTopLevelArray; /** * Enum for dataset data types. */ export type DataType = 'kv' | 'llm' | 'chat'; /** * Dataset schema. */ export interface Dataset { id: string; modified_at: string; name: string; session_count: number; tenant_id: string; baseline_experiment_id?: string | null; created_at?: string; /** * Enum for dataset data types. */ data_type?: DataType | null; description?: string | null; example_count?: number | null; externally_managed?: boolean | null; inputs_schema_definition?: { [key: string]: unknown; } | null; last_session_start_time?: string | null; metadata?: { [key: string]: unknown; } | null; outputs_schema_definition?: { [key: string]: unknown; } | null; transformations?: Array | null; } export interface DatasetTransformation { path: Array; /** * Enum for dataset transformation types. Ordering determines the order in which * transformations are applied if there are multiple transformations on the same * path. */ transformation_type: 'convert_to_openai_message' | 'convert_to_openai_tool' | 'remove_system_messages' | 'remove_extra_fields' | 'extract_tools_from_run'; } /** * Dataset version schema. */ export interface DatasetVersion { as_of: string; tags?: Array | null; } /** * Schema used for creating feedback without run id or session id. */ export interface FeedbackCreateCoreSchema { key: string; id?: string; comment?: string | null; comparative_experiment_id?: string | null; correction?: { [key: string]: unknown; } | string | null; created_at?: string; extra?: { [key: string]: unknown; } | null; feedback_config?: FeedbackCreateCoreSchema.FeedbackConfig | null; feedback_group_id?: string | null; /** * Feedback from the LangChainPlus App. */ feedback_source?: FeedbackAPI.AppFeedbackSource | FeedbackAPI.APIFeedbackSource | FeedbackAPI.ModelFeedbackSource | FeedbackAPI.AutoEvalFeedbackSource | null; modified_at?: string; score?: number | boolean | null; value?: number | boolean | string | { [key: string]: unknown; } | null; } export declare namespace FeedbackCreateCoreSchema { interface FeedbackConfig { /** * Enum for feedback types. */ type: 'continuous' | 'categorical' | 'freeform'; categories?: Array | null; max?: number | null; min?: number | null; } namespace FeedbackConfig { /** * Specific value and label pair for feedback */ interface Category { value: number; label?: string | null; } } } export interface Missing { __missing__: '__missing__'; } /** * Enum for available dataset columns to sort by. */ export type SortByDatasetColumn = 'name' | 'created_at' | 'last_session_start_time' | 'example_count' | 'session_count' | 'modified_at'; export interface DatasetUpdateResponse { id: string; name: string; tenant_id: string; created_at?: string; /** * Enum for dataset data types. */ data_type?: DataType | null; description?: string | null; externally_managed?: boolean | null; inputs_schema_definition?: { [key: string]: unknown; } | null; outputs_schema_definition?: { [key: string]: unknown; } | null; transformations?: Array | null; } export type DatasetDeleteResponse = unknown; export type DatasetCloneResponse = Array<{ [key: string]: unknown; }>; export type DatasetRetrieveCsvResponse = unknown; export type DatasetRetrieveJSONLResponse = unknown; export type DatasetRetrieveOpenAIResponse = unknown; export type DatasetRetrieveOpenAIFtResponse = unknown; export interface DatasetCreateParams { name: string; id?: string | null; created_at?: string; /** * Enum for dataset data types. */ data_type?: DataType; description?: string | null; externally_managed?: boolean | null; extra?: { [key: string]: unknown; } | null; inputs_schema_definition?: { [key: string]: unknown; } | null; outputs_schema_definition?: { [key: string]: unknown; } | null; tag_value_ids?: Array | null; transformations?: Array | null; } export interface DatasetUpdateParams { baseline_experiment_id?: string | Missing | null; description?: string | Missing | null; inputs_schema_definition?: { [key: string]: unknown; } | Missing | null; metadata?: { [key: string]: unknown; } | Missing | null; name?: string | Missing | null; outputs_schema_definition?: { [key: string]: unknown; } | Missing | null; patch_examples?: { [key: string]: DatasetUpdateParams.PatchExamples; } | null; transformations?: Array | Missing | null; } export declare namespace DatasetUpdateParams { /** * Update class for Example. */ interface PatchExamples { attachments_operations?: ExamplesAPI.AttachmentsOperations | null; dataset_id?: string | null; inputs?: { [key: string]: unknown; } | null; metadata?: { [key: string]: unknown; } | null; outputs?: { [key: string]: unknown; } | null; overwrite?: boolean; split?: Array | string | null; } } export interface DatasetListParams extends OffsetPaginationTopLevelArrayParams { id?: Array | null; /** * Enum for dataset data types. */ datatype?: Array | DataType | null; exclude?: Array<'example_count'> | null; exclude_corrections_datasets?: boolean; metadata?: string | null; name?: string | null; name_contains?: string | null; /** * Enum for available dataset columns to sort by. */ sort_by?: SortByDatasetColumn; sort_by_desc?: boolean; tag_value_id?: Array | null; } export interface DatasetCloneParams { source_dataset_id: string; target_dataset_id: string; /** * Only modifications made on or before this time are included. If None, the latest * version of the dataset is used. */ as_of?: (string & {}) | string | null; examples?: Array; split?: string | Array | null; tag_value_ids?: Array | null; } export interface DatasetRetrieveCsvParams { /** * Only modifications made on or before this time are included. If None, the latest * version of the dataset is used. */ as_of?: string | null; } export interface DatasetRetrieveJSONLParams { /** * Only modifications made on or before this time are included. If None, the latest * version of the dataset is used. */ as_of?: string | null; } export interface DatasetRetrieveOpenAIParams { /** * Only modifications made on or before this time are included. If None, the latest * version of the dataset is used. */ as_of?: string | null; } export interface DatasetRetrieveOpenAIFtParams { /** * Only modifications made on or before this time are included. If None, the latest * version of the dataset is used. */ as_of?: string | null; } export interface DatasetRetrieveVersionParams { as_of?: string | null; tag?: string | null; } export interface DatasetUpdateTagsParams { /** * Only modifications made on or before this time are included. If None, the latest * version of the dataset is used. */ as_of: (string & {}) | string; tag: string; } export interface DatasetUploadParams { file: Uploadable; input_keys: Array; /** * Enum for dataset data types. */ data_type?: DataType; description?: string | null; input_key_mappings?: string | null; inputs_schema_definition?: string | null; metadata_key_mappings?: string | null; metadata_keys?: Array; name?: string | null; output_key_mappings?: string | null; output_keys?: Array; outputs_schema_definition?: string | null; tag_value_ids?: string | null; transformations?: string | null; } export declare namespace Datasets { export { type DataType as DataType, type Dataset as Dataset, type DatasetTransformation as DatasetTransformation, type DatasetVersion as DatasetVersion, type FeedbackCreateCoreSchema as FeedbackCreateCoreSchema, type Missing as Missing, type SortByDatasetColumn as SortByDatasetColumn, type DatasetUpdateResponse as DatasetUpdateResponse, type DatasetDeleteResponse as DatasetDeleteResponse, type DatasetCloneResponse as DatasetCloneResponse, type DatasetRetrieveCsvResponse as DatasetRetrieveCsvResponse, type DatasetRetrieveJSONLResponse as DatasetRetrieveJSONLResponse, type DatasetRetrieveOpenAIResponse as DatasetRetrieveOpenAIResponse, type DatasetRetrieveOpenAIFtResponse as DatasetRetrieveOpenAIFtResponse, type DatasetsOffsetPaginationTopLevelArray as DatasetsOffsetPaginationTopLevelArray, type DatasetCreateParams as DatasetCreateParams, type DatasetUpdateParams as DatasetUpdateParams, type DatasetListParams as DatasetListParams, type DatasetCloneParams as DatasetCloneParams, type DatasetRetrieveCsvParams as DatasetRetrieveCsvParams, type DatasetRetrieveJSONLParams as DatasetRetrieveJSONLParams, type DatasetRetrieveOpenAIParams as DatasetRetrieveOpenAIParams, type DatasetRetrieveOpenAIFtParams as DatasetRetrieveOpenAIFtParams, type DatasetRetrieveVersionParams as DatasetRetrieveVersionParams, type DatasetUpdateTagsParams as DatasetUpdateTagsParams, type DatasetUploadParams as DatasetUploadParams, }; export { Versions as Versions, type VersionRetrieveDiffResponse as VersionRetrieveDiffResponse, type VersionListParams as VersionListParams, type VersionRetrieveDiffParams as VersionRetrieveDiffParams, }; export { Runs as Runs, 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, }; export { Group as Group, type GroupRunsResponse as GroupRunsResponse, type GroupRunsParams as GroupRunsParams, }; export { Experiments as Experiments, type ExperimentGroupedResponse as ExperimentGroupedResponse, type ExperimentGroupedParams as ExperimentGroupedParams, }; export { Share as Share, type DatasetShareSchema as DatasetShareSchema, type ShareDeleteAllResponse as ShareDeleteAllResponse, type ShareCreateParams as ShareCreateParams, }; export { Comparative as Comparative, type SimpleExperimentInfo as SimpleExperimentInfo, type SortByComparativeExperimentColumn as SortByComparativeExperimentColumn, type ComparativeCreateResponse as ComparativeCreateResponse, type ComparativeDeleteResponse as ComparativeDeleteResponse, type ComparativeCreateParams as ComparativeCreateParams, }; export { Splits as Splits, type SplitCreateResponse as SplitCreateResponse, type SplitRetrieveResponse as SplitRetrieveResponse, type SplitCreateParams as SplitCreateParams, type SplitRetrieveParams as SplitRetrieveParams, }; }