langwatch 1.8.0 → 1.9.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.
Files changed (28) hide show
  1. package/dist/{chunk-W6NUS5XK.mjs → chunk-4XQHESU7.mjs} +2 -2
  2. package/dist/{chunk-W6NUS5XK.mjs.map → chunk-4XQHESU7.mjs.map} +1 -1
  3. package/dist/{chunk-YEKLDVGO.mjs → chunk-A52LX4C4.mjs} +2 -2
  4. package/dist/{chunk-KS7O6FTO.js → chunk-HUMHSRVP.js} +12 -12
  5. package/dist/{chunk-KS7O6FTO.js.map → chunk-HUMHSRVP.js.map} +1 -1
  6. package/dist/{chunk-FJ6JSLLE.js → chunk-NFFB3DWW.js} +2 -2
  7. package/dist/{chunk-FJ6JSLLE.js.map → chunk-NFFB3DWW.js.map} +1 -1
  8. package/dist/cli/bundle.js +346 -240
  9. package/dist/{implementation-Di0CB66C.d.ts → implementation-BvwOB77X.d.ts} +1 -1
  10. package/dist/{implementation-CMvLlYDH.d.mts → implementation-C1F0eCHp.d.mts} +1 -1
  11. package/dist/index.d.mts +24 -3
  12. package/dist/index.d.ts +24 -3
  13. package/dist/index.js +171 -40
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +140 -9
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/observability-sdk/index.d.mts +3 -3
  18. package/dist/observability-sdk/index.d.ts +3 -3
  19. package/dist/observability-sdk/index.js +2 -2
  20. package/dist/observability-sdk/index.mjs +1 -1
  21. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  22. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  23. package/dist/observability-sdk/setup/node/index.js +3 -3
  24. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  25. package/dist/{types-DQqmFCDl.d.mts → types-C3NpCWi_.d.mts} +1333 -425
  26. package/dist/{types-Cg_frfBV.d.ts → types-jx13nj4M.d.ts} +1333 -425
  27. package/package.json +1 -1
  28. /package/dist/{chunk-YEKLDVGO.mjs.map → chunk-A52LX4C4.mjs.map} +0 -0
@@ -1194,6 +1194,30 @@ interface paths {
1194
1194
  patch: operations["patchApiV1ProjectsByProjectIdAnalyticsChartsByChartId"];
1195
1195
  trace?: never;
1196
1196
  };
1197
+ "/api/v1/projects/{projectId}/analytics/charts/{chartId}/placement": {
1198
+ parameters: {
1199
+ query?: never;
1200
+ header?: never;
1201
+ path?: never;
1202
+ cookie?: never;
1203
+ };
1204
+ get?: never;
1205
+ /**
1206
+ * Place a saved workbench chart on a dashboard
1207
+ * @description Places one saved LangWatchQL chart on a dashboard in the same project, at the grid position supplied — or, when no grid row is given, at the next row free on that dashboard, counting charts of every kind. A dashboard that is not in this project is reported as not found, exactly like a chart that is not, and nothing is written.
1208
+ */
1209
+ put: operations["putApiV1ProjectsByProjectIdAnalyticsChartsByChartIdPlacement"];
1210
+ post?: never;
1211
+ /**
1212
+ * Remove a saved workbench chart from its dashboard
1213
+ * @description Removes one saved LangWatchQL chart from whatever dashboard it is on, clearing its grid position along with the dashboard id. Idempotent: unplacing a chart that is not placed answers 204 all the same. The chart itself — its statement, parameter values and specification — is untouched.
1214
+ */
1215
+ delete: operations["deleteApiV1ProjectsByProjectIdAnalyticsChartsByChartIdPlacement"];
1216
+ options?: never;
1217
+ head?: never;
1218
+ patch?: never;
1219
+ trace?: never;
1220
+ };
1197
1221
  "/api/coding-agent/sessions/{sessionId}/events": {
1198
1222
  parameters: {
1199
1223
  query?: never;
@@ -1580,7 +1604,11 @@ interface paths {
1580
1604
  */
1581
1605
  get: operations["getApiExperiments"];
1582
1606
  put?: never;
1583
- post?: never;
1607
+ /**
1608
+ * Create an experiment and its setup
1609
+ * @description Create an evaluations experiment. Send a setup to start from, or send none and get a blank workbench with one inline dataset. The slug it answers with is what every other experiment endpoint takes.
1610
+ */
1611
+ post: operations["postApiExperiments"];
1584
1612
  delete?: never;
1585
1613
  options?: never;
1586
1614
  head?: never;
@@ -1787,6 +1815,70 @@ interface paths {
1787
1815
  patch?: never;
1788
1816
  trace?: never;
1789
1817
  };
1818
+ "/api/experiments/{slug}/workbench-state": {
1819
+ parameters: {
1820
+ query?: never;
1821
+ header?: never;
1822
+ path?: never;
1823
+ cookie?: never;
1824
+ };
1825
+ /**
1826
+ * Read an experiment's setup
1827
+ * @description The experiment's datasets, targets and evaluators, with the version to send back when you save. Ask for `fields=version` to check for changes without transferring the setup.
1828
+ */
1829
+ get: operations["getApiExperimentsBySlugWorkbenchState"];
1830
+ /**
1831
+ * Save an experiment's setup
1832
+ * @description Replace the experiment's setup. Send `expectedVersion` with the version you read and the save is refused with a 409 when someone else wrote first, instead of overwriting their work.
1833
+ */
1834
+ put: operations["putApiExperimentsBySlugWorkbenchState"];
1835
+ post?: never;
1836
+ delete?: never;
1837
+ options?: never;
1838
+ head?: never;
1839
+ patch?: never;
1840
+ trace?: never;
1841
+ };
1842
+ "/api/experiments/{slug}/versions": {
1843
+ parameters: {
1844
+ query?: never;
1845
+ header?: never;
1846
+ path?: never;
1847
+ cookie?: never;
1848
+ };
1849
+ /**
1850
+ * List an experiment's versions
1851
+ * @description Every saved version of the experiment's setup, newest first. Page through them with `limit` and `cursor`.
1852
+ */
1853
+ get: operations["getApiExperimentsBySlugVersions"];
1854
+ put?: never;
1855
+ post?: never;
1856
+ delete?: never;
1857
+ options?: never;
1858
+ head?: never;
1859
+ patch?: never;
1860
+ trace?: never;
1861
+ };
1862
+ "/api/experiments/{slug}/versions/{version}/restore": {
1863
+ parameters: {
1864
+ query?: never;
1865
+ header?: never;
1866
+ path?: never;
1867
+ cookie?: never;
1868
+ };
1869
+ get?: never;
1870
+ put?: never;
1871
+ /**
1872
+ * Restore an experiment version
1873
+ * @description Bring an old setup back by writing it forward as a new save. History is never rewritten: the version you restored from stays in the list, and the restore is one more entry after it.
1874
+ */
1875
+ post: operations["postApiExperimentsBySlugVersionsByVersionRestore"];
1876
+ delete?: never;
1877
+ options?: never;
1878
+ head?: never;
1879
+ patch?: never;
1880
+ trace?: never;
1881
+ };
1790
1882
  "/api/analytics": {
1791
1883
  parameters: {
1792
1884
  query?: never;
@@ -5461,6 +5553,7 @@ interface operations {
5461
5553
  start: string | number;
5462
5554
  end: string | number;
5463
5555
  };
5556
+ granularitySeconds?: 1 | 60 | 3600;
5464
5557
  };
5465
5558
  };
5466
5559
  };
@@ -5487,6 +5580,9 @@ interface operations {
5487
5580
  };
5488
5581
  truncated: boolean;
5489
5582
  followsTimeWindow: boolean;
5583
+ followsGranularity: boolean;
5584
+ granularitySeconds?: number;
5585
+ coarsenedFromSeconds?: number;
5490
5586
  diagnostics: {
5491
5587
  /** @enum {string} */
5492
5588
  code: "RESULT_TRUNCATED" | "POSSIBLE_FANOUT" | "UNBOUNDED_TIME_RANGE" | "MISSING_TIME_BUCKETS" | "INCOMPLETE_COMPARISON_PERIOD";
@@ -5756,6 +5852,11 @@ interface operations {
5756
5852
  createdAt: string;
5757
5853
  updatedAt: string;
5758
5854
  platformUrl: string;
5855
+ dashboardId: string | null;
5856
+ gridColumn: number;
5857
+ gridRow: number;
5858
+ colSpan: number;
5859
+ rowSpan: number;
5759
5860
  }[];
5760
5861
  };
5761
5862
  };
@@ -5882,6 +5983,11 @@ interface operations {
5882
5983
  createdAt: string;
5883
5984
  updatedAt: string;
5884
5985
  platformUrl: string;
5986
+ dashboardId: string | null;
5987
+ gridColumn: number;
5988
+ gridRow: number;
5989
+ colSpan: number;
5990
+ rowSpan: number;
5885
5991
  };
5886
5992
  };
