@naturali/sdk 0.67.0 → 0.69.0

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/dist/index.mjs CHANGED
@@ -1658,6 +1658,282 @@ var Conversations = class {
1658
1658
  });
1659
1659
  }
1660
1660
  };
1661
+ var Evaluations = class {
1662
+ /**
1663
+ * List datasets
1664
+ *
1665
+ * Returns the datasets defined in a project
1666
+ */
1667
+ static listDatasets(options) {
1668
+ return (options.client ?? client).get({
1669
+ url: "/v1/projects/{project_id}/datasets",
1670
+ ...options
1671
+ });
1672
+ }
1673
+ /**
1674
+ * Create a dataset
1675
+ *
1676
+ * Creates a project-scoped dataset — a named collection of test cases an eval runs an agent against. Names are unique per project.
1677
+ *
1678
+ * Datasets are operator-owned **fixtures**. The platform's content purge never deletes or mutates a dataset item, so erasing a generation cannot silently stop a test suite from being runnable.
1679
+ */
1680
+ static createDataset(options) {
1681
+ return (options.client ?? client).post({
1682
+ url: "/v1/projects/{project_id}/datasets",
1683
+ ...options,
1684
+ headers: {
1685
+ "Content-Type": "application/json",
1686
+ ...options.headers
1687
+ }
1688
+ });
1689
+ }
1690
+ /**
1691
+ * Delete a dataset
1692
+ *
1693
+ * Deletes a dataset, its items, and every eval bound to it. Results of runs that already scored those items keep their frozen copies of the input and expected output.
1694
+ */
1695
+ static deleteDataset(options) {
1696
+ return (options.client ?? client).delete({
1697
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}",
1698
+ ...options
1699
+ });
1700
+ }
1701
+ /**
1702
+ * Get a dataset
1703
+ *
1704
+ * Returns a specific dataset
1705
+ */
1706
+ static getDataset(options) {
1707
+ return (options.client ?? client).get({
1708
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}",
1709
+ ...options
1710
+ });
1711
+ }
1712
+ /**
1713
+ * Update a dataset
1714
+ *
1715
+ * Updates a dataset's name and/or description
1716
+ */
1717
+ static updateDataset(options) {
1718
+ return (options.client ?? client).put({
1719
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}",
1720
+ ...options,
1721
+ headers: {
1722
+ "Content-Type": "application/json",
1723
+ ...options.headers
1724
+ }
1725
+ });
1726
+ }
1727
+ /**
1728
+ * List dataset items
1729
+ *
1730
+ * Returns the test cases in a dataset, oldest first
1731
+ */
1732
+ static listDatasetItems(options) {
1733
+ return (options.client ?? client).get({
1734
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}/items",
1735
+ ...options
1736
+ });
1737
+ }
1738
+ /**
1739
+ * Add a dataset item
1740
+ *
1741
+ * Adds one test case. `input` is replayed verbatim as the generation's messages, so it must be a non-empty array of `{ role, content }`.
1742
+ */
1743
+ static createDatasetItem(options) {
1744
+ return (options.client ?? client).post({
1745
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}/items",
1746
+ ...options,
1747
+ headers: {
1748
+ "Content-Type": "application/json",
1749
+ ...options.headers
1750
+ }
1751
+ });
1752
+ }
1753
+ /**
1754
+ * Curate a dataset item from a generation
1755
+ *
1756
+ * Promotes a real, completed generation into a test case: its input messages become the item's `input`, and its own answer becomes `expected_output` unless you supply one. Use it to build an evaluation set out of production traffic rather than hand-authoring fixtures.
1757
+ *
1758
+ * The item is a **copy**, not a view. It keeps working after the source generation's content is purged, and `source_generation_id` goes null if that generation is deleted — a purge can never quietly stop a suite from being runnable.
1759
+ *
1760
+ * Requires both `evaluations:CreateDataset` and `generations:GetGeneration`: the call copies content out of a generation, so a principal that may not read that generation may not curate it either.
1761
+ *
1762
+ * Only a **completed** generation can be promoted (`409 GENERATION_NOT_COMPLETED`), and only while its content is still available: an agent or project running with `trace_content_mode: none` never stored the input, and a purged or expired generation no longer has it (`409 GENERATION_CONTENT_UNAVAILABLE`). Generations that predate input recording answer the same way.
1763
+ */
1764
+ static createDatasetItemFromGeneration(options) {
1765
+ return (options.client ?? client).post({
1766
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/from-generation",
1767
+ ...options,
1768
+ headers: {
1769
+ "Content-Type": "application/json",
1770
+ ...options.headers
1771
+ }
1772
+ });
1773
+ }
1774
+ /**
1775
+ * Delete a dataset item
1776
+ *
1777
+ * Deletes a test case. Results of runs that already scored it stay readable; their `dataset_item_id` becomes null.
1778
+ */
1779
+ static deleteDatasetItem(options) {
1780
+ return (options.client ?? client).delete({
1781
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/{item_id}",
1782
+ ...options
1783
+ });
1784
+ }
1785
+ /**
1786
+ * Update a dataset item
1787
+ *
1788
+ * Updates a test case. Runs that already scored it are unaffected — each result carries its own frozen copy of the input and expected output.
1789
+ */
1790
+ static updateDatasetItem(options) {
1791
+ return (options.client ?? client).put({
1792
+ url: "/v1/projects/{project_id}/datasets/{dataset_id}/items/{item_id}",
1793
+ ...options,
1794
+ headers: {
1795
+ "Content-Type": "application/json",
1796
+ ...options.headers
1797
+ }
1798
+ });
1799
+ }
1800
+ /**
1801
+ * List evals
1802
+ *
1803
+ * Returns the evals defined in a project
1804
+ */
1805
+ static listEvals(options) {
1806
+ return (options.client ?? client).get({
1807
+ url: "/v1/projects/{project_id}/evals",
1808
+ ...options
1809
+ });
1810
+ }
1811
+ /**
1812
+ * Create an eval
1813
+ *
1814
+ * Binds an agent under test to a dataset and a list of scorers. The agent and the dataset must belong to the same project as the eval; a cross-project reference is rejected with 400.
1815
+ *
1816
+ * Scorer config is frozen here rather than read from the agent at run time, so two runs of the same eval are always judged by the same criteria and their comparison measures the agent instead of the config drifting underneath it. Each scorer `type` may appear at most once.
1817
+ */
1818
+ static createEval(options) {
1819
+ return (options.client ?? client).post({
1820
+ url: "/v1/projects/{project_id}/evals",
1821
+ ...options,
1822
+ headers: {
1823
+ "Content-Type": "application/json",
1824
+ ...options.headers
1825
+ }
1826
+ });
1827
+ }
1828
+ /**
1829
+ * Delete an eval
1830
+ *
1831
+ * Deletes an eval, its runs, and their results
1832
+ */
1833
+ static deleteEval(options) {
1834
+ return (options.client ?? client).delete({
1835
+ url: "/v1/projects/{project_id}/evals/{eval_id}",
1836
+ ...options
1837
+ });
1838
+ }
1839
+ /**
1840
+ * Get an eval
1841
+ *
1842
+ * Returns a specific eval
1843
+ */
1844
+ static getEval(options) {
1845
+ return (options.client ?? client).get({
1846
+ url: "/v1/projects/{project_id}/evals/{eval_id}",
1847
+ ...options
1848
+ });
1849
+ }
1850
+ /**
1851
+ * Update an eval
1852
+ *
1853
+ * Updates an eval. Changing `agent_id` re-validates the scorers against the new agent, since an `output_schema` scorer that was legal against the old one may not be.
1854
+ */
1855
+ static updateEval(options) {
1856
+ return (options.client ?? client).put({
1857
+ url: "/v1/projects/{project_id}/evals/{eval_id}",
1858
+ ...options,
1859
+ headers: {
1860
+ "Content-Type": "application/json",
1861
+ ...options.headers
1862
+ }
1863
+ });
1864
+ }
1865
+ /**
1866
+ * List eval runs
1867
+ *
1868
+ * Returns an eval's runs, newest first
1869
+ */
1870
+ static listEvalRuns(options) {
1871
+ return (options.client ?? client).get({
1872
+ url: "/v1/projects/{project_id}/evals/{eval_id}/runs",
1873
+ ...options
1874
+ });
1875
+ }
1876
+ /**
1877
+ * Start an eval run
1878
+ *
1879
+ * Runs the eval against its dataset, creating one real agent generation per item and scoring the outputs.
1880
+ *
1881
+ * `wait: true` executes the run synchronously and returns it terminal, with its scores. The dataset is capped at 25 items for a synchronous run; a larger one is rejected with 400 rather than partially scored.
1882
+ *
1883
+ * `wait: false` (the default) enqueues one task per item and returns immediately with `status: "queued"`. A worker executes the items and the run settles itself; poll `GET /evals/{eval_id}/runs/{eval_run_id}` for the terminal status. There is no item cap on a queued run.
1884
+ *
1885
+ * The whole run is pinned to **one** agent version, stamped on `agent_version`: pass one explicitly to evaluate a canary before promoting it, or omit it to use the active release's stable version (or the live draft when no release is in effect). Without the pin, release assignment would bucket each item independently and blend two configs into a single score.
1886
+ *
1887
+ * With `baseline_run_id`, the finished run's `aggregate_scores.baseline` carries per-scorer deltas against that run, computed over the items present and scorable in **both** runs, with the divergence counted. A delta over a shifted dataset is therefore never presented as a clean comparison.
1888
+ */
1889
+ static startEvalRun(options) {
1890
+ return (options.client ?? client).post({
1891
+ url: "/v1/projects/{project_id}/evals/{eval_id}/runs",
1892
+ ...options,
1893
+ headers: {
1894
+ "Content-Type": "application/json",
1895
+ ...options.headers
1896
+ }
1897
+ });
1898
+ }
1899
+ /**
1900
+ * Get an eval run
1901
+ *
1902
+ * Returns a run's status, counts, and aggregate scores
1903
+ */
1904
+ static getEvalRun(options) {
1905
+ return (options.client ?? client).get({
1906
+ url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}",
1907
+ ...options
1908
+ });
1909
+ }
1910
+ /**
1911
+ * List eval run results
1912
+ *
1913
+ * Returns the per-item results of a run, oldest first
1914
+ */
1915
+ static listEvalResults(options) {
1916
+ return (options.client ?? client).get({
1917
+ url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}/results",
1918
+ ...options
1919
+ });
1920
+ }
1921
+ /**
1922
+ * Cancel an eval run
1923
+ *
1924
+ * Cancels a queued or running run: its outstanding item tasks are dropped so it stops consuming provider budget, and the run settles as `canceled`.
1925
+ *
1926
+ * Results already written are kept — they are real measurements of generations that were really paid for — and `completed_count` / `errored_count` report what ran. `aggregate_scores` is deliberately left null: a partial roll-up in the same field a completed run uses would read as a whole-dataset verdict.
1927
+ *
1928
+ * A run that has already finished is rejected with 400.
1929
+ */
1930
+ static cancelEvalRun(options) {
1931
+ return (options.client ?? client).post({
1932
+ url: "/v1/projects/{project_id}/evals/{eval_id}/runs/{eval_run_id}/cancel",
1933
+ ...options
1934
+ });
1935
+ }
1936
+ };
1661
1937
  var Generations = class {
1662
1938
  /**
1663
1939
  * List generations
@@ -1799,6 +2075,45 @@ var ModelRoutes = class {
1799
2075
  });
1800
2076
  }
1801
2077
  };
2078
+ var Models = class {
2079
+ /**
2080
+ * List models
2081
+ *
2082
+ * Lists catalog models, sorted by id. Filter by vendor, provider, input/output modality, status, or `managed` — the last being the axis that decides whether a model is usable without bringing your own provider credentials, so `?managed=true&status=available` is the set a project can enable today.
2083
+ *
2084
+ */
2085
+ static listModels(options) {
2086
+ return (options?.client ?? client).get({
2087
+ url: "/v1/models",
2088
+ ...options
2089
+ });
2090
+ }
2091
+ /**
2092
+ * Get a model
2093
+ */
2094
+ static getModel(options) {
2095
+ return (options.client ?? client).get({
2096
+ url: "/v1/models/{model_id}",
2097
+ ...options
2098
+ });
2099
+ }
2100
+ /**
2101
+ * Enable a naturali-managed model
2102
+ *
2103
+ * Provisions a managed provider running this model in the project. The provider needs no credentials of yours — it runs on naturali's own model access — and is priced from the catalog the moment it is created, so its usage is metered from the first generation. The created resource is an ordinary provider: read, update and delete it through [`GET /v1/projects/{project_id}/ai-providers/{ai_provider_id}`](/docs/api/ai-providers/get-ai-provider) like any other. Requires the `admin` role in the project. Only models with `managed: true` can be enabled; anything else is a 400.
2104
+ *
2105
+ */
2106
+ static enableManagedModel(options) {
2107
+ return (options.client ?? client).post({
2108
+ url: "/v1/projects/{project_id}/models/{model_id}/providers",
2109
+ ...options,
2110
+ headers: {
2111
+ "Content-Type": "application/json",
2112
+ ...options.headers
2113
+ }
2114
+ });
2115
+ }
2116
+ };
1802
2117
  var Projects = class {
1803
2118
  /**
1804
2119
  * List projects
@@ -2235,6 +2550,58 @@ var Tools = class {
2235
2550
  });
2236
2551
  }
2237
2552
  };
2553
+ var Traces = class {
2554
+ /**
2555
+ * List traces
2556
+ *
2557
+ * Returns a paginated list of execution traces for the project.
2558
+ */
2559
+ static listTraces(options) {
2560
+ return (options.client ?? client).get({
2561
+ url: "/v1/projects/{project_id}/traces",
2562
+ ...options
2563
+ });
2564
+ }
2565
+ /**
2566
+ * Get a trace
2567
+ *
2568
+ * Returns a single trace by ID.
2569
+ */
2570
+ static getTrace(options) {
2571
+ return (options.client ?? client).get({
2572
+ url: "/v1/projects/{project_id}/traces/{trace_id}",
2573
+ ...options
2574
+ });
2575
+ }
2576
+ /**
2577
+ * Get trace tree
2578
+ *
2579
+ * Returns the full execution tree rooted at the given trace (or its root if the given trace is a child). Each node represents one agent's execution session. The `children` array contains traces triggered by sub-agent tool calls from that trace.
2580
+ *
2581
+ */
2582
+ static getTraceTree(options) {
2583
+ return (options.client ?? client).get({
2584
+ url: "/v1/projects/{project_id}/traces/{trace_id}/tree",
2585
+ ...options
2586
+ });
2587
+ }
2588
+ /**
2589
+ * Purge trace content
2590
+ *
2591
+ * Deletes the trace's steps object from storage and clears its content columns (`file_id`, `error`), cascading to every descendant trace and to all of their generations. A descendant holds its own steps object covering the same run, so the cascade is what makes the erasure complete rather than merely partial.
2592
+ *
2593
+ * The rows survive as auditable skeletons with `content_redacted_at` set — ids, timestamps, step counts, and the generations' usage-attribution fields are preserved, because the billing and audit ledger must outlive a tenant's erasure of the content. A purged trace therefore reads back as a skeleton, not a 404: a 404 would prove nothing.
2594
+ *
2595
+ * Idempotent — purging an already-purged trace succeeds and leaves the original `content_redacted_at` in place.
2596
+ *
2597
+ */
2598
+ static purgeTraceContent(options) {
2599
+ return (options.client ?? client).delete({
2600
+ url: "/v1/projects/{project_id}/traces/{trace_id}/content",
2601
+ ...options
2602
+ });
2603
+ }
2604
+ };
2238
2605
  var Users = class {
2239
2606
  /**
2240
2607
  * Get the current user
@@ -2440,12 +2807,15 @@ var NaturaliClient = class {
2440
2807
  channels;
2441
2808
  auth;
2442
2809
  conversations;
2810
+ evaluations;
2443
2811
  generations;
2444
2812
  modelRoutes;
2813
+ models;
2445
2814
  projects;
2446
2815
  secrets;
2447
2816
  sessions;
2448
2817
  tools;
2818
+ traces;
2449
2819
  users;
2450
2820
  webhooks;
2451
2821
  /** The underlying HTTP client, for interceptors or one-off requests. */
@@ -2467,15 +2837,18 @@ var NaturaliClient = class {
2467
2837
  this.channels = bindResource(Channels, this.http);
2468
2838
  this.auth = bindResource(Auth, this.http);
2469
2839
  this.conversations = bindResource(Conversations, this.http);
2840
+ this.evaluations = bindResource(Evaluations, this.http);
2470
2841
  this.generations = bindResource(Generations, this.http);
2471
2842
  this.modelRoutes = bindResource(ModelRoutes, this.http);
2843
+ this.models = bindResource(Models, this.http);
2472
2844
  this.projects = bindResource(Projects, this.http);
2473
2845
  this.secrets = bindResource(Secrets, this.http);
2474
2846
  this.sessions = bindResource(Sessions, this.http);
2475
2847
  this.tools = bindResource(Tools, this.http);
2848
+ this.traces = bindResource(Traces, this.http);
2476
2849
  this.users = bindResource(Users, this.http);
2477
2850
  this.webhooks = bindResource(Webhooks, this.http);
2478
2851
  }
2479
2852
  };
2480
2853
  //#endregion
2481
- export { Actors, AgentVersions, Agents, AiProviders, ApiKeys, Assistant, Auth, Channels, Conversations, Generations, ModelRoutes, NaturaliClient, Projects, Secrets, Sessions, Tools, Users, Webhooks, createClient, createConfig };
2854
+ export { Actors, AgentVersions, Agents, AiProviders, ApiKeys, Assistant, Auth, Channels, Conversations, Evaluations, Generations, ModelRoutes, Models, NaturaliClient, Projects, Secrets, Sessions, Tools, Traces, Users, Webhooks, createClient, createConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.67.0",
3
+ "version": "0.69.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "tsx": "^4.23.1",
38
38
  "typescript": "~6.0.3",
39
39
  "vitest": "^4.1.10",
40
- "@naturali/api": "0.67.0"
40
+ "@naturali/api": "0.69.0"
41
41
  },
42
42
  "scripts": {
43
43
  "generate": "tsx scripts/generate.ts",