@gradiated/grad 0.0.0-stage → 0.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +83 -2
- package/dist/client.d.ts +71 -0
- package/dist/client.js +188 -0
- package/dist/config.d.ts +21 -0
- package/dist/config.js +90 -0
- package/dist/core.d.ts +13 -0
- package/dist/core.js +1 -0
- package/dist/errors.d.ts +37 -0
- package/dist/errors.js +70 -0
- package/dist/generated/client.d.ts +532 -0
- package/dist/generated/client.js +596 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +3 -0
- package/dist/generated/models.d.ts +998 -0
- package/dist/generated/models.js +9 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +16 -0
- package/dist/node/files.d.ts +26 -0
- package/dist/node/files.js +130 -0
- package/dist/pagination.d.ts +39 -0
- package/dist/pagination.js +73 -0
- package/dist/pending.d.ts +14 -0
- package/dist/pending.js +20 -0
- package/dist/polling.d.ts +25 -0
- package/dist/polling.js +63 -0
- package/dist/recipes.d.ts +220 -0
- package/dist/recipes.js +255 -0
- package/dist/resources/artifacts.d.ts +82 -0
- package/dist/resources/artifacts.js +122 -0
- package/dist/resources/datasets.d.ts +178 -0
- package/dist/resources/datasets.js +318 -0
- package/dist/resources/evals.d.ts +110 -0
- package/dist/resources/evals.js +258 -0
- package/dist/resources/misc.d.ts +31 -0
- package/dist/resources/misc.js +45 -0
- package/dist/resources/runs.d.ts +119 -0
- package/dist/resources/runs.js +245 -0
- package/dist/resources/sources.d.ts +118 -0
- package/dist/resources/sources.js +156 -0
- package/dist/rubrics.d.ts +87 -0
- package/dist/rubrics.js +167 -0
- package/dist/trajectory.d.ts +16 -0
- package/dist/trajectory.js +13 -0
- package/dist/transport.d.ts +229 -0
- package/dist/transport.js +678 -0
- package/package.json +53 -4
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
// AUTO-GENERATED from spec/openapi.yaml by scripts/generate-sdks.mjs. DO NOT EDIT.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { convertKeys, encodePathParam, } from "../transport.js";
|
|
4
|
+
/** Which wire keys are renamed to camelCase, per schema (user-keyed maps are left verbatim). */
|
|
5
|
+
export const CODEC = {
|
|
6
|
+
"AdapterSpec": { u: { o: { o: [["mergeOnExport", "merge_on_export", 0], ["numTokens", "num_tokens", 0]] } } },
|
|
7
|
+
"ApiKey": { o: [["workspaceId", "workspace_id", 0], ["createdAt", "created_at", 0], ["revokedAt", "revoked_at", 0]] },
|
|
8
|
+
"Artifact": { o: [["workspaceId", "workspace_id", 0], ["runId", "run_id", 0], ["checkpointId", "checkpoint_id", 0], ["baseModel", "base_model", 0], ["recipeKind", "recipe_kind", 0], ["sizeBytes", "size_bytes", 0], ["evalReport", "eval_report", "EvalReport"], ["createdAt", "created_at", 0]] },
|
|
9
|
+
"BaseArtifact": { o: [["recipeKind", "recipe_kind", 0]] },
|
|
10
|
+
"ChatMessage": { o: [["toolCalls", "tool_calls", 0], ["toolCallId", "tool_call_id", 0]] },
|
|
11
|
+
"Checkpoint": { o: [["workspaceId", "workspace_id", 0], ["runId", "run_id", 0], ["evalScore", "eval_score", 0], ["sizeBytes", "size_bytes", 0], ["expiresAt", "expires_at", 0], ["createdAt", "created_at", 0]] },
|
|
12
|
+
"CheckpointEvalResult": { o: [["checkpointId", "checkpoint_id", 0], ["evalId", "eval_id", 0], ["datasetVersion", "dataset_version", 0], ["costUsd", "cost_usd", 0]] },
|
|
13
|
+
"CreateImportRequest": { o: [["source", "source", "ImportSource"]] },
|
|
14
|
+
"CreateUploadRequest": { o: [["sizeBytes", "size_bytes", 0]] },
|
|
15
|
+
"CreatedApiKey": { o: [["key", "key", "ApiKey"]] },
|
|
16
|
+
"Dataset": { o: [["workspaceId", "workspace_id", 0], ["recordCount", "record_count", 0], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0]] },
|
|
17
|
+
"DatasetRecord": { o: [["sessionId", "session_id", 0], ["groupId", "group_id", 0], ["messages", "messages", { a: "ChatMessage" }], ["input", "input", "TrajectoryInput"], ["output", "output", "TrajectoryOutput"], ["prompt", "prompt", { u: { a: { a: "ChatMessage" } } }], ["completion", "completion", { u: { a: { a: "ChatMessage" } } }], ["chosen", "chosen", { u: { a: { a: "ChatMessage" } } }], ["rejected", "rejected", { u: { a: { a: "ChatMessage" } } }], ["expectedOutput", "expected_output", 0]] },
|
|
18
|
+
"DatasetRecordsPage": { o: [["data", "data", { a: "DatasetRecord" }], ["nextCursor", "next_cursor", 0]] },
|
|
19
|
+
"DecisionHeadReport": { o: [["macroF1", "macro_f1", 0], ["perOption", "per_option", 0], ["confusionMatrix", "confusion_matrix", 0]] },
|
|
20
|
+
"DeployArtifactRequest": { o: [["exploreRate", "explore_rate", 0]] },
|
|
21
|
+
"Deployment": { o: [["workspaceId", "workspace_id", 0], ["modelId", "model_id", 0], ["activeArtifactId", "active_artifact_id", 0], ["previousArtifactId", "previous_artifact_id", 0], ["fallbackModel", "fallback_model", 0], ["exploreRate", "explore_rate", 0], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0]] },
|
|
22
|
+
"DeploymentStatus": { o: [["deployment", "deployment", "Deployment"], ["feedbackCount", "feedback_count", 0], ["averageScore", "average_score", 0]] },
|
|
23
|
+
"EmbedResponse": { o: [["usage", "usage", { o: [["promptTokens", "prompt_tokens", 0], ["totalTokens", "total_tokens", 0]] }]] },
|
|
24
|
+
"EvalModelSummary": { o: [["ciLow", "ci_low", 0], ["ciHigh", "ci_high", 0], ["passAtK", "pass_at_k", 0], ["vsBaseline", "vs_baseline", { o: [["ciLow", "ci_low", 0], ["ciHigh", "ci_high", 0]] }], ["tokensPerTask", "tokens_per_task", 0], ["costPer1kTasksUsd", "cost_per_1k_tasks_usd", 0]] },
|
|
25
|
+
"EvalOutput": { o: [["evalId", "eval_id", 0], ["taskId", "task_id", 0], ["sampleIndex", "sample_index", 0], ["input", "input", { a: "ChatMessage" }], ["expectedOutput", "expected_output", 0], ["record", "record", "DatasetRecord"], ["usage", "usage", { o: [["promptTokens", "prompt_tokens", 0], ["completionTokens", "completion_tokens", 0]] }]] },
|
|
26
|
+
"EvalReport": { o: [["metricName", "metric_name", 0], ["metricMode", "metric_mode", 0], ["selectedStep", "selected_step", 0], ["bestStep", "best_step", 0], ["finalStep", "final_step", 0], ["trainRecords", "train_records", 0], ["evalRecords", "eval_records", 0], ["evalLoss", "eval_loss", 0], ["evalTokenAccuracy", "eval_token_accuracy", 0], ["trainedTokenFraction", "trained_token_fraction", 0], ["trainExamples", "train_examples", 0], ["evalExamples", "eval_examples", 0], ["selectionExamples", "selection_examples", 0], ["preferenceAccuracy", "preference_accuracy", 0], ["rewardMargin", "reward_margin", 0], ["trainPairs", "train_pairs", 0], ["evalPairs", "eval_pairs", 0], ["droppedRecords", "dropped_records", 0], ["trainPoints", "train_points", 0], ["evalPoints", "eval_points", 0], ["pointwiseBrier", "pointwise_brier", 0], ["evalKl", "eval_kl", 0], ["baseKl", "base_kl", 0], ["noContextKl", "no_context_kl", 0], ["klReduction", "kl_reduction", 0], ["numTokens", "num_tokens", 0], ["fallbackModel", "fallback_model", 0], ["fallbackQuality", "fallback_quality", 0], ["routesAnyTraffic", "routes_any_traffic", 0], ["paretoSummary", "pareto_summary", "RouterParetoSummary"], ["heads", "heads", { m: "DecisionHeadReport" }], ["recallAt1", "recall_at_1", 0], ["recallAt5", "recall_at_5", 0], ["recallAt10", "recall_at_10", 0], ["corpusSize", "corpus_size", 0], ["baseline", "baseline", { o: [["recallAt1", "recall_at_1", 0], ["recallAt5", "recall_at_5", 0], ["recallAt10", "recall_at_10", 0]] }]] },
|
|
27
|
+
"EvalRun": { o: [["workspaceId", "workspace_id", 0], ["taskSource", "task_source", 0], ["maxTokens", "max_tokens", 0], ["passThreshold", "pass_threshold", 0], ["judgeModels", "judge_models", 0], ["localScorers", "local_scorers", 0], ["progress", "progress", { o: [["totalOutputs", "total_outputs", 0], ["pendingLocalScores", "pending_local_scores", 0]] }], ["summary", "summary", { a: "EvalModelSummary" }], ["totalCostUsd", "total_cost_usd", 0], ["scoredDatasetVersion", "scored_dataset_version", 0], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0], ["completedAt", "completed_at", 0]] },
|
|
28
|
+
"EvalTaskOutcome": { o: [["taskId", "task_id", 0], ["sampleScores", "sample_scores", 0], ["judgeModel", "judge_model", 0], ["record", "record", "DatasetRecord"]] },
|
|
29
|
+
"FeedbackEventInput": { o: [["inferenceId", "inference_id", 0], ["sessionId", "session_id", 0], ["deploymentName", "deployment_name", 0], ["idempotencyKey", "idempotency_key", 0], ["expectedOutput", "expected_output", 0]] },
|
|
30
|
+
"FeedbackRecord": { o: [["workspaceId", "workspace_id", 0], ["inferenceId", "inference_id", 0], ["sessionId", "session_id", 0], ["deploymentName", "deployment_name", 0], ["idempotencyKey", "idempotency_key", 0], ["expectedOutput", "expected_output", 0], ["createdAt", "created_at", 0]] },
|
|
31
|
+
"FilterDatasetRequest": { o: [["createdAfter", "created_after", 0], ["createdBefore", "created_before", 0]] },
|
|
32
|
+
"ImportJob": { o: [["workspaceId", "workspace_id", 0], ["importedCount", "imported_count", 0], ["droppedCount", "dropped_count", 0], ["detectedScores", "detected_scores", 0], ["dropReasons", "drop_reasons", 0], ["datasetVersion", "dataset_version", 0], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0]] },
|
|
33
|
+
"ImportSource": { u: { o: { o: [["uploadId", "upload_id", 0]] } } },
|
|
34
|
+
"LoggerSpec": { u: { o: { o: [["runName", "run_name", 0], ["trackingUri", "tracking_uri", 0]] } } },
|
|
35
|
+
"LossSpec": { u: { o: { o: [["topK", "top_k", 0]] } } },
|
|
36
|
+
"MetricPoint": { o: [["evalLoss", "eval_loss", 0], ["evalMetrics", "eval_metrics", 0], ["gradNorm", "grad_norm", 0], ["tokensPerSec", "tokens_per_sec", 0], ["costUsd", "cost_usd", 0]] },
|
|
37
|
+
"MetricsPage": { o: [["runId", "run_id", 0], ["data", "data", { a: "MetricPoint" }], ["nextCursor", "next_cursor", 0], ["tailCursor", "tail_cursor", 0]] },
|
|
38
|
+
"OptimizerSpec": { o: [["weightDecay", "weight_decay", 0], ["gradClip", "grad_clip", 0]] },
|
|
39
|
+
"PlanEvalRequest": { o: [["datasetVersion", "dataset_version", 0], ["maxTokens", "max_tokens", 0], ["passThreshold", "pass_threshold", 0]] },
|
|
40
|
+
"PlanEvalResponse": { o: [["taskSourceKind", "task_source_kind", 0], ["datasetVersion", "dataset_version", 0], ["estimatedTasks", "estimated_tasks", 0], ["estimatedModelCalls", "estimated_model_calls", 0], ["estimatedJudgeCalls", "estimated_judge_calls", 0], ["estimatedCostUsd", "estimated_cost_usd", 0], ["judgeModels", "judge_models", 0], ["localScorers", "local_scorers", 0], ["passThreshold", "pass_threshold", 0]] },
|
|
41
|
+
"PlanRunRequest": { o: [["recipe", "recipe", "RecipeSpec"], ["split", "split", "SplitSpec"], ["maxCostUsd", "max_cost_usd", 0]] },
|
|
42
|
+
"PlanRunResponse": { o: [["resolvedConfig", "resolved_config", "ResolvedRunConfig"], ["datasetVersion", "dataset_version", 0], ["usableRecords", "usable_records", 0], ["totalRecords", "total_records", 0], ["estimatedSteps", "estimated_steps", 0], ["estimatedTokens", "estimated_tokens", 0], ["estimatedCostUsd", "estimated_cost_usd", 0], ["pricePerMillionTokens", "price_per_million_tokens", 0], ["trainedTokenFraction", "trained_token_fraction", 0], ["labeling", "labeling", { o: [["estimatedModelCalls", "estimated_model_calls", 0], ["estimatedJudgeCalls", "estimated_judge_calls", 0], ["estimatedCostUsd", "estimated_cost_usd", 0]] }], ["teacher", "teacher", { o: [["pricePerMillionTokens", "price_per_million_tokens", 0], ["estimatedTokens", "estimated_tokens", 0], ["estimatedCostUsd", "estimated_cost_usd", 0]] }]] },
|
|
43
|
+
"PostEvalScoresRequest": { o: [["scores", "scores", { a: { o: [["outputId", "output_id", 0]] } }]] },
|
|
44
|
+
"PostEvalScoresResponse": { o: [["pendingLocalScores", "pending_local_scores", 0]] },
|
|
45
|
+
"PushDatasetRequest": { o: [["records", "records", { a: "DatasetRecord" }]] },
|
|
46
|
+
"RecipeSpec": { o: [["adapter", "adapter", "AdapterSpec"], ["lrScale", "lr_scale", 0], ["batchSize", "batch_size", 0], ["trainOn", "train_on", 0], ["preserveThinking", "preserve_thinking", 0], ["checkpointTtlDays", "checkpoint_ttl_days", 0], ["maxQualityDrop", "max_quality_drop", 0], ["contextText", "context_text", 0], ["numTokens", "num_tokens", 0], ["rollout", "rollout", "RolloutSpec"], ["optimizer", "optimizer", "OptimizerSpec"], ["evalEvery", "eval_every", 0], ["loss", "loss", "LossSpec"], ["maxNewTokens", "max_new_tokens", 0], ["slotToken", "slot_token", 0], ["loggers", "loggers", { a: "LoggerSpec" }]] },
|
|
47
|
+
"RecordFeedbackRequest": { o: [["events", "events", { a: "FeedbackEventInput" }]] },
|
|
48
|
+
"RecordFeedbackResponse": { o: [["records", "records", { a: "FeedbackRecord" }]] },
|
|
49
|
+
"RenderDatasetRequest": { o: [["trainOn", "train_on", 0], ["preserveThinking", "preserve_thinking", 0]] },
|
|
50
|
+
"RenderDatasetResponse": { o: [["templateRevision", "template_revision", 0], ["tokenCounts", "token_counts", 0], ["examples", "examples", { a: { o: [["recordId", "record_id", 0], ["templateRevision", "template_revision", 0], ["totalTokens", "total_tokens", 0], ["trainedTokens", "trained_tokens", 0], ["trainedFraction", "trained_fraction", 0]] } }]] },
|
|
51
|
+
"ResolvedRunConfig": { o: [["ruleVersion", "rule_version", 0], ["datasetVersion", "dataset_version", 0], ["recipeKind", "recipe_kind", 0], ["templateRevision", "template_revision", 0], ["adapter", "adapter", { u: { o: { o: [["mergeOnExport", "merge_on_export", 0], ["numTokens", "num_tokens", 0]] } } }], ["lrSource", "lr_source", 0], ["batchSize", "batch_size", 0], ["trainOn", "train_on", 0], ["preserveThinking", "preserve_thinking", 0], ["checkpointEverySteps", "checkpoint_every_steps", 0], ["evalEverySteps", "eval_every_steps", 0], ["optimizer", "optimizer", "OptimizerSpec"], ["checkpointTtlDays", "checkpoint_ttl_days", 0], ["split", "split", { o: [["evalFraction", "eval_fraction", 0], ["trainRecords", "train_records", 0], ["evalRecords", "eval_records", 0]] }], ["labelEvalId", "label_eval_id", 0], ["baseArtifact", "base_artifact", "BaseArtifact"], ["recipeParams", "recipe_params", 0], ["checkpointEvals", "checkpoint_evals", { a: { o: [["datasetVersion", "dataset_version", 0]] } }], ["loggers", "loggers", { a: "LoggerSpec" }]] },
|
|
52
|
+
"ResumeRunRequest": { o: [["maxCostUsd", "max_cost_usd", 0]] },
|
|
53
|
+
"RolloutSpec": { u: { o: { o: [["maxNewTokens", "max_new_tokens", 0]] } } },
|
|
54
|
+
"RouteRequest": { o: [["messages", "messages", { a: "ChatMessage" }], ["sessionId", "session_id", 0]] },
|
|
55
|
+
"RouteResponse": { o: [["inferenceId", "inference_id", 0], ["artifactId", "artifact_id", 0], ["isExploration", "is_exploration", 0]] },
|
|
56
|
+
"RouterParetoSummary": { o: [["targetMaxDrop", "target_max_drop", 0], ["routedQuality", "routed_quality", 0], ["qualityDrop", "quality_drop", 0], ["qualityDropCi95", "quality_drop_ci95", 0], ["offloadRate", "offload_rate", 0], ["costSavingsPct", "cost_savings_pct", 0]] },
|
|
57
|
+
"Run": { o: [["workspaceId", "workspace_id", 0], ["datasetId", "dataset_id", 0], ["datasetName", "dataset_name", 0], ["datasetVersion", "dataset_version", 0], ["recipeKind", "recipe_kind", 0], ["resolvedConfig", "resolved_config", "ResolvedRunConfig"], ["maxCostUsd", "max_cost_usd", 0], ["pricePerMillionTokens", "price_per_million_tokens", 0], ["tokensProcessed", "tokens_processed", 0], ["costUsd", "cost_usd", 0], ["currentStep", "current_step", 0], ["totalSteps", "total_steps", 0], ["maxAttempts", "max_attempts", 0], ["latestMetric", "latest_metric", "MetricPoint"], ["evalReport", "eval_report", "EvalReport"], ["checkpointEvals", "checkpoint_evals", { a: "CheckpointEvalResult" }], ["artifactId", "artifact_id", 0], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0], ["finishedAt", "finished_at", 0]] },
|
|
58
|
+
"Secret": { o: [["workspaceId", "workspace_id", 0], ["allowedHosts", "allowed_hosts", 0], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0]] },
|
|
59
|
+
"SetSecretRequest": { o: [["allowedHosts", "allowed_hosts", 0]] },
|
|
60
|
+
"Source": { o: [["workspaceId", "workspace_id", 0], ["nextSyncAt", "next_sync_at", 0], ["pausedReason", "paused_reason", 0], ["lastError", "last_error", 0], ["lastErrorAt", "last_error_at", 0], ["consecutiveFailures", "consecutive_failures", 0], ["pendingFull", "pending_full", 0], ["lastSyncedAt", "last_synced_at", 0], ["lastSync", "last_sync", "SourceSync"], ["createdAt", "created_at", 0], ["updatedAt", "updated_at", 0]] },
|
|
61
|
+
"SourceSync": { o: [["importId", "import_id", 0], ["datasetVersion", "dataset_version", 0], ["createdAt", "created_at", 0], ["finishedAt", "finished_at", 0]] },
|
|
62
|
+
"SplitSpec": { o: [["evalFraction", "eval_fraction", 0]] },
|
|
63
|
+
"TrainableModel": { o: [["hfRepo", "hf_repo", 0], ["defaultFor", "default_for", 0], ["pricePerMillionTokensUsd", "price_per_million_tokens_usd", 0], ["maxContextTokens", "max_context_tokens", 0], ["templateRevision", "template_revision", 0], ["calibratedLrs", "calibrated_lrs", 0]] },
|
|
64
|
+
"TrajectoryInput": { o: [["messages", "messages", { a: "ChatMessage" }]] },
|
|
65
|
+
"TrajectoryOutput": { o: [["turns", "turns", { a: "ChatMessage" }]] },
|
|
66
|
+
"UploadTicket": { o: [["uploadId", "upload_id", 0], ["expiresAt", "expires_at", 0]] },
|
|
67
|
+
"UsageRecord": { o: [["refId", "ref_id", 0], ["tokensFrom", "tokens_from", 0], ["tokensThrough", "tokens_through", 0], ["costUsd", "cost_usd", 0], ["priceVersion", "price_version", 0], ["idempotencyKey", "idempotency_key", 0], ["createdAt", "created_at", 0]] },
|
|
68
|
+
};
|
|
69
|
+
/** Largest `limit` accepted by `listApiKeys` (the server clamps larger values). */
|
|
70
|
+
export const LIST_API_KEYS_LIMIT_MAX = 200;
|
|
71
|
+
/** Largest `limit` accepted by `listArtifacts` (the server clamps larger values). */
|
|
72
|
+
export const LIST_ARTIFACTS_LIMIT_MAX = 200;
|
|
73
|
+
/** Largest `limit` accepted by `listDatasetRecords` (the server clamps larger values). */
|
|
74
|
+
export const LIST_DATASET_RECORDS_LIMIT_MAX = 1000;
|
|
75
|
+
/** Largest `limit` accepted by `listDatasets` (the server clamps larger values). */
|
|
76
|
+
export const LIST_DATASETS_LIMIT_MAX = 200;
|
|
77
|
+
/** Largest `limit` accepted by `listDeployments` (the server clamps larger values). */
|
|
78
|
+
export const LIST_DEPLOYMENTS_LIMIT_MAX = 200;
|
|
79
|
+
/** Largest `limit` accepted by `listEvalFailures` (the server clamps larger values). */
|
|
80
|
+
export const LIST_EVAL_FAILURES_LIMIT_MAX = 200;
|
|
81
|
+
/** Largest `limit` accepted by `listEvalOutputs` (the server clamps larger values). */
|
|
82
|
+
export const LIST_EVAL_OUTPUTS_LIMIT_MAX = 200;
|
|
83
|
+
/** Largest `limit` accepted by `listEvalResults` (the server clamps larger values). */
|
|
84
|
+
export const LIST_EVAL_RESULTS_LIMIT_MAX = 200;
|
|
85
|
+
/** Largest `limit` accepted by `listEvals` (the server clamps larger values). */
|
|
86
|
+
export const LIST_EVALS_LIMIT_MAX = 200;
|
|
87
|
+
/** Largest `limit` accepted by `listImports` (the server clamps larger values). */
|
|
88
|
+
export const LIST_IMPORTS_LIMIT_MAX = 200;
|
|
89
|
+
/** Largest `limit` accepted by `listRunCheckpoints` (the server clamps larger values). */
|
|
90
|
+
export const LIST_RUN_CHECKPOINTS_LIMIT_MAX = 200;
|
|
91
|
+
/** Largest `limit` accepted by `listRunMetrics` (the server clamps larger values). */
|
|
92
|
+
export const LIST_RUN_METRICS_LIMIT_MAX = 5000;
|
|
93
|
+
/** Largest `limit` accepted by `listRuns` (the server clamps larger values). */
|
|
94
|
+
export const LIST_RUNS_LIMIT_MAX = 200;
|
|
95
|
+
/** Largest `limit` accepted by `listSecrets` (the server clamps larger values). */
|
|
96
|
+
export const LIST_SECRETS_LIMIT_MAX = 200;
|
|
97
|
+
/** Largest `limit` accepted by `listSources` (the server clamps larger values). */
|
|
98
|
+
export const LIST_SOURCES_LIMIT_MAX = 200;
|
|
99
|
+
/** Largest `limit` accepted by `listUsage` (the server clamps larger values). */
|
|
100
|
+
export const LIST_USAGE_LIMIT_MAX = 200;
|
|
101
|
+
/** Low-level client: one typed method per OpenAPI operation. */
|
|
102
|
+
export class ApiClient {
|
|
103
|
+
transport;
|
|
104
|
+
constructor(transport) {
|
|
105
|
+
this.transport = transport;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Cancel a queued, running or awaiting_scores evaluation
|
|
109
|
+
*
|
|
110
|
+
* `POST /v1/evals/{id}/cancel`
|
|
111
|
+
*/
|
|
112
|
+
async cancelEval(id, options) {
|
|
113
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/evals/${encodePathParam(id, "id")}/cancel`, idempotent: true }, options);
|
|
114
|
+
return convertKeys(CODEC, "EvalRun", data, "decode");
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Cancel a training run (a running attempt is stopped and billed)
|
|
118
|
+
*
|
|
119
|
+
* `POST /v1/runs/{id}/cancel`
|
|
120
|
+
*/
|
|
121
|
+
async cancelRun(id, options) {
|
|
122
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/runs/${encodePathParam(id, "id")}/cancel`, idempotent: true }, options);
|
|
123
|
+
return convertKeys(CODEC, "Run", data, "decode");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create a scoped workspace API key (trainer worker keys are platform config, not keys)
|
|
127
|
+
*
|
|
128
|
+
* `POST /v1/keys`
|
|
129
|
+
*/
|
|
130
|
+
async createApiKey(body, options) {
|
|
131
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/keys`, json: body, idempotent: true }, options);
|
|
132
|
+
return convertKeys(CODEC, "CreatedApiKey", data, "decode");
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create an empty dataset
|
|
136
|
+
*
|
|
137
|
+
* `POST /v1/datasets`
|
|
138
|
+
*/
|
|
139
|
+
async createDataset(body, options) {
|
|
140
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets`, json: body, idempotent: true }, options);
|
|
141
|
+
return convertKeys(CODEC, "Dataset", data, "decode");
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Import an uploaded file or a Hugging Face dataset into a dataset (async job)
|
|
145
|
+
*
|
|
146
|
+
* `POST /v1/datasets/{name}/imports`
|
|
147
|
+
*/
|
|
148
|
+
async createDatasetImport(name, body, options) {
|
|
149
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets/${encodePathParam(name, "name")}/imports`, json: convertKeys(CODEC, "CreateImportRequest", body, "encode"), idempotent: true }, options);
|
|
150
|
+
return convertKeys(CODEC, "ImportJob", data, "decode");
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Connect an observability provider to a dataset
|
|
154
|
+
*
|
|
155
|
+
* `POST /v1/datasets/{name}/sources`
|
|
156
|
+
*/
|
|
157
|
+
async createDatasetSource(name, body, options) {
|
|
158
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets/${encodePathParam(name, "name")}/sources`, json: body, idempotent: true }, options);
|
|
159
|
+
return convertKeys(CODEC, "Source", data, "decode");
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Generate embeddings from a deployed embedding artifact
|
|
163
|
+
*
|
|
164
|
+
* `POST /v1/embeddings`
|
|
165
|
+
*/
|
|
166
|
+
async createEmbeddings(body, options) {
|
|
167
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/embeddings`, json: body, idempotent: true }, options);
|
|
168
|
+
return convertKeys(CODEC, "EmbedResponse", data, "decode");
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Queue an evaluation across models on a pinned dataset version (executed by the server)
|
|
172
|
+
*
|
|
173
|
+
* `POST /v1/evals`
|
|
174
|
+
*/
|
|
175
|
+
async createEval(body, options) {
|
|
176
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/evals`, json: convertKeys(CODEC, "PlanEvalRequest", body, "encode"), idempotent: true }, options);
|
|
177
|
+
return convertKeys(CODEC, "EvalRun", data, "decode");
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Create and enqueue a training run (pins the dataset version)
|
|
181
|
+
*
|
|
182
|
+
* `POST /v1/runs`
|
|
183
|
+
*/
|
|
184
|
+
async createRun(body, options) {
|
|
185
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/runs`, json: convertKeys(CODEC, "PlanRunRequest", body, "encode"), idempotent: true }, options);
|
|
186
|
+
return convertKeys(CODEC, "Run", data, "decode");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get an upload URL for a file to import (PUT the bytes, then create an import)
|
|
190
|
+
*
|
|
191
|
+
* `POST /v1/uploads`
|
|
192
|
+
*/
|
|
193
|
+
async createUpload(body, options) {
|
|
194
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/uploads`, json: convertKeys(CODEC, "CreateUploadRequest", body, "encode"), idempotent: true }, options);
|
|
195
|
+
return convertKeys(CODEC, "UploadTicket", data, "decode");
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Delete a secret (409 while a source uses it)
|
|
199
|
+
*
|
|
200
|
+
* `DELETE /v1/secrets/{name}`
|
|
201
|
+
*/
|
|
202
|
+
async deleteSecret(name, options) {
|
|
203
|
+
await this.transport.json({ method: "DELETE", path: `/v1/secrets/${encodePathParam(name, "name")}` }, options);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Remove a source (its dataset and versions stay)
|
|
207
|
+
*
|
|
208
|
+
* `DELETE /v1/sources/{id}`
|
|
209
|
+
*/
|
|
210
|
+
async deleteSource(id, options) {
|
|
211
|
+
await this.transport.json({ method: "DELETE", path: `/v1/sources/${encodePathParam(id, "id")}` }, options);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Deploy or update an artifact under a stable model name
|
|
215
|
+
*
|
|
216
|
+
* `POST /v1/deployments`
|
|
217
|
+
*/
|
|
218
|
+
async deployArtifact(body, options) {
|
|
219
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/deployments`, json: convertKeys(CODEC, "DeployArtifactRequest", body, "encode"), idempotent: true }, options);
|
|
220
|
+
return convertKeys(CODEC, "Deployment", data, "decode");
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Download an artifact bundle (.grad.tar.gz); verify X-Artifact-Sha256
|
|
224
|
+
*
|
|
225
|
+
* `GET /v1/artifacts/{id}/download`
|
|
226
|
+
*/
|
|
227
|
+
downloadArtifact(id, options) {
|
|
228
|
+
return this.transport.raw({ method: "GET", path: `/v1/artifacts/${encodePathParam(id, "id")}/download`, accept: "application/octet-stream" }, options);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Save a filtered view of a dataset version
|
|
232
|
+
*
|
|
233
|
+
* `POST /v1/datasets/{name}/filter`
|
|
234
|
+
*/
|
|
235
|
+
async filterDataset(name, body, options) {
|
|
236
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets/${encodePathParam(name, "name")}/filter`, json: convertKeys(CODEC, "FilterDatasetRequest", body, "encode"), idempotent: true }, options);
|
|
237
|
+
return convertKeys(CODEC, "Dataset", data, "decode");
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get an artifact by id or name@latest
|
|
241
|
+
*
|
|
242
|
+
* `GET /v1/artifacts/{id}`
|
|
243
|
+
*/
|
|
244
|
+
async getArtifact(id, options) {
|
|
245
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/artifacts/${encodePathParam(id, "id")}` }, options);
|
|
246
|
+
return convertKeys(CODEC, "Artifact", data, "decode");
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get a dataset by name
|
|
250
|
+
*
|
|
251
|
+
* `GET /v1/datasets/{name}`
|
|
252
|
+
*/
|
|
253
|
+
async getDataset(name, options) {
|
|
254
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/datasets/${encodePathParam(name, "name")}` }, options);
|
|
255
|
+
return convertKeys(CODEC, "Dataset", data, "decode");
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get deployment status and feedback summary
|
|
259
|
+
*
|
|
260
|
+
* `GET /v1/deployments/{name}`
|
|
261
|
+
*/
|
|
262
|
+
async getDeployment(name, options) {
|
|
263
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/deployments/${encodePathParam(name, "name")}` }, options);
|
|
264
|
+
return convertKeys(CODEC, "DeploymentStatus", data, "decode");
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Get an evaluation run by ID
|
|
268
|
+
*
|
|
269
|
+
* `GET /v1/evals/{id}`
|
|
270
|
+
*/
|
|
271
|
+
async getEval(id, options) {
|
|
272
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/evals/${encodePathParam(id, "id")}` }, options);
|
|
273
|
+
return convertKeys(CODEC, "EvalRun", data, "decode");
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Get a dataset import job
|
|
277
|
+
*
|
|
278
|
+
* `GET /v1/imports/{id}`
|
|
279
|
+
*/
|
|
280
|
+
async getImport(id, options) {
|
|
281
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/imports/${encodePathParam(id, "id")}` }, options);
|
|
282
|
+
return convertKeys(CODEC, "ImportJob", data, "decode");
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get a training run
|
|
286
|
+
*
|
|
287
|
+
* `GET /v1/runs/{id}`
|
|
288
|
+
*/
|
|
289
|
+
async getRun(id, options) {
|
|
290
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/runs/${encodePathParam(id, "id")}` }, options);
|
|
291
|
+
return convertKeys(CODEC, "Run", data, "decode");
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Get a secret's metadata (never the value)
|
|
295
|
+
*
|
|
296
|
+
* `GET /v1/secrets/{name}`
|
|
297
|
+
*/
|
|
298
|
+
async getSecret(name, options) {
|
|
299
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/secrets/${encodePathParam(name, "name")}` }, options);
|
|
300
|
+
return convertKeys(CODEC, "Secret", data, "decode");
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get a source and its latest sync
|
|
304
|
+
*
|
|
305
|
+
* `GET /v1/sources/{id}`
|
|
306
|
+
*/
|
|
307
|
+
async getSource(id, options) {
|
|
308
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/sources/${encodePathParam(id, "id")}` }, options);
|
|
309
|
+
return convertKeys(CODEC, "Source", data, "decode");
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* List workspace API keys
|
|
313
|
+
*
|
|
314
|
+
* `GET /v1/keys`
|
|
315
|
+
*/
|
|
316
|
+
async listApiKeys(params, options) {
|
|
317
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/keys`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
318
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "ApiKey" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* List immutable artifacts (newest first)
|
|
322
|
+
*
|
|
323
|
+
* `GET /v1/artifacts`
|
|
324
|
+
*/
|
|
325
|
+
async listArtifacts(params, options) {
|
|
326
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/artifacts`, query: [["limit", params?.limit], ["cursor", params?.cursor], ["name", params?.name]] }, options);
|
|
327
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Artifact" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* List trainable base models (the server catalog and price source)
|
|
331
|
+
*
|
|
332
|
+
* `GET /v1/base-models`
|
|
333
|
+
*/
|
|
334
|
+
async listBaseModels(options) {
|
|
335
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/base-models` }, options);
|
|
336
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "TrainableModel" }]] }, data, "decode");
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Read records of a dataset version
|
|
340
|
+
*
|
|
341
|
+
* `GET /v1/datasets/{name}/records`
|
|
342
|
+
*/
|
|
343
|
+
async listDatasetRecords(name, params, options) {
|
|
344
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/datasets/${encodePathParam(name, "name")}/records`, query: [["version", params?.version], ["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
345
|
+
return convertKeys(CODEC, "DatasetRecordsPage", data, "decode");
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* List datasets (newest first)
|
|
349
|
+
*
|
|
350
|
+
* `GET /v1/datasets`
|
|
351
|
+
*/
|
|
352
|
+
async listDatasets(params, options) {
|
|
353
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/datasets`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
354
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Dataset" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* List deployments
|
|
358
|
+
*
|
|
359
|
+
* `GET /v1/deployments`
|
|
360
|
+
*/
|
|
361
|
+
async listDeployments(params, options) {
|
|
362
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/deployments`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
363
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Deployment" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* List failing task records from an evaluation run for mining
|
|
367
|
+
*
|
|
368
|
+
* `GET /v1/evals/{id}/failures`
|
|
369
|
+
*/
|
|
370
|
+
async listEvalFailures(id, params, options) {
|
|
371
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/evals/${encodePathParam(id, "id")}/failures`, query: [["limit", params?.limit], ["cursor", params?.cursor], ["model", params?.model], ["threshold", params?.threshold]] }, options);
|
|
372
|
+
return convertKeys(CODEC, { o: [["evalId", "eval_id", 0], ["data", "data", { a: "EvalTaskOutcome" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Page through generated model outputs (filter by model or by a code scorer that still needs a score)
|
|
376
|
+
*
|
|
377
|
+
* `GET /v1/evals/{id}/outputs`
|
|
378
|
+
*/
|
|
379
|
+
async listEvalOutputs(id, params, options) {
|
|
380
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/evals/${encodePathParam(id, "id")}/outputs`, query: [["limit", params?.limit], ["cursor", params?.cursor], ["model", params?.model], ["missing_scorer", params?.missingScorer]] }, options);
|
|
381
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "EvalOutput" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Per-task, per-model results of a completed evaluation
|
|
385
|
+
*
|
|
386
|
+
* `GET /v1/evals/{id}/results`
|
|
387
|
+
*/
|
|
388
|
+
async listEvalResults(id, params, options) {
|
|
389
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/evals/${encodePathParam(id, "id")}/results`, query: [["limit", params?.limit], ["cursor", params?.cursor], ["model", params?.model]] }, options);
|
|
390
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "EvalTaskOutcome" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* List evaluation runs
|
|
394
|
+
*
|
|
395
|
+
* `GET /v1/evals`
|
|
396
|
+
*/
|
|
397
|
+
async listEvals(params, options) {
|
|
398
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/evals`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
399
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "EvalRun" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* List dataset import jobs (newest first)
|
|
403
|
+
*
|
|
404
|
+
* `GET /v1/imports`
|
|
405
|
+
*/
|
|
406
|
+
async listImports(params, options) {
|
|
407
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/imports`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
408
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "ImportJob" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* List unexpired checkpoints of a run (best and final never expire)
|
|
412
|
+
*
|
|
413
|
+
* `GET /v1/runs/{id}/checkpoints`
|
|
414
|
+
*/
|
|
415
|
+
async listRunCheckpoints(id, params, options) {
|
|
416
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/runs/${encodePathParam(id, "id")}/checkpoints`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
417
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Checkpoint" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Training step metrics as JSON pages, or a live SSE stream
|
|
421
|
+
*
|
|
422
|
+
* `GET /v1/runs/{id}/metrics`
|
|
423
|
+
*/
|
|
424
|
+
async listRunMetrics(id, params, options) {
|
|
425
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/runs/${encodePathParam(id, "id")}/metrics`, query: [["cursor", params?.cursor], ["after_step", params?.afterStep], ["limit", params?.limit]] }, options);
|
|
426
|
+
return convertKeys(CODEC, "MetricsPage", data, "decode");
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Training step metrics as JSON pages, or a live SSE stream (Server-Sent Events; one connection, resume with `lastEventId`)
|
|
430
|
+
*/
|
|
431
|
+
listRunMetricsStream(id, params, options) {
|
|
432
|
+
return this.transport.sse({ method: "GET", path: `/v1/runs/${encodePathParam(id, "id")}/metrics`, query: [["cursor", params?.cursor], ["after_step", params?.afterStep], ["limit", params?.limit]] }, options);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* List training runs (newest first)
|
|
436
|
+
*
|
|
437
|
+
* `GET /v1/runs`
|
|
438
|
+
*/
|
|
439
|
+
async listRuns(params, options) {
|
|
440
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/runs`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
441
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Run" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* List workspace secrets (names and metadata only)
|
|
445
|
+
*
|
|
446
|
+
* `GET /v1/secrets`
|
|
447
|
+
*/
|
|
448
|
+
async listSecrets(params, options) {
|
|
449
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/secrets`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
450
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Secret" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* List sources (newest first), optionally for one dataset
|
|
454
|
+
*
|
|
455
|
+
* `GET /v1/sources`
|
|
456
|
+
*/
|
|
457
|
+
async listSources(params, options) {
|
|
458
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/sources`, query: [["limit", params?.limit], ["cursor", params?.cursor], ["dataset", params?.dataset]] }, options);
|
|
459
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "Source" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* List billed usage, newest first: one record per run or eval attempt
|
|
463
|
+
*
|
|
464
|
+
* `GET /v1/usage`
|
|
465
|
+
*/
|
|
466
|
+
async listUsage(params, options) {
|
|
467
|
+
const data = await this.transport.json({ method: "GET", path: `/v1/usage`, query: [["limit", params?.limit], ["cursor", params?.cursor]] }, options);
|
|
468
|
+
return convertKeys(CODEC, { o: [["data", "data", { a: "UsageRecord" }], ["nextCursor", "next_cursor", 0]] }, data, "decode");
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Estimate tasks, model/judge calls, and cost before running an eval
|
|
472
|
+
*
|
|
473
|
+
* `POST /v1/evals/plan`
|
|
474
|
+
*/
|
|
475
|
+
async planEval(body, options) {
|
|
476
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/evals/plan`, json: convertKeys(CODEC, "PlanEvalRequest", body, "encode"), idempotent: true }, options);
|
|
477
|
+
return convertKeys(CODEC, "PlanEvalResponse", data, "decode");
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Dry-run a training recipe at zero cost
|
|
481
|
+
*
|
|
482
|
+
* `POST /v1/runs/plan`
|
|
483
|
+
*/
|
|
484
|
+
async planRun(body, options) {
|
|
485
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/runs/plan`, json: convertKeys(CODEC, "PlanRunRequest", body, "encode"), idempotent: true }, options);
|
|
486
|
+
return convertKeys(CODEC, "PlanRunResponse", data, "decode");
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Post scores computed by local (SDK-side) code scorers; the eval completes when none are missing
|
|
490
|
+
*
|
|
491
|
+
* `POST /v1/evals/{id}/scores`
|
|
492
|
+
*/
|
|
493
|
+
async postEvalScores(id, body, options) {
|
|
494
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/evals/${encodePathParam(id, "id")}/scores`, json: convertKeys(CODEC, "PostEvalScoresRequest", body, "encode"), idempotent: true }, options);
|
|
495
|
+
return convertKeys(CODEC, "PostEvalScoresResponse", data, "decode");
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Release an exportable checkpoint as a named, versioned artifact (promoting it again under the same name returns that release)
|
|
499
|
+
*
|
|
500
|
+
* `POST /v1/checkpoints/{id}/promote`
|
|
501
|
+
*/
|
|
502
|
+
async promoteCheckpoint(id, body, options) {
|
|
503
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/checkpoints/${encodePathParam(id, "id")}/promote`, json: body, idempotent: true }, options);
|
|
504
|
+
return convertKeys(CODEC, "Artifact", data, "decode");
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Append records as a new dataset version (creates the dataset if needed)
|
|
508
|
+
*
|
|
509
|
+
* `POST /v1/datasets/{name}/records`
|
|
510
|
+
*/
|
|
511
|
+
async pushDatasetRecords(name, body, options) {
|
|
512
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets/${encodePathParam(name, "name")}/records`, json: convertKeys(CODEC, "PushDatasetRequest", body, "encode"), idempotent: true }, options);
|
|
513
|
+
return convertKeys(CODEC, "Dataset", data, "decode");
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Record deduplicated outcome scores and gold corrections
|
|
517
|
+
*
|
|
518
|
+
* `POST /v1/feedback`
|
|
519
|
+
*/
|
|
520
|
+
async recordFeedback(body, options) {
|
|
521
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/feedback`, json: convertKeys(CODEC, "RecordFeedbackRequest", body, "encode"), idempotent: true }, options);
|
|
522
|
+
return convertKeys(CODEC, "RecordFeedbackResponse", data, "decode");
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Preview chat-template rendering and loss masks (estimated token counts)
|
|
526
|
+
*
|
|
527
|
+
* `POST /v1/datasets/{name}/render`
|
|
528
|
+
*/
|
|
529
|
+
async renderDataset(name, body, options) {
|
|
530
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets/${encodePathParam(name, "name")}/render`, json: convertKeys(CODEC, "RenderDatasetRequest", body, "encode"), idempotent: true }, options);
|
|
531
|
+
return convertKeys(CODEC, "RenderDatasetResponse", data, "decode");
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Resume a stopped, failed or cancelled run from its latest checkpoint
|
|
535
|
+
*
|
|
536
|
+
* `POST /v1/runs/{id}/resume`
|
|
537
|
+
*/
|
|
538
|
+
async resumeRun(id, body, options) {
|
|
539
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/runs/${encodePathParam(id, "id")}/resume`, json: convertKeys(CODEC, "ResumeRunRequest", body, "encode"), idempotent: true }, options);
|
|
540
|
+
return convertKeys(CODEC, "Run", data, "decode");
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Revoke a workspace API key
|
|
544
|
+
*
|
|
545
|
+
* `DELETE /v1/keys/{id}`
|
|
546
|
+
*/
|
|
547
|
+
async revokeApiKey(id, options) {
|
|
548
|
+
const data = await this.transport.json({ method: "DELETE", path: `/v1/keys/${encodePathParam(id, "id")}` }, options);
|
|
549
|
+
return convertKeys(CODEC, "ApiKey", data, "decode");
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Roll a deployment back to its previous artifact
|
|
553
|
+
*
|
|
554
|
+
* `POST /v1/deployments/{name}/rollback`
|
|
555
|
+
*/
|
|
556
|
+
async rollbackDeployment(name, options) {
|
|
557
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/deployments/${encodePathParam(name, "name")}/rollback`, idempotent: true }, options);
|
|
558
|
+
return convertKeys(CODEC, "Deployment", data, "decode");
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Ask a deployed model router which model to call
|
|
562
|
+
*
|
|
563
|
+
* `POST /v1/route`
|
|
564
|
+
*/
|
|
565
|
+
async routeRequest(body, options) {
|
|
566
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/route`, json: convertKeys(CODEC, "RouteRequest", body, "encode"), idempotent: true }, options);
|
|
567
|
+
return convertKeys(CODEC, "RouteResponse", data, "decode");
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Score a dataset's records with a rubric (async; the scores become the next version)
|
|
571
|
+
*
|
|
572
|
+
* `POST /v1/datasets/{name}/score`
|
|
573
|
+
*/
|
|
574
|
+
async scoreDataset(name, body, options) {
|
|
575
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/datasets/${encodePathParam(name, "name")}/score`, json: body, idempotent: true }, options);
|
|
576
|
+
return convertKeys(CODEC, "EvalRun", data, "decode");
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Create or replace a workspace secret (the value is write-only)
|
|
580
|
+
*
|
|
581
|
+
* `POST /v1/secrets`
|
|
582
|
+
*/
|
|
583
|
+
async setSecret(body, options) {
|
|
584
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/secrets`, json: convertKeys(CODEC, "SetSecretRequest", body, "encode"), idempotent: true }, options);
|
|
585
|
+
return convertKeys(CODEC, "Secret", data, "decode");
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Sync now: queue an import of new traces and scores (returns the running one if a sync is in progress)
|
|
589
|
+
*
|
|
590
|
+
* `POST /v1/sources/{id}/sync`
|
|
591
|
+
*/
|
|
592
|
+
async syncSource(id, body, options) {
|
|
593
|
+
const data = await this.transport.json({ method: "POST", path: `/v1/sources/${encodePathParam(id, "id")}/sync`, json: body, idempotent: true }, options);
|
|
594
|
+
return convertKeys(CODEC, "ImportJob", data, "decode");
|
|
595
|
+
}
|
|
596
|
+
}
|