5887
5993
  };
@@ -6001,6 +6107,11 @@ interface operations {
6001
6107
  createdAt: string;
6002
6108
  updatedAt: string;
6003
6109
  platformUrl: string;
6110
+ dashboardId: string | null;
6111
+ gridColumn: number;
6112
+ gridRow: number;
6113
+ colSpan: number;
6114
+ rowSpan: number;
6004
6115
  };
6005
6116
  };
6006
6117
  };
@@ -6268,6 +6379,11 @@ interface operations {
6268
6379
  createdAt: string;
6269
6380
  updatedAt: string;
6270
6381
  platformUrl: string;
6382
+ dashboardId: string | null;
6383
+ gridColumn: number;
6384
+ gridRow: number;
6385
+ colSpan: number;
6386
+ rowSpan: number;
6271
6387
  };
6272
6388
  };
6273
6389
  };
@@ -6373,78 +6489,55 @@ interface operations {
6373
6489
  };
6374
6490
  };
6375
6491
  };
6376
- getApiCodingAgentSessionsBySessionIdEvents: {
6492
+ putApiV1ProjectsByProjectIdAnalyticsChartsByChartIdPlacement: {
6377
6493
  parameters: {
6378
- query?: {
6379
- /** @description Comma-separated event kinds to include. Known kinds: model_call, compaction, rate_limit, api_error, retries_exhausted, tool_result, tool_decision, user_prompt, subagent_completed. */
6380
- kinds?: string;
6381
- /** @description Opaque keyset cursor from the previous response's nextCursor. */
6382
- cursor?: string;
6383
- limit?: number;
6384
- /** @description Epoch ms lower bound on event time; with `to`, prunes storage partitions for faster reads. */
6385
- from?: number;
6386
- /** @description Epoch ms upper bound on event time. */
6387
- to?: number;
6388
- };
6494
+ query?: never;
6389
6495
  header?: never;
6390
6496
  path: {
6391
- /** @description The agent's own session id (session.id / conversation id). */
6392
- sessionId: string;
6497
+ projectId: string;
6498
+ chartId: string;
6393
6499
  };
6394
6500
  cookie?: never;
6395
6501
  };
6396
- requestBody?: never;
6502
+ requestBody: {
6503
+ content: {
6504
+ "application/json": {
6505
+ dashboardId: string;
6506
+ gridColumn?: number;
6507
+ gridRow?: number;
6508
+ colSpan?: number;
6509
+ rowSpan?: number;
6510
+ };
6511
+ };
6512
+ };
6397
6513
  responses: {
6398
- /** @description One page of session events plus the cursor for the next page */
6514
+ /** @description The chart, now placed */
6399
6515
  200: {
6400
6516
  headers: {
6401
6517
  [name: string]: unknown;
6402
6518
  };
6403
6519
  content: {
6404
6520
  "application/json": {
6405
- events: {
6406
- sessionId: string;
6407
- timeUnixMs: number;
6408
- recordId: string;
6409
- eventKind: string;
6410
- agent: string;
6411
- sessionKeySource: string;
6412
- traceId: string;
6413
- spanId: string;
6414
- promptId: string;
6415
- querySource: string;
6416
- agentType: string;
6417
- eventSequence: number;
6418
- requestId: string;
6419
- model: string;
6420
- inputTokens: number;
6421
- outputTokens: number;
6422
- cacheReadTokens: number;
6423
- cacheCreationTokens: number;
6424
- costUsd: number;
6425
- durationMs: number;
6426
- ttftMs: number;
6427
- attempt: number;
6428
- speed: string;
6429
- stopReason: string;
6430
- preTokens: number;
6431
- postTokens: number;
6432
- compactionTrigger: string;
6433
- precomputeReuse: string;
6434
- statusCode: string;
6435
- errorType: string;
6436
- rateLimitCarrier: string;
6437
- retryDurationMs: number;
6438
- toolName: string;
6439
- success: string;
6440
- decision: string;
6441
- decisionSource: string;
6442
- toolInputBytes: number;
6443
- toolResultBytes: number;
6444
- promptChars: number;
6445
- totalTokens: number;
6446
- }[];
6447
- nextCursor: string | null;
6521
+ id: string;
6522
+ name: string;
6523
+ definition: {
6524
+ version: number;
6525
+ sql: string;
6526
+ parameters: {
6527
+ [key: string]: unknown;
6528
+ };
6529
+ vegaLiteSpec?: {
6530
+ [key: string]: unknown;
6531
+ };
6532
+ };
6533
+ createdAt: string;
6534
+ updatedAt: string;
6535
+ platformUrl: string;
6536
+ dashboardId: string | null;
6537
+ gridColumn: number;
6538
+ gridRow: number;
6539
+ colSpan: number;
6540
+ rowSpan: number;
6448
6541
  };
6449
6542
  };
6450
6543
  };
@@ -6455,8 +6548,16 @@ interface operations {
6455
6548
  };
6456
6549
  content: {
6457
6550
  "application/json": {
6458
- error: string;
6459
- message?: string;
6551
+ error: {
6552
+ type: string;
6553
+ code: string;
6554
+ message: string;
6555
+ meta?: {
6556
+ [key: string]: unknown;
6557
+ };
6558
+ trace_id?: string;
6559
+ span_id?: string;
6560
+ };
6460
6561
  };
6461
6562
  };
6462
6563
  };
@@ -6467,110 +6568,274 @@ interface operations {
6467
6568
  };
6468
6569
  content: {
6469
6570
  "application/json": {
6470
- error: string;
6471
- message?: string;
6571
+ error: {
6572
+ type: string;
6573
+ code: string;
6574
+ message: string;
6575
+ meta?: {
6576
+ [key: string]: unknown;
6577
+ };
6578
+ trace_id?: string;
6579
+ span_id?: string;
6580
+ };
6472
6581
  };
6473
6582
  };
6474
6583
  };
6475
- /** @description Unprocessable Entity */
6476
- 422: {
6584
+ /** @description Forbidden */
6585
+ 403: {
6477
6586
  headers: {
6478
6587
  [name: string]: unknown;
6479
6588
  };
6480
6589
  content: {
6481
6590
  "application/json": {
6482
- error: string;
6483
- message?: string;
6591
+ error: {
6592
+ type: string;
6593
+ code: string;
6594
+ message: string;
6595
+ meta?: {
6596
+ [key: string]: unknown;
6597
+ };
6598
+ trace_id?: string;
6599
+ span_id?: string;
6600
+ };
6484
6601
  };
6485
6602
  };
6486
6603
  };
6487
- /** @description Internal Server Error */
6488
- 500: {
6604
+ /** @description No chart with this id in this project */
6605
+ 404: {
6489
6606
  headers: {
6490
6607
  [name: string]: unknown;
6491
6608
  };
6492
6609
  content: {
6493
6610
  "application/json": {
6494
- error: string;
6495
- message?: string;
6611
+ error: {
6612
+ type: string;
6613
+ code: string;
6614
+ message: string;
6615
+ meta?: {
6616
+ [key: string]: unknown;
6617
+ };
6618
+ trace_id?: string;
6619
+ span_id?: string;
6620
+ };
6496
6621
  };
6497
6622
  };
6498
6623
  };
6499
- };
6500
- };
6501
- getApiCodingAgentPullRequestUsage: {
6502
- parameters: {
6503
- query: {
6504
- /** @description The repository as "owner/name". */
6505
- repository: string;
6506
- /** @description The pull request number. */
6507
- pullRequest: number;
6508
- host?: string;
6509
- };
6510
- header?: never;
6511
- path?: never;
6512
- cookie?: never;
6513
- };
6514
- requestBody?: never;
6515
- responses: {
6516
- /** @description The pull request's usage rollup */
6517
- 200: {
6624
+ /** @description Internal Server Error */
6625
+ 500: {
6518
6626
  headers: {
6519
6627
  [name: string]: unknown;
6520
6628
  };
6521
6629
  content: {
6522
6630
  "application/json": {
6523
- pullRequest: {
6524
- repositoryHost: string;
6525
- repositoryFullName: string;
6526
- prNumber: number;
6527
- headBranch: string;
6528
- htmlUrl: string;
6529
- state: string;
6530
- isDraft: boolean;
6531
- authorLogin: string | null;
6532
- prCreatedAtMs: number;
6533
- prClosedAtMs: number | null;
6534
- prMergedAtMs: number | null;
6631
+ error: {
6632
+ type: string;
6633
+ code: string;
6634
+ message: string;
6635
+ meta?: {
6636
+ [key: string]: unknown;
6637
+ };
6638
+ trace_id?: string;
6639
+ span_id?: string;
6535
6640
  };
6536
- rows: {
6537
- projectId: string;
6538
- projectSlug: string;
6539
- contributorLabel: string;
6540
- contributorIsProject: boolean;
6541
- agent: string;
6542
- models: string[];
6543
- sessionsCount: number;
6544
- inputTokens: number;
6545
- outputTokens: number;
6546
- cacheReadTokens: number;
6547
- cacheCreationTokens: number;
6548
- totalTokens: number;
6549
- costUsd: number | null;
6550
- billedCostUsd: number | null;
6551
- nonBilledCostUsd: number | null;
6552
- }[];
6553
- totals: {
6554
- sessionsCount: number;
6555
- inputTokens: number;
6556
- outputTokens: number;
6557
- cacheReadTokens: number;
6558
- cacheCreationTokens: number;
6559
- totalTokens: number;
6560
- costUsd: number | null;
6561
- billedCostUsd: number | null;
6562
- nonBilledCostUsd: number | null;
6641
+ };
6642
+ };
6643
+ };
6644
+ };
6645
+ };
6646
+ deleteApiV1ProjectsByProjectIdAnalyticsChartsByChartIdPlacement: {
6647
+ parameters: {
6648
+ query?: never;
6649
+ header?: never;
6650
+ path: {
6651
+ projectId: string;
6652
+ chartId: string;
6653
+ };
6654
+ cookie?: never;
6655
+ };
6656
+ requestBody?: never;
6657
+ responses: {
6658
+ /** @description The chart is no longer on any dashboard */
6659
+ 204: {
6660
+ headers: {
6661
+ [name: string]: unknown;
6662
+ };
6663
+ content?: never;
6664
+ };
6665
+ /** @description Bad Request */
6666
+ 400: {
6667
+ headers: {
6668
+ [name: string]: unknown;
6669
+ };
6670
+ content: {
6671
+ "application/json": {
6672
+ error: {
6673
+ type: string;
6674
+ code: string;
6675
+ message: string;
6676
+ meta?: {
6677
+ [key: string]: unknown;
6678
+ };
6679
+ trace_id?: string;
6680
+ span_id?: string;
6563
6681
  };
6564
- modelBreakdown: {
6682
+ };
6683
+ };
6684
+ };
6685
+ /** @description Unauthorized */
6686
+ 401: {
6687
+ headers: {
6688
+ [name: string]: unknown;
6689
+ };
6690
+ content: {
6691
+ "application/json": {
6692
+ error: {
6693
+ type: string;
6694
+ code: string;
6695
+ message: string;
6696
+ meta?: {
6697
+ [key: string]: unknown;
6698
+ };
6699
+ trace_id?: string;
6700
+ span_id?: string;
6701
+ };
6702
+ };
6703
+ };
6704
+ };
6705
+ /** @description Forbidden */
6706
+ 403: {
6707
+ headers: {
6708
+ [name: string]: unknown;
6709
+ };
6710
+ content: {
6711
+ "application/json": {
6712
+ error: {
6713
+ type: string;
6714
+ code: string;
6715
+ message: string;
6716
+ meta?: {
6717
+ [key: string]: unknown;
6718
+ };
6719
+ trace_id?: string;
6720
+ span_id?: string;
6721
+ };
6722
+ };
6723
+ };
6724
+ };
6725
+ /** @description No chart with this id in this project */
6726
+ 404: {
6727
+ headers: {
6728
+ [name: string]: unknown;
6729
+ };
6730
+ content: {
6731
+ "application/json": {
6732
+ error: {
6733
+ type: string;
6734
+ code: string;
6735
+ message: string;
6736
+ meta?: {
6737
+ [key: string]: unknown;
6738
+ };
6739
+ trace_id?: string;
6740
+ span_id?: string;
6741
+ };
6742
+ };
6743
+ };
6744
+ };
6745
+ /** @description Internal Server Error */
6746
+ 500: {
6747
+ headers: {
6748
+ [name: string]: unknown;
6749
+ };
6750
+ content: {
6751
+ "application/json": {
6752
+ error: {
6753
+ type: string;
6754
+ code: string;
6755
+ message: string;
6756
+ meta?: {
6757
+ [key: string]: unknown;
6758
+ };
6759
+ trace_id?: string;
6760
+ span_id?: string;
6761
+ };
6762
+ };
6763
+ };
6764
+ };
6765
+ };
6766
+ };
6767
+ getApiCodingAgentSessionsBySessionIdEvents: {
6768
+ parameters: {
6769
+ query?: {
6770
+ /** @description Comma-separated event kinds to include. Known kinds: model_call, compaction, rate_limit, api_error, retries_exhausted, tool_result, tool_decision, user_prompt, subagent_completed. */
6771
+ kinds?: string;
6772
+ /** @description Opaque keyset cursor from the previous response's nextCursor. */
6773
+ cursor?: string;
6774
+ limit?: number;
6775
+ /** @description Epoch ms lower bound on event time; with `to`, prunes storage partitions for faster reads. */
6776
+ from?: number;
6777
+ /** @description Epoch ms upper bound on event time. */
6778
+ to?: number;
6779
+ };
6780
+ header?: never;
6781
+ path: {
6782
+ /** @description The agent's own session id (session.id / conversation id). */
6783
+ sessionId: string;
6784
+ };
6785
+ cookie?: never;
6786
+ };
6787
+ requestBody?: never;
6788
+ responses: {
6789
+ /** @description One page of session events plus the cursor for the next page */
6790
+ 200: {
6791
+ headers: {
6792
+ [name: string]: unknown;
6793
+ };
6794
+ content: {
6795
+ "application/json": {
6796
+ events: {
6797
+ sessionId: string;
6798
+ timeUnixMs: number;
6799
+ recordId: string;
6800
+ eventKind: string;
6801
+ agent: string;
6802
+ sessionKeySource: string;
6803
+ traceId: string;
6804
+ spanId: string;
6805
+ promptId: string;
6806
+ querySource: string;
6807
+ agentType: string;
6808
+ eventSequence: number;
6809
+ requestId: string;
6565
6810
  model: string;
6566
6811
  inputTokens: number;
6567
6812
  outputTokens: number;
6568
6813
  cacheReadTokens: number;
6569
6814
  cacheCreationTokens: number;
6815
+ costUsd: number;
6816
+ durationMs: number;
6817
+ ttftMs: number;
6818
+ attempt: number;
6819
+ speed: string;
6820
+ stopReason: string;
6821
+ preTokens: number;
6822
+ postTokens: number;
6823
+ compactionTrigger: string;
6824
+ precomputeReuse: string;
6825
+ statusCode: string;
6826
+ errorType: string;
6827
+ rateLimitCarrier: string;
6828
+ retryDurationMs: number;
6829
+ toolName: string;
6830
+ success: string;
6831
+ decision: string;
6832
+ decisionSource: string;
6833
+ toolInputBytes: number;
6834
+ toolResultBytes: number;
6835
+ promptChars: number;
6570
6836
  totalTokens: number;
6571
- costUsd: number | null;
6572
- tokensKnown: boolean;
6573
6837
  }[];
6838
+ nextCursor: string | null;
6574
6839
  };
6575
6840
  };
6576
6841
  };
@@ -6624,24 +6889,150 @@ interface operations {
6624
6889
  };
6625
6890
  };
6626
6891
  };
6627
- getApiDashboards: {
6892
+ getApiCodingAgentPullRequestUsage: {
6628
6893
  parameters: {
6629
- query?: never;
6894
+ query: {
6895
+ /** @description The repository as "owner/name". */
6896
+ repository: string;
6897
+ /** @description The pull request number. */
6898
+ pullRequest: number;
6899
+ host?: string;
6900
+ };
6630
6901
  header?: never;
6631
6902
  path?: never;
6632
6903
  cookie?: never;
6633
6904
  };
6634
6905
  requestBody?: never;
6635
- responses: never;
6636
- };
6637
- postApiDashboards: {
6638
- parameters: {
6639
- query?: never;
6640
- header?: never;
6641
- path?: never;
6642
- cookie?: never;
6643
- };
6644
- requestBody: {
6906
+ responses: {
6907
+ /** @description The pull request's usage rollup */
6908
+ 200: {
6909
+ headers: {
6910
+ [name: string]: unknown;
6911
+ };
6912
+ content: {
6913
+ "application/json": {
6914
+ pullRequest: {
6915
+ repositoryHost: string;
6916
+ repositoryFullName: string;
6917
+ prNumber: number;
6918
+ headBranch: string;
6919
+ htmlUrl: string;
6920
+ state: string;
6921
+ isDraft: boolean;
6922
+ authorLogin: string | null;
6923
+ prCreatedAtMs: number;
6924
+ prClosedAtMs: number | null;
6925
+ prMergedAtMs: number | null;
6926
+ };
6927
+ rows: {
6928
+ projectId: string;
6929
+ projectSlug: string;
6930
+ contributorLabel: string;
6931
+ contributorIsProject: boolean;
6932
+ agent: string;
6933
+ models: string[];
6934
+ sessionsCount: number;
6935
+ inputTokens: number;
6936
+ outputTokens: number;
6937
+ cacheReadTokens: number;
6938
+ cacheCreationTokens: number;
6939
+ totalTokens: number;
6940
+ costUsd: number | null;
6941
+ billedCostUsd: number | null;
6942
+ nonBilledCostUsd: number | null;
6943
+ }[];
6944
+ totals: {
6945
+ sessionsCount: number;
6946
+ inputTokens: number;
6947
+ outputTokens: number;
6948
+ cacheReadTokens: number;
6949
+ cacheCreationTokens: number;
6950
+ totalTokens: number;
6951
+ costUsd: number | null;
6952
+ billedCostUsd: number | null;
6953
+ nonBilledCostUsd: number | null;
6954
+ };
6955
+ modelBreakdown: {
6956
+ model: string;
6957
+ inputTokens: number;
6958
+ outputTokens: number;
6959
+ cacheReadTokens: number;
6960
+ cacheCreationTokens: number;
6961
+ totalTokens: number;
6962
+ costUsd: number | null;
6963
+ tokensKnown: boolean;
6964
+ }[];
6965
+ };
6966
+ };
6967
+ };
6968
+ /** @description Bad Request */
6969
+ 400: {
6970
+ headers: {
6971
+ [name: string]: unknown;
6972
+ };
6973
+ content: {
6974
+ "application/json": {
6975
+ error: string;
6976
+ message?: string;
6977
+ };
6978
+ };
6979
+ };
6980
+ /** @description Unauthorized */
6981
+ 401: {
6982
+ headers: {
6983
+ [name: string]: unknown;
6984
+ };
6985
+ content: {
6986
+ "application/json": {
6987
+ error: string;
6988
+ message?: string;
6989
+ };
6990
+ };
6991
+ };
6992
+ /** @description Unprocessable Entity */
6993
+ 422: {
6994
+ headers: {
6995
+ [name: string]: unknown;
6996
+ };
6997
+ content: {
6998
+ "application/json": {
6999
+ error: string;
7000
+ message?: string;
7001
+ };
7002
+ };
7003
+ };
7004
+ /** @description Internal Server Error */
7005
+ 500: {
7006
+ headers: {
7007
+ [name: string]: unknown;
7008
+ };
7009
+ content: {
7010
+ "application/json": {
7011
+ error: string;
7012
+ message?: string;
7013
+ };
7014
+ };
7015
+ };
7016
+ };
7017
+ };
7018
+ getApiDashboards: {
7019
+ parameters: {
7020
+ query?: never;
7021
+ header?: never;
7022
+ path?: never;
7023
+ cookie?: never;
7024
+ };
7025
+ requestBody?: never;
7026
+ responses: never;
7027
+ };
7028
+ postApiDashboards: {
7029
+ parameters: {
7030
+ query?: never;
7031
+ header?: never;
7032
+ path?: never;
7033
+ cookie?: never;
7034
+ };
7035
+ requestBody: {
6645
7036
  content: {
6646
7037
  "application/json": {
6647
7038
  name: string;
@@ -7711,6 +8102,99 @@ interface operations {
7711
8102
  };
7712
8103
  };
7713
8104
  };
8105
+ postApiExperiments: {
8106
+ parameters: {
8107
+ query?: never;
8108
+ header?: never;
8109
+ path?: never;
8110
+ cookie?: never;
8111
+ };
8112
+ requestBody: {
8113
+ content: {
8114
+ "application/json": {
8115
+ /** @description Name for the experiment. A draft name is picked when omitted. */
8116
+ name?: string;
8117
+ /** @description Setup to start from. Omit for a blank workbench with one inline dataset. */
8118
+ state?: {
8119
+ [key: string]: unknown;
8120
+ };
8121
+ };
8122
+ };
8123
+ };
8124
+ responses: {
8125
+ /** @description Experiment created */
8126
+ 200: {
8127
+ headers: {
8128
+ [name: string]: unknown;
8129
+ };
8130
+ content: {
8131
+ "application/json": {
8132
+ /** @description Identifier of the created experiment */
8133
+ id: string;
8134
+ /** @description Slug to address the experiment by */
8135
+ slug: string;
8136
+ /** @description Version of the saved setup, starting at 1 */
8137
+ version: number;
8138
+ };
8139
+ };
8140
+ };
8141
+ /** @description The setup did not match the schema (experiment_invalid_workbench_state) or points at something that no longer exists (experiment_workbench_missing_reference) */
8142
+ 400: {
8143
+ headers: {
8144
+ [name: string]: unknown;
8145
+ };
8146
+ content: {
8147
+ "application/json": {
8148
+ /** @description Stable failure code; branch on this */
8149
+ error: string;
8150
+ message?: string;
8151
+ /** @description Who the failure is attributable to: customer, platform, provider */
8152
+ fault?: string;
8153
+ tips?: string[];
8154
+ docsUrl?: string;
8155
+ } & {
8156
+ [key: string]: unknown;
8157
+ };
8158
+ };
8159
+ };
8160
+ /** @description Unauthorized */
8161
+ 401: {
8162
+ headers: {
8163
+ [name: string]: unknown;
8164
+ };
8165
+ content: {
8166
+ "application/json": {
8167
+ error: string;
8168
+ message?: string;
8169
+ };
8170
+ };
8171
+ };
8172
+ /** @description Unprocessable Entity */
8173
+ 422: {
8174
+ headers: {
8175
+ [name: string]: unknown;
8176
+ };
8177
+ content: {
8178
+ "application/json": {
8179
+ error: string;
8180
+ message?: string;
8181
+ };
8182
+ };
8183
+ };
8184
+ /** @description Internal Server Error */
8185
+ 500: {
8186
+ headers: {
8187
+ [name: string]: unknown;
8188
+ };
8189
+ content: {
8190
+ "application/json": {
8191
+ error: string;
8192
+ message?: string;
8193
+ };
8194
+ };
8195
+ };
8196
+ };
8197
+ };
7714
8198
  getApiEvaluationsList: {
7715
8199
  parameters: {
7716
8200
  query?: never;
@@ -8459,115 +8943,609 @@ interface operations {
8459
8943
  };
8460
8944
  content: {
8461
8945
  "application/json": {
8462
- /** @description Set when the request was rejected before validation */
8463
- message?: string;
8464
- /** @description Set when the body parsed and then failed validation */
8465
- error?: string;
8946
+ /** @description Set when the request was rejected before validation */
8947
+ message?: string;
8948
+ /** @description Set when the body parsed and then failed validation */
8949
+ error?: string;
8950
+ };
8951
+ };
8952
+ };
8953
+ /** @description The API key lacks evaluations:manage */
8954
+ 403: {
8955
+ headers: {
8956
+ [name: string]: unknown;
8957
+ };
8958
+ content: {
8959
+ "application/json": {
8960
+ /** @description The failure, as a sentence */
8961
+ error: string;
8962
+ /** @description Stable failure code, on the failures that carry one */
8963
+ kind?: string;
8964
+ /** @description What the code needs to be acted on, such as the missing field */
8965
+ meta?: {
8966
+ [key: string]: unknown;
8967
+ };
8968
+ };
8969
+ };
8970
+ };
8971
+ /** @description No dataset with that slug */
8972
+ 404: {
8973
+ headers: {
8974
+ [name: string]: unknown;
8975
+ };
8976
+ content: {
8977
+ "application/json": {
8978
+ /** @description The failure, as a sentence */
8979
+ error: string;
8980
+ /** @description Stable failure code, on the failures that carry one */
8981
+ kind?: string;
8982
+ /** @description What the code needs to be acted on, such as the missing field */
8983
+ meta?: {
8984
+ [key: string]: unknown;
8985
+ };
8986
+ };
8987
+ };
8988
+ };
8989
+ /** @description The body is larger than 30MB. Refused before it is read, so the response is the plain sentence `Payload Too Large` rather than a JSON error */
8990
+ 413: {
8991
+ headers: {
8992
+ [name: string]: unknown;
8993
+ };
8994
+ content: {
8995
+ "text/plain": string;
8996
+ };
8997
+ };
8998
+ };
8999
+ };
9000
+ postApiExperimentsBySlugRun: {
9001
+ parameters: {
9002
+ query?: never;
9003
+ header?: never;
9004
+ path: {
9005
+ slug: string;
9006
+ };
9007
+ cookie?: never;
9008
+ };
9009
+ requestBody?: {
9010
+ content: {
9011
+ "application/json": {
9012
+ /** @description Rows to evaluate inline, instead of the experiment's saved dataset. Mutually exclusive with dataset_id. */
9013
+ data?: {
9014
+ [key: string]: unknown;
9015
+ }[];
9016
+ /** @description A saved dataset to evaluate, instead of the one the experiment is configured with. Mutually exclusive with data. */
9017
+ dataset_id?: string;
9018
+ /** @description Constant inputs applied to every row, overriding fields of the same name */
9019
+ parameters?: {
9020
+ [key: string]: string | number | boolean;
9021
+ };
9022
+ /** @description Run only these rows of the dataset, by zero-based index */
9023
+ row_indices?: number[];
9024
+ };
9025
+ };
9026
+ };
9027
+ responses: {
9028
+ /** @description Run started */
9029
+ 200: {
9030
+ headers: {
9031
+ [name: string]: unknown;
9032
+ };
9033
+ content: {
9034
+ "application/json": {
9035
+ /** @description Identifier to poll this run with */
9036
+ runId: string;
9037
+ /** @constant */
9038
+ status: "running";
9039
+ /** @description Number of cells this run will execute */
9040
+ total: number;
9041
+ /** @description Link to the run in the LangWatch app */
9042
+ runUrl?: string;
9043
+ };
9044
+ "text/event-stream": string;
9045
+ };
9046
+ };
9047
+ /** @description The body was not valid JSON, failed input validation, or the experiment has no dataset configured */
9048
+ 400: {
9049
+ headers: {
9050
+ [name: string]: unknown;
9051
+ };
9052
+ content: {
9053
+ "application/json": {
9054
+ error: string;
9055
+ };
9056
+ };
9057
+ };
9058
+ /** @description Missing or invalid API key, or the key lacks the permission */
9059
+ 401: {
9060
+ headers: {
9061
+ [name: string]: unknown;
9062
+ };
9063
+ content: {
9064
+ "application/json": {
9065
+ /** @description Stable failure code; branch on this */
9066
+ error: string;
9067
+ message?: string;
9068
+ /** @description Who the failure is attributable to: customer, platform, provider */
9069
+ fault?: string;
9070
+ tips?: string[];
9071
+ docsUrl?: string;
9072
+ } & {
9073
+ [key: string]: unknown;
9074
+ };
9075
+ };
9076
+ };
9077
+ /** @description No such experiment or run in this project */
9078
+ 404: {
9079
+ headers: {
9080
+ [name: string]: unknown;
9081
+ };
9082
+ content: {
9083
+ "application/json": {
9084
+ /** @description Stable failure code; branch on this */
9085
+ error: string;
9086
+ message?: string;
9087
+ /** @description Who the failure is attributable to: customer, platform, provider */
9088
+ fault?: string;
9089
+ tips?: string[];
9090
+ docsUrl?: string;
9091
+ } & {
9092
+ [key: string]: unknown;
9093
+ };
9094
+ };
9095
+ };
9096
+ };
9097
+ };
9098
+ getApiExperimentsRuns: {
9099
+ parameters: {
9100
+ query: {
9101
+ /** @description Slug of the experiment whose runs you want */
9102
+ experimentSlug: string;
9103
+ /** @description 1-based page number */
9104
+ page?: number;
9105
+ /** @description Runs per page, capped at 200 */
9106
+ pageSize?: number;
9107
+ };
9108
+ header?: never;
9109
+ path?: never;
9110
+ cookie?: never;
9111
+ };
9112
+ requestBody?: never;
9113
+ responses: {
9114
+ /** @description Runs for the experiment */
9115
+ 200: {
9116
+ headers: {
9117
+ [name: string]: unknown;
9118
+ };
9119
+ content: {
9120
+ "application/json": {
9121
+ experimentId: string;
9122
+ experimentSlug: string;
9123
+ runs: {
9124
+ experimentId: string;
9125
+ runId: string;
9126
+ workflowVersion: {
9127
+ id: string;
9128
+ version: string;
9129
+ commitMessage: string;
9130
+ author: {
9131
+ name: string | null;
9132
+ image: string | null;
9133
+ } | null;
9134
+ } | null;
9135
+ timestamps: {
9136
+ createdAt: number;
9137
+ updatedAt: number;
9138
+ finishedAt?: number | null;
9139
+ stoppedAt?: number | null;
9140
+ };
9141
+ progress?: number | null;
9142
+ total?: number | null;
9143
+ summary: {
9144
+ datasetCost?: number;
9145
+ evaluationsCost?: number;
9146
+ datasetAverageCost?: number;
9147
+ datasetAverageDuration?: number;
9148
+ evaluationsAverageCost?: number;
9149
+ evaluationsAverageDuration?: number;
9150
+ evaluations: {
9151
+ [key: string]: {
9152
+ name: string;
9153
+ averageScore: number | null;
9154
+ averagePassed?: number;
9155
+ };
9156
+ };
9157
+ };
9158
+ }[];
9159
+ pagination: {
9160
+ page: number;
9161
+ pageSize: number;
9162
+ totalHits: number;
9163
+ hasMore: boolean;
9164
+ };
9165
+ };
9166
+ };
9167
+ };
9168
+ /** @description experimentSlug was not supplied */
9169
+ 400: {
9170
+ headers: {
9171
+ [name: string]: unknown;
9172
+ };
9173
+ content: {
9174
+ "application/json": {
9175
+ error: string;
9176
+ };
9177
+ };
9178
+ };
9179
+ /** @description Missing or invalid API key, or the key lacks the permission */
9180
+ 401: {
9181
+ headers: {
9182
+ [name: string]: unknown;
9183
+ };
9184
+ content: {
9185
+ "application/json": {
9186
+ /** @description Stable failure code; branch on this */
9187
+ error: string;
9188
+ message?: string;
9189
+ /** @description Who the failure is attributable to: customer, platform, provider */
9190
+ fault?: string;
9191
+ tips?: string[];
9192
+ docsUrl?: string;
9193
+ } & {
9194
+ [key: string]: unknown;
9195
+ };
9196
+ };
9197
+ };
9198
+ /** @description No such experiment or run in this project */
9199
+ 404: {
9200
+ headers: {
9201
+ [name: string]: unknown;
9202
+ };
9203
+ content: {
9204
+ "application/json": {
9205
+ /** @description Stable failure code; branch on this */
9206
+ error: string;
9207
+ message?: string;
9208
+ /** @description Who the failure is attributable to: customer, platform, provider */
9209
+ fault?: string;
9210
+ tips?: string[];
9211
+ docsUrl?: string;
9212
+ } & {
9213
+ [key: string]: unknown;
9214
+ };
9215
+ };
9216
+ };
9217
+ };
9218
+ };
9219
+ getApiExperimentsRunsByRunId: {
9220
+ parameters: {
9221
+ query?: never;
9222
+ header?: never;
9223
+ path: {
9224
+ runId: string;
9225
+ };
9226
+ cookie?: never;
9227
+ };
9228
+ requestBody?: never;
9229
+ responses: {
9230
+ /** @description Run state */
9231
+ 200: {
9232
+ headers: {
9233
+ [name: string]: unknown;
9234
+ };
9235
+ content: {
9236
+ "application/json": {
9237
+ runId: string;
9238
+ /** @enum {string} */
9239
+ status: "pending" | "running" | "completed" | "failed" | "stopped";
9240
+ /** @description Cells finished so far */
9241
+ progress: number;
9242
+ /** @description Cells in the run */
9243
+ total: number;
9244
+ /** @description Unix milliseconds */
9245
+ startedAt?: number;
9246
+ /** @description Unix milliseconds; set once the run is no longer running */
9247
+ finishedAt?: number;
9248
+ /** @description Present when completed */
9249
+ summary?: {
9250
+ runId: string;
9251
+ /** @description Cells the run set out to execute */
9252
+ totalCells: number;
9253
+ completedCells: number;
9254
+ failedCells: number;
9255
+ /** @description Wall-clock milliseconds */
9256
+ duration: number;
9257
+ /** @description Non-zero means some rows may be missing from the stored results */
9258
+ chDispatchFailures?: number;
9259
+ timestamps: {
9260
+ startedAt: number;
9261
+ finishedAt?: number;
9262
+ stoppedAt?: number;
9263
+ };
9264
+ targets?: {
9265
+ targetId: string;
9266
+ name: string;
9267
+ passed: number;
9268
+ failed: number;
9269
+ avgLatency: number;
9270
+ totalCost: number;
9271
+ }[];
9272
+ evaluators?: {
9273
+ evaluatorId: string;
9274
+ name: string;
9275
+ passed: number;
9276
+ failed: number;
9277
+ passRate: number;
9278
+ avgScore?: number;
9279
+ }[];
9280
+ totalPassed?: number;
9281
+ totalFailed?: number;
9282
+ passRate?: number;
9283
+ totalCost?: number;
9284
+ /** @description Link to the run in the LangWatch app */
9285
+ runUrl?: string;
9286
+ };
9287
+ /** @description Stable failure code, present when failed. Not display copy: render your own wording keyed on it. */
9288
+ error?: string;
9289
+ /** @description The full failure envelope, when the failure carried one */
9290
+ domainError?: {
9291
+ /** @description Stable failure code; branch on this */
9292
+ code: string;
9293
+ /** @description Deprecated alias of code, for older clients */
9294
+ kind: string;
9295
+ message?: string;
9296
+ meta?: {
9297
+ [key: string]: unknown;
9298
+ };
9299
+ httpStatus?: number;
9300
+ /** @description Who the failure is attributable to: customer, platform, provider */
9301
+ fault?: string;
9302
+ traceId?: string;
9303
+ tips?: string[];
9304
+ docsUrl?: string;
9305
+ };
9306
+ /** @description Trace id for failures that carry no code, to quote in support */
9307
+ traceId?: string;
9308
+ };
9309
+ };
9310
+ };
9311
+ /** @description Missing or invalid API key, or the key lacks the permission */
9312
+ 401: {
9313
+ headers: {
9314
+ [name: string]: unknown;
9315
+ };
9316
+ content: {
9317
+ "application/json": {
9318
+ /** @description Stable failure code; branch on this */
9319
+ error: string;
9320
+ message?: string;
9321
+ /** @description Who the failure is attributable to: customer, platform, provider */
9322
+ fault?: string;
9323
+ tips?: string[];
9324
+ docsUrl?: string;
9325
+ } & {
9326
+ [key: string]: unknown;
9327
+ };
9328
+ };
9329
+ };
9330
+ /** @description No such experiment or run in this project */
9331
+ 404: {
9332
+ headers: {
9333
+ [name: string]: unknown;
9334
+ };
9335
+ content: {
9336
+ "application/json": {
9337
+ /** @description Stable failure code; branch on this */
9338
+ error: string;
9339
+ message?: string;
9340
+ /** @description Who the failure is attributable to: customer, platform, provider */
9341
+ fault?: string;
9342
+ tips?: string[];
9343
+ docsUrl?: string;
9344
+ } & {
9345
+ [key: string]: unknown;
9346
+ };
9347
+ };
9348
+ };
9349
+ };
9350
+ };
9351
+ getApiExperimentsRunsByRunIdResults: {
9352
+ parameters: {
9353
+ query?: {
9354
+ /** @description Owning experiment. Required once the run has aged out of the status cache. */
9355
+ experimentSlug?: string;
9356
+ };
9357
+ header?: never;
9358
+ path: {
9359
+ runId: string;
9360
+ };
9361
+ cookie?: never;
9362
+ };
9363
+ requestBody?: never;
9364
+ responses: {
9365
+ /** @description Rows and evaluations for the run */
9366
+ 200: {
9367
+ headers: {
9368
+ [name: string]: unknown;
9369
+ };
9370
+ content: {
9371
+ "application/json": {
9372
+ experimentId: string;
9373
+ runId: string;
9374
+ projectId: string;
9375
+ workflowVersionId?: string | null;
9376
+ progress?: number | null;
9377
+ total?: number | null;
9378
+ /** @description Resolves the targetId each dataset row and evaluation carries */
9379
+ targets?: {
9380
+ id: string;
9381
+ name: string;
9382
+ type: string;
9383
+ promptId?: string | null;
9384
+ promptVersion?: number | null;
9385
+ agentId?: string | null;
9386
+ evaluatorId?: string | null;
9387
+ model?: string | null;
9388
+ metadata?: {
9389
+ [key: string]: string | number | boolean;
9390
+ } | null;
9391
+ }[] | null;
9392
+ /** @description One row per dataset entry, with what the target predicted */
9393
+ dataset: {
9394
+ index: number;
9395
+ targetId?: string | null;
9396
+ entry: {
9397
+ [key: string]: unknown;
9398
+ };
9399
+ predicted?: {
9400
+ [key: string]: unknown;
9401
+ };
9402
+ cost?: number | null;
9403
+ duration?: number | null;
9404
+ /** @description The engine's own string. Prefer domainError.code to branch on */
9405
+ error?: string | null;
9406
+ /** @description Set on rows written since failures started carrying codes */
9407
+ domainError?: {
9408
+ /** @description Stable failure code; branch on this */
9409
+ code: string;
9410
+ /** @description Deprecated alias of code, for older clients */
9411
+ kind: string;
9412
+ message?: string;
9413
+ meta?: {
9414
+ [key: string]: unknown;
9415
+ };
9416
+ httpStatus?: number;
9417
+ /** @description Who the failure is attributable to: customer, platform, provider */
9418
+ fault?: string;
9419
+ traceId?: string;
9420
+ tips?: string[];
9421
+ docsUrl?: string;
9422
+ };
9423
+ traceId?: string | null;
9424
+ }[];
9425
+ /** @description One row per evaluator per dataset entry */
9426
+ evaluations: {
9427
+ evaluator: string;
9428
+ name?: string | null;
9429
+ targetId?: string | null;
9430
+ /** @enum {string} */
9431
+ status: "processed" | "skipped" | "error";
9432
+ index: number;
9433
+ score?: number | null;
9434
+ label?: string | null;
9435
+ passed?: boolean | null;
9436
+ details?: string | null;
9437
+ cost?: number | null;
9438
+ duration?: number | null;
9439
+ inputs?: {
9440
+ [key: string]: unknown;
9441
+ } | null;
9442
+ }[];
9443
+ timestamps: {
9444
+ createdAt: number;
9445
+ updatedAt: number;
9446
+ finishedAt?: number | null;
9447
+ stoppedAt?: number | null;
9448
+ };
8466
9449
  };
8467
9450
  };
8468
9451
  };
8469
- /** @description The API key lacks evaluations:manage */
8470
- 403: {
9452
+ /** @description Missing or invalid API key, or the key lacks the permission */
9453
+ 401: {
8471
9454
  headers: {
8472
9455
  [name: string]: unknown;
8473
9456
  };
8474
9457
  content: {
8475
9458
  "application/json": {
8476
- /** @description The failure, as a sentence */
9459
+ /** @description Stable failure code; branch on this */
8477
9460
  error: string;
8478
- /** @description Stable failure code, on the failures that carry one */
8479
- kind?: string;
8480
- /** @description What the code needs to be acted on, such as the missing field */
8481
- meta?: {
8482
- [key: string]: unknown;
8483
- };
9461
+ message?: string;
9462
+ /** @description Who the failure is attributable to: customer, platform, provider */
9463
+ fault?: string;
9464
+ tips?: string[];
9465
+ docsUrl?: string;
9466
+ } & {
9467
+ [key: string]: unknown;
8484
9468
  };
8485
9469
  };
8486
9470
  };
8487
- /** @description No dataset with that slug */
9471
+ /** @description No such experiment or run in this project */
8488
9472
  404: {
8489
9473
  headers: {
8490
9474
  [name: string]: unknown;
8491
9475
  };
8492
9476
  content: {
8493
9477
  "application/json": {
8494
- /** @description The failure, as a sentence */
9478
+ /** @description Stable failure code; branch on this */
8495
9479
  error: string;
8496
- /** @description Stable failure code, on the failures that carry one */
8497
- kind?: string;
8498
- /** @description What the code needs to be acted on, such as the missing field */
8499
- meta?: {
8500
- [key: string]: unknown;
8501
- };
9480
+ message?: string;
9481
+ /** @description Who the failure is attributable to: customer, platform, provider */
9482
+ fault?: string;
9483
+ tips?: string[];
9484
+ docsUrl?: string;
9485
+ } & {
9486
+ [key: string]: unknown;
8502
9487
  };
8503
9488
  };
8504
9489
  };
8505
- /** @description The body is larger than 30MB. Refused before it is read, so the response is the plain sentence `Payload Too Large` rather than a JSON error */
8506
- 413: {
8507
- headers: {
8508
- [name: string]: unknown;
8509
- };
8510
- content: {
8511
- "text/plain": string;
8512
- };
8513
- };
8514
9490
  };
8515
9491
  };
8516
- postApiExperimentsBySlugRun: {
9492
+ getApiExperimentsBySlugWorkbenchState: {
8517
9493
  parameters: {
8518
- query?: never;
9494
+ query?: {
9495
+ /** @description Set to `version` to answer with the version and timestamp only */
9496
+ fields?: "version";
9497
+ };
8519
9498
  header?: never;
8520
9499
  path: {
8521
9500
  slug: string;
8522
9501
  };
8523
9502
  cookie?: never;
8524
9503
  };
8525
- requestBody?: {
8526
- content: {
8527
- "application/json": {
8528
- /** @description Rows to evaluate inline, instead of the experiment's saved dataset. Mutually exclusive with dataset_id. */
8529
- data?: {
8530
- [key: string]: unknown;
8531
- }[];
8532
- /** @description A saved dataset to evaluate, instead of the one the experiment is configured with. Mutually exclusive with data. */
8533
- dataset_id?: string;
8534
- /** @description Constant inputs applied to every row, overriding fields of the same name */
8535
- parameters?: {
8536
- [key: string]: string | number | boolean;
8537
- };
8538
- /** @description Run only these rows of the dataset, by zero-based index */
8539
- row_indices?: number[];
8540
- };
8541
- };
8542
- };
9504
+ requestBody?: never;
8543
9505
  responses: {
8544
- /** @description Run started */
9506
+ /** @description The experiment's setup, or its version alone */
8545
9507
  200: {
8546
9508
  headers: {
8547
9509
  [name: string]: unknown;
8548
9510
  };
8549
9511
  content: {
8550
9512
  "application/json": {
8551
- /** @description Identifier to poll this run with */
8552
- runId: string;
8553
- /** @constant */
8554
- status: "running";
8555
- /** @description Number of cells this run will execute */
8556
- total: number;
8557
- /** @description Link to the run in the LangWatch app */
8558
- runUrl?: string;
9513
+ id: string;
9514
+ slug: string;
9515
+ name: string | null;
9516
+ /** @description The experiment setup: datasets, targets and evaluators. Read it, change it, send it back whole. */
9517
+ state: {
9518
+ [key: string]: unknown;
9519
+ } | null;
9520
+ /** @description Send this back as expectedVersion to save safely */
9521
+ version: number;
9522
+ /** @description ISO 8601 timestamp of the last save */
9523
+ updatedAt: string;
9524
+ } | {
9525
+ id: string;
9526
+ slug: string;
9527
+ version: number;
9528
+ /** @description ISO 8601 timestamp of the last save */
9529
+ updatedAt: string;
8559
9530
  };
8560
- "text/event-stream": string;
8561
9531
  };
8562
9532
  };
8563
- /** @description The body was not valid JSON, failed input validation, or the experiment has no dataset configured */
9533
+ /** @description The experiment is not an evaluations workbench (experiment_type_mismatch) */
8564
9534
  400: {
8565
9535
  headers: {
8566
9536
  [name: string]: unknown;
8567
9537
  };
8568
9538
  content: {
8569
9539
  "application/json": {
9540
+ /** @description Stable failure code; branch on this */
8570
9541
  error: string;
9542
+ message?: string;
9543
+ /** @description Who the failure is attributable to: customer, platform, provider */
9544
+ fault?: string;
9545
+ tips?: string[];
9546
+ docsUrl?: string;
9547
+ } & {
9548
+ [key: string]: unknown;
8571
9549
  };
8572
9550
  };
8573
9551
  };
@@ -8611,84 +9589,58 @@ interface operations {
8611
9589
  };
8612
9590
  };
8613
9591
  };
8614
- getApiExperimentsRuns: {
9592
+ putApiExperimentsBySlugWorkbenchState: {
8615
9593
  parameters: {
8616
- query: {
8617
- /** @description Slug of the experiment whose runs you want */
8618
- experimentSlug: string;
8619
- /** @description 1-based page number */
8620
- page?: number;
8621
- /** @description Runs per page, capped at 200 */
8622
- pageSize?: number;
8623
- };
9594
+ query?: never;
8624
9595
  header?: never;
8625
- path?: never;
9596
+ path: {
9597
+ slug: string;
9598
+ };
8626
9599
  cookie?: never;
8627
9600
  };
8628
- requestBody?: never;
9601
+ requestBody: {
9602
+ content: {
9603
+ "application/json": {
9604
+ /** @description The full setup to save */
9605
+ state: {
9606
+ [key: string]: unknown;
9607
+ };
9608
+ /** @description The version you read. Sending it refuses the save when someone else already wrote on top of it. */
9609
+ expectedVersion?: number;
9610
+ /** @description Names this version in the history list */
9611
+ commitMessage?: string;
9612
+ };
9613
+ };
9614
+ };
8629
9615
  responses: {
8630
- /** @description Runs for the experiment */
9616
+ /** @description Setup saved */
8631
9617
  200: {
8632
9618
  headers: {
8633
9619
  [name: string]: unknown;
8634
- };
8635
- content: {
8636
- "application/json": {
8637
- experimentId: string;
8638
- experimentSlug: string;
8639
- runs: {
8640
- experimentId: string;
8641
- runId: string;
8642
- workflowVersion: {
8643
- id: string;
8644
- version: string;
8645
- commitMessage: string;
8646
- author: {
8647
- name: string | null;
8648
- image: string | null;
8649
- } | null;
8650
- } | null;
8651
- timestamps: {
8652
- createdAt: number;
8653
- updatedAt: number;
8654
- finishedAt?: number | null;
8655
- stoppedAt?: number | null;
8656
- };
8657
- progress?: number | null;
8658
- total?: number | null;
8659
- summary: {
8660
- datasetCost?: number;
8661
- evaluationsCost?: number;
8662
- datasetAverageCost?: number;
8663
- datasetAverageDuration?: number;
8664
- evaluationsAverageCost?: number;
8665
- evaluationsAverageDuration?: number;
8666
- evaluations: {
8667
- [key: string]: {
8668
- name: string;
8669
- averageScore: number | null;
8670
- averagePassed?: number;
8671
- };
8672
- };
8673
- };
8674
- }[];
8675
- pagination: {
8676
- page: number;
8677
- pageSize: number;
8678
- totalHits: number;
8679
- hasMore: boolean;
8680
- };
9620
+ };
9621
+ content: {
9622
+ "application/json": {
9623
+ /** @description The version the save produced */
9624
+ version: number;
8681
9625
  };
8682
9626
  };
8683
9627
  };
8684
- /** @description experimentSlug was not supplied */
9628
+ /** @description The setup did not match the schema (experiment_invalid_workbench_state), points at something that no longer exists (experiment_workbench_missing_reference), or the experiment is not an evaluations workbench (experiment_type_mismatch) */
8685
9629
  400: {
8686
9630
  headers: {
8687
9631
  [name: string]: unknown;
8688
9632
  };
8689
9633
  content: {
8690
9634
  "application/json": {
9635
+ /** @description Stable failure code; branch on this */
8691
9636
  error: string;
9637
+ message?: string;
9638
+ /** @description Who the failure is attributable to: customer, platform, provider */
9639
+ fault?: string;
9640
+ tips?: string[];
9641
+ docsUrl?: string;
9642
+ } & {
9643
+ [key: string]: unknown;
8692
9644
  };
8693
9645
  };
8694
9646
  };
@@ -8730,97 +9682,89 @@ interface operations {
8730
9682
  };
8731
9683
  };
8732
9684
  };
9685
+ /** @description Someone else saved since you read this state (experiment_stale_workbench_state). `currentVersion` carries the version to read again. */
9686
+ 409: {
9687
+ headers: {
9688
+ [name: string]: unknown;
9689
+ };
9690
+ content: {
9691
+ "application/json": {
9692
+ /** @description Stable failure code; branch on this */
9693
+ error: string;
9694
+ message?: string;
9695
+ /** @description Who the failure is attributable to: customer, platform, provider */
9696
+ fault?: string;
9697
+ tips?: string[];
9698
+ docsUrl?: string;
9699
+ /** @description The stored version now. Read the setup again at this one. */
9700
+ currentVersion: number;
9701
+ } & {
9702
+ [key: string]: unknown;
9703
+ };
9704
+ };
9705
+ };
8733
9706
  };
8734
9707
  };
8735
- getApiExperimentsRunsByRunId: {
9708
+ getApiExperimentsBySlugVersions: {
8736
9709
  parameters: {
8737
- query?: never;
9710
+ query?: {
9711
+ /** @description Versions per page, capped at 100 */
9712
+ limit?: number;
9713
+ /** @description The `nextCursor` of the previous page */
9714
+ cursor?: number;
9715
+ };
8738
9716
  header?: never;
8739
9717
  path: {
8740
- runId: string;
9718
+ slug: string;
8741
9719
  };
8742
9720
  cookie?: never;
8743
9721
  };
8744
9722
  requestBody?: never;
8745
9723
  responses: {
8746
- /** @description Run state */
9724
+ /** @description Versions of the experiment */
8747
9725
  200: {
8748
9726
  headers: {
8749
9727
  [name: string]: unknown;
8750
9728
  };
8751
9729
  content: {
8752
9730
  "application/json": {
8753
- runId: string;
8754
- /** @enum {string} */
8755
- status: "pending" | "running" | "completed" | "failed" | "stopped";
8756
- /** @description Cells finished so far */
8757
- progress: number;
8758
- /** @description Cells in the run */
8759
- total: number;
8760
- /** @description Unix milliseconds */
8761
- startedAt?: number;
8762
- /** @description Unix milliseconds; set once the run is no longer running */
8763
- finishedAt?: number;
8764
- /** @description Present when completed */
8765
- summary?: {
8766
- runId: string;
8767
- /** @description Cells the run set out to execute */
8768
- totalCells: number;
8769
- completedCells: number;
8770
- failedCells: number;
8771
- /** @description Wall-clock milliseconds */
8772
- duration: number;
8773
- /** @description Non-zero means some rows may be missing from the stored results */
8774
- chDispatchFailures?: number;
8775
- timestamps: {
8776
- startedAt: number;
8777
- finishedAt?: number;
8778
- stoppedAt?: number;
8779
- };
8780
- targets?: {
8781
- targetId: string;
8782
- name: string;
8783
- passed: number;
8784
- failed: number;
8785
- avgLatency: number;
8786
- totalCost: number;
8787
- }[];
8788
- evaluators?: {
8789
- evaluatorId: string;
8790
- name: string;
8791
- passed: number;
8792
- failed: number;
8793
- passRate: number;
8794
- avgScore?: number;
8795
- }[];
8796
- totalPassed?: number;
8797
- totalFailed?: number;
8798
- passRate?: number;
8799
- totalCost?: number;
8800
- /** @description Link to the run in the LangWatch app */
8801
- runUrl?: string;
8802
- };
8803
- /** @description Stable failure code, present when failed. Not display copy: render your own wording keyed on it. */
8804
- error?: string;
8805
- /** @description The full failure envelope, when the failure carried one */
8806
- domainError?: {
8807
- /** @description Stable failure code; branch on this */
8808
- code: string;
8809
- /** @description Deprecated alias of code, for older clients */
8810
- kind: string;
8811
- message?: string;
8812
- meta?: {
8813
- [key: string]: unknown;
8814
- };
8815
- httpStatus?: number;
8816
- /** @description Who the failure is attributable to: customer, platform, provider */
8817
- fault?: string;
8818
- traceId?: string;
8819
- tips?: string[];
8820
- docsUrl?: string;
8821
- };
8822
- /** @description Trace id for failures that carry no code, to quote in support */
8823
- traceId?: string;
9731
+ /** @description Newest first */
9732
+ versions: {
9733
+ version: number;
9734
+ /** @description True for a version written by an ordinary save */
9735
+ autoSaved: boolean;
9736
+ commitMessage: string | null;
9737
+ /**
9738
+ * @description Who wrote it: user, langy or api
9739
+ * @example user
9740
+ */
9741
+ authorLabel: string;
9742
+ /** @description User id, when a person wrote it */
9743
+ authorId: string | null;
9744
+ /** @description ISO 8601 timestamp */
9745
+ createdAt: string;
9746
+ }[];
9747
+ /** @description Pass as `cursor` to read the next page, null on the last one */
9748
+ nextCursor: number | null;
9749
+ };
9750
+ };
9751
+ };
9752
+ /** @description The experiment is not an evaluations workbench (experiment_type_mismatch) */
9753
+ 400: {
9754
+ headers: {
9755
+ [name: string]: unknown;
9756
+ };
9757
+ content: {
9758
+ "application/json": {
9759
+ /** @description Stable failure code; branch on this */
9760
+ error: string;
9761
+ message?: string;
9762
+ /** @description Who the failure is attributable to: customer, platform, provider */
9763
+ fault?: string;
9764
+ tips?: string[];
9765
+ docsUrl?: string;
9766
+ } & {
9767
+ [key: string]: unknown;
8824
9768
  };
8825
9769
  };
8826
9770
  };
@@ -8864,104 +9808,47 @@ interface operations {
8864
9808
  };
8865
9809
  };
8866
9810
  };
8867
- getApiExperimentsRunsByRunIdResults: {
9811
+ postApiExperimentsBySlugVersionsByVersionRestore: {
8868
9812
  parameters: {
8869
- query?: {
8870
- /** @description Owning experiment. Required once the run has aged out of the status cache. */
8871
- experimentSlug?: string;
8872
- };
9813
+ query?: never;
8873
9814
  header?: never;
8874
9815
  path: {
8875
- runId: string;
9816
+ /** @description The version to restore, as listed by `GET /api/experiments/{slug}/versions` */
9817
+ version: number;
9818
+ slug: string;
8876
9819
  };
8877
9820
  cookie?: never;
8878
9821
  };
8879
9822
  requestBody?: never;
8880
9823
  responses: {
8881
- /** @description Rows and evaluations for the run */
9824
+ /** @description Version restored */
8882
9825
  200: {
8883
9826
  headers: {
8884
9827
  [name: string]: unknown;
8885
9828
  };
8886
9829
  content: {
8887
9830
  "application/json": {
8888
- experimentId: string;
8889
- runId: string;
8890
- projectId: string;
8891
- workflowVersionId?: string | null;
8892
- progress?: number | null;
8893
- total?: number | null;
8894
- /** @description Resolves the targetId each dataset row and evaluation carries */
8895
- targets?: {
8896
- id: string;
8897
- name: string;
8898
- type: string;
8899
- promptId?: string | null;
8900
- promptVersion?: number | null;
8901
- agentId?: string | null;
8902
- evaluatorId?: string | null;
8903
- model?: string | null;
8904
- metadata?: {
8905
- [key: string]: string | number | boolean;
8906
- } | null;
8907
- }[] | null;
8908
- /** @description One row per dataset entry, with what the target predicted */
8909
- dataset: {
8910
- index: number;
8911
- targetId?: string | null;
8912
- entry: {
8913
- [key: string]: unknown;
8914
- };
8915
- predicted?: {
8916
- [key: string]: unknown;
8917
- };
8918
- cost?: number | null;
8919
- duration?: number | null;
8920
- /** @description The engine's own string. Prefer domainError.code to branch on */
8921
- error?: string | null;
8922
- /** @description Set on rows written since failures started carrying codes */
8923
- domainError?: {
8924
- /** @description Stable failure code; branch on this */
8925
- code: string;
8926
- /** @description Deprecated alias of code, for older clients */
8927
- kind: string;
8928
- message?: string;
8929
- meta?: {
8930
- [key: string]: unknown;
8931
- };
8932
- httpStatus?: number;
8933
- /** @description Who the failure is attributable to: customer, platform, provider */
8934
- fault?: string;
8935
- traceId?: string;
8936
- tips?: string[];
8937
- docsUrl?: string;
8938
- };
8939
- traceId?: string | null;
8940
- }[];
8941
- /** @description One row per evaluator per dataset entry */
8942
- evaluations: {
8943
- evaluator: string;
8944
- name?: string | null;
8945
- targetId?: string | null;
8946
- /** @enum {string} */
8947
- status: "processed" | "skipped" | "error";
8948
- index: number;
8949
- score?: number | null;
8950
- label?: string | null;
8951
- passed?: boolean | null;
8952
- details?: string | null;
8953
- cost?: number | null;
8954
- duration?: number | null;
8955
- inputs?: {
8956
- [key: string]: unknown;
8957
- } | null;
8958
- }[];
8959
- timestamps: {
8960
- createdAt: number;
8961
- updatedAt: number;
8962
- finishedAt?: number | null;
8963
- stoppedAt?: number | null;
8964
- };
9831
+ /** @description The new version the restore wrote. History is never rewritten, so the restored version is still in the list. */
9832
+ version: number;
9833
+ };
9834
+ };
9835
+ };
9836
+ /** @description The setup did not match the schema (experiment_invalid_workbench_state), points at something that no longer exists (experiment_workbench_missing_reference), or the experiment is not an evaluations workbench (experiment_type_mismatch) */
9837
+ 400: {
9838
+ headers: {
9839
+ [name: string]: unknown;
9840
+ };
9841
+ content: {
9842
+ "application/json": {
9843
+ /** @description Stable failure code; branch on this */
9844
+ error: string;
9845
+ message?: string;
9846
+ /** @description Who the failure is attributable to: customer, platform, provider */
9847
+ fault?: string;
9848
+ tips?: string[];
9849
+ docsUrl?: string;
9850
+ } & {
9851
+ [key: string]: unknown;
8965
9852
  };
8966
9853
  };
8967
9854
  };
@@ -9003,6 +9890,27 @@ interface operations {
9003
9890
  };
9004
9891
  };
9005
9892
  };
9893
+ /** @description Someone else saved since you read this state (experiment_stale_workbench_state). `currentVersion` carries the version to read again. */
9894
+ 409: {
9895
+ headers: {
9896
+ [name: string]: unknown;
9897
+ };
9898
+ content: {
9899
+ "application/json": {
9900
+ /** @description Stable failure code; branch on this */
9901
+ error: string;
9902
+ message?: string;
9903
+ /** @description Who the failure is attributable to: customer, platform, provider */
9904
+ fault?: string;
9905
+ tips?: string[];
9906
+ docsUrl?: string;
9907
+ /** @description The stored version now. Read the setup again at this one. */
9908
+ currentVersion: number;
9909
+ } & {
9910
+ [key: string]: unknown;
9911
+ };
9912
+ };
9913
+ };
9006
9914
  };
9007
9915
  };
9008
9916
  postApiAnalytics: {