opik 2.0.68 → 2.0.69

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.d.cts CHANGED
@@ -371,6 +371,80 @@ interface GetLatestBlueprintRequest {
371
371
  maskId?: string;
372
372
  }
373
373
 
374
+ /**
375
+ * @example
376
+ * {
377
+ * projectId: "project_id",
378
+ * status: "open"
379
+ * }
380
+ */
381
+ interface AgentInsightsIssueUpdate {
382
+ projectId: string;
383
+ status: AgentInsightsIssueUpdateStatus;
384
+ }
385
+
386
+ /**
387
+ * @example
388
+ * {
389
+ * projectId: "project_id",
390
+ * reportDay: "2023-01-15",
391
+ * issues: [{
392
+ * name: "name",
393
+ * count: 1000000,
394
+ * totalCount: 1000000,
395
+ * usersImpacted: 1000000,
396
+ * totalUsers: 1000000
397
+ * }]
398
+ * }
399
+ */
400
+ interface AgentInsightsReport {
401
+ projectId: string;
402
+ reportDay: string;
403
+ issues: ReportedIssue[];
404
+ }
405
+
406
+ /**
407
+ * @example
408
+ * {
409
+ * projectId: "project_id"
410
+ * }
411
+ */
412
+ interface FindAgentInsightsIssuesRequest {
413
+ projectId: string;
414
+ fromDate?: string;
415
+ toDate?: string;
416
+ status?: FindAgentInsightsIssuesRequestStatus;
417
+ sorting?: string;
418
+ page?: number;
419
+ size?: number;
420
+ }
421
+
422
+ /**
423
+ * @example
424
+ * {
425
+ * projectId: "project_id"
426
+ * }
427
+ */
428
+ interface GetAgentInsightsIssueByIdRequest {
429
+ projectId: string;
430
+ fromDate?: string;
431
+ toDate?: string;
432
+ }
433
+
434
+ declare const AgentInsightsIssueUpdateStatus: {
435
+ readonly Open: "open";
436
+ readonly Resolved: "resolved";
437
+ readonly Closed: "closed";
438
+ };
439
+ type AgentInsightsIssueUpdateStatus = (typeof AgentInsightsIssueUpdateStatus)[keyof typeof AgentInsightsIssueUpdateStatus];
440
+
441
+ declare const FindAgentInsightsIssuesRequestStatus: {
442
+ readonly Open: "open";
443
+ readonly Resolved: "resolved";
444
+ readonly Closed: "closed";
445
+ };
446
+ type FindAgentInsightsIssuesRequestStatus = (typeof FindAgentInsightsIssuesRequestStatus)[keyof typeof FindAgentInsightsIssuesRequestStatus];
447
+
374
448
  /**
375
449
  * @example
376
450
  * {
@@ -2854,6 +2928,17 @@ declare const SpanSearchStreamRequestPublicType: {
2854
2928
  };
2855
2929
  type SpanSearchStreamRequestPublicType = (typeof SpanSearchStreamRequestPublicType)[keyof typeof SpanSearchStreamRequestPublicType];
2856
2930
 
2931
+ /**
2932
+ * @example
2933
+ * {
2934
+ * query: "query"
2935
+ * }
2936
+ */
2937
+ interface AnalyticsQueryRequest {
2938
+ /** Read-only ClickHouse SQL. Must return exactly one column named `result` produced via toJSONString(...) */
2939
+ query: string;
2940
+ }
2941
+
2857
2942
  /**
2858
2943
  * @example
2859
2944
  * {
@@ -3374,6 +3459,83 @@ declare const AgentConfigValueWriteType: {
3374
3459
  };
3375
3460
  type AgentConfigValueWriteType = (typeof AgentConfigValueWriteType)[keyof typeof AgentConfigValueWriteType];
3376
3461
 
3462
+ interface AgentInsightsIssue {
3463
+ id?: string;
3464
+ name?: string;
3465
+ description?: string;
3466
+ cause?: string;
3467
+ suggestedFix?: string;
3468
+ status?: AgentInsightsIssueStatus;
3469
+ tracesQuery?: string;
3470
+ /** SUM(count) over the requested window */
3471
+ totalOccurrences?: number;
3472
+ /** SUM(total_count) over the requested window */
3473
+ total?: number;
3474
+ /** SUM(users_impacted) over the requested window */
3475
+ usersImpacted?: number;
3476
+ /** SUM(total_users) over the requested window */
3477
+ totalUsers?: number;
3478
+ /** MIN(report_day) in the requested window */
3479
+ firstSeen?: string;
3480
+ /** MAX(report_day) in the requested window */
3481
+ lastSeen?: string;
3482
+ /** COUNT(DISTINCT report_day) in the requested window */
3483
+ daysReported?: number;
3484
+ createdBy?: string;
3485
+ createdAt?: Date;
3486
+ lastUpdatedBy?: string;
3487
+ lastUpdatedAt?: Date;
3488
+ }
3489
+
3490
+ /**
3491
+ * Per-day breakdown within the requested window, ordered by report_day ascending
3492
+ */
3493
+ interface AgentInsightsIssueDetail {
3494
+ reportDay?: string;
3495
+ count?: number;
3496
+ totalCount?: number;
3497
+ usersImpacted?: number;
3498
+ totalUsers?: number;
3499
+ metadata?: JsonNode;
3500
+ }
3501
+
3502
+ interface AgentInsightsIssuePage {
3503
+ page?: number;
3504
+ size?: number;
3505
+ total?: number;
3506
+ content?: AgentInsightsIssue[];
3507
+ }
3508
+
3509
+ declare const AgentInsightsIssueStatus: {
3510
+ readonly Open: "open";
3511
+ readonly Resolved: "resolved";
3512
+ readonly Closed: "closed";
3513
+ };
3514
+ type AgentInsightsIssueStatus = (typeof AgentInsightsIssueStatus)[keyof typeof AgentInsightsIssueStatus];
3515
+
3516
+ interface AgentInsightsIssueWithDetails {
3517
+ id?: string;
3518
+ name?: string;
3519
+ description?: string;
3520
+ cause?: string;
3521
+ suggestedFix?: string;
3522
+ status?: AgentInsightsIssueWithDetailsStatus;
3523
+ tracesQuery?: string;
3524
+ createdBy?: string;
3525
+ createdAt?: Date;
3526
+ lastUpdatedBy?: string;
3527
+ lastUpdatedAt?: Date;
3528
+ /** Per-day breakdown within the requested window, ordered by report_day ascending */
3529
+ details?: AgentInsightsIssueDetail[];
3530
+ }
3531
+
3532
+ declare const AgentInsightsIssueWithDetailsStatus: {
3533
+ readonly Open: "open";
3534
+ readonly Resolved: "resolved";
3535
+ readonly Closed: "closed";
3536
+ };
3537
+ type AgentInsightsIssueWithDetailsStatus = (typeof AgentInsightsIssueWithDetailsStatus)[keyof typeof AgentInsightsIssueWithDetailsStatus];
3538
+
3377
3539
  interface AggregationData {
3378
3540
  experimentCount?: number;
3379
3541
  traceCount?: number;
@@ -3519,6 +3681,10 @@ declare const AlertWriteAlertType: {
3519
3681
  };
3520
3682
  type AlertWriteAlertType = (typeof AlertWriteAlertType)[keyof typeof AlertWriteAlertType];
3521
3683
 
3684
+ interface AnalyticsQueryResponse {
3685
+ results?: JsonNode[];
3686
+ }
3687
+
3522
3688
  interface AnnotationQueueItemIds {
3523
3689
  ids: string[];
3524
3690
  }
@@ -6569,6 +6735,20 @@ interface RecentActivityPagePublic {
6569
6735
  content?: RecentActivityItemPublic[];
6570
6736
  }
6571
6737
 
6738
+ interface ReportedIssue {
6739
+ id?: string;
6740
+ name: string;
6741
+ description?: string;
6742
+ cause?: string;
6743
+ suggestedFix?: string;
6744
+ tracesQuery?: string;
6745
+ count: number;
6746
+ totalCount: number;
6747
+ usersImpacted: number;
6748
+ totalUsers: number;
6749
+ metadata?: JsonNode;
6750
+ }
6751
+
6572
6752
  interface ReportPreference {
6573
6753
  projectId?: string;
6574
6754
  enabled?: boolean;
@@ -7690,6 +7870,13 @@ interface UserDefinedMetricPythonCodeWrite {
7690
7870
  arguments: Record<string, string>;
7691
7871
  }
7692
7872
 
7873
+ interface ValidatedToken {
7874
+ userName?: string;
7875
+ workspaceId?: string;
7876
+ workspaceName?: string;
7877
+ resource?: string;
7878
+ }
7879
+
7693
7880
  interface ValueEntry {
7694
7881
  value?: number;
7695
7882
  reason?: string;
@@ -8164,6 +8351,97 @@ declare class AgentConfigsClient {
8164
8351
  private __removeConfigKeys;
8165
8352
  }
8166
8353
 
8354
+ declare namespace AgentInsightsClient {
8355
+ type Options = BaseClientOptions;
8356
+ interface RequestOptions extends BaseRequestOptions {
8357
+ }
8358
+ }
8359
+ /**
8360
+ * Agent Insights report results
8361
+ */
8362
+ declare class AgentInsightsClient {
8363
+ protected readonly _options: NormalizedClientOptions<AgentInsightsClient.Options>;
8364
+ constructor(options?: AgentInsightsClient.Options);
8365
+ /**
8366
+ * Returns a paginated list of issues that have at least one detail row within the requested time window, with metrics aggregated over the window
8367
+ *
8368
+ * @param {OpikApi.FindAgentInsightsIssuesRequest} request
8369
+ * @param {AgentInsightsClient.RequestOptions} requestOptions - Request-specific configuration.
8370
+ *
8371
+ * @throws {@link OpikApi.BadRequestError}
8372
+ * @throws {@link OpikApi.UnauthorizedError}
8373
+ *
8374
+ * @example
8375
+ * await client.agentInsights.findAgentInsightsIssues({
8376
+ * projectId: "project_id"
8377
+ * })
8378
+ */
8379
+ findAgentInsightsIssues(request: FindAgentInsightsIssuesRequest, requestOptions?: AgentInsightsClient.RequestOptions): HttpResponsePromise<AgentInsightsIssuePage>;
8380
+ private __findAgentInsightsIssues;
8381
+ /**
8382
+ * Upserts the detected issues and their per-day metrics for the given report day in a single transaction. Issue status is never modified by this endpoint.
8383
+ *
8384
+ * @param {OpikApi.AgentInsightsReport} request
8385
+ * @param {AgentInsightsClient.RequestOptions} requestOptions - Request-specific configuration.
8386
+ *
8387
+ * @throws {@link OpikApi.BadRequestError}
8388
+ * @throws {@link OpikApi.UnauthorizedError}
8389
+ * @throws {@link OpikApi.NotFoundError}
8390
+ *
8391
+ * @example
8392
+ * await client.agentInsights.reportAgentInsightsIssues({
8393
+ * projectId: "project_id",
8394
+ * reportDay: "2023-01-15",
8395
+ * issues: [{
8396
+ * name: "name",
8397
+ * count: 1000000,
8398
+ * totalCount: 1000000,
8399
+ * usersImpacted: 1000000,
8400
+ * totalUsers: 1000000
8401
+ * }]
8402
+ * })
8403
+ */
8404
+ reportAgentInsightsIssues(request: AgentInsightsReport, requestOptions?: AgentInsightsClient.RequestOptions): HttpResponsePromise<void>;
8405
+ private __reportAgentInsightsIssues;
8406
+ /**
8407
+ * Returns the issue together with its per-day breakdown within the requested time window
8408
+ *
8409
+ * @param {string} issue_id
8410
+ * @param {OpikApi.GetAgentInsightsIssueByIdRequest} request
8411
+ * @param {AgentInsightsClient.RequestOptions} requestOptions - Request-specific configuration.
8412
+ *
8413
+ * @throws {@link OpikApi.BadRequestError}
8414
+ * @throws {@link OpikApi.UnauthorizedError}
8415
+ * @throws {@link OpikApi.NotFoundError}
8416
+ *
8417
+ * @example
8418
+ * await client.agentInsights.getAgentInsightsIssueById("issue_id", {
8419
+ * projectId: "project_id"
8420
+ * })
8421
+ */
8422
+ getAgentInsightsIssueById(issue_id: string, request: GetAgentInsightsIssueByIdRequest, requestOptions?: AgentInsightsClient.RequestOptions): HttpResponsePromise<AgentInsightsIssueWithDetails>;
8423
+ private __getAgentInsightsIssueById;
8424
+ /**
8425
+ * Moves an issue through its lifecycle: open, resolved or closed
8426
+ *
8427
+ * @param {string} issue_id
8428
+ * @param {OpikApi.AgentInsightsIssueUpdate} request
8429
+ * @param {AgentInsightsClient.RequestOptions} requestOptions - Request-specific configuration.
8430
+ *
8431
+ * @throws {@link OpikApi.BadRequestError}
8432
+ * @throws {@link OpikApi.UnauthorizedError}
8433
+ * @throws {@link OpikApi.NotFoundError}
8434
+ *
8435
+ * @example
8436
+ * await client.agentInsights.updateAgentInsightsIssue("issue_id", {
8437
+ * projectId: "project_id",
8438
+ * status: "open"
8439
+ * })
8440
+ */
8441
+ updateAgentInsightsIssue(issue_id: string, request: AgentInsightsIssueUpdate, requestOptions?: AgentInsightsClient.RequestOptions): HttpResponsePromise<void>;
8442
+ private __updateAgentInsightsIssue;
8443
+ }
8444
+
8167
8445
  declare namespace AiSpendClient {
8168
8446
  type Options = BaseClientOptions;
8169
8447
  interface RequestOptions extends BaseRequestOptions {
@@ -10356,6 +10634,18 @@ declare class McpOAuthClient {
10356
10634
  */
10357
10635
  token(request?: TokenRequest, requestOptions?: McpOAuthClient.RequestOptions): HttpResponsePromise<TokenResponse>;
10358
10636
  private __token;
10637
+ /**
10638
+ * Introspects a bearer access token and returns the identity it resolves to
10639
+ *
10640
+ * @param {McpOAuthClient.RequestOptions} requestOptions - Request-specific configuration.
10641
+ *
10642
+ * @throws {@link OpikApi.UnauthorizedError}
10643
+ *
10644
+ * @example
10645
+ * await client.mcpOAuth.validateOAuthToken()
10646
+ */
10647
+ validateOAuthToken(requestOptions?: McpOAuthClient.RequestOptions): HttpResponsePromise<ValidatedToken>;
10648
+ private __validateOAuthToken;
10359
10649
  }
10360
10650
 
10361
10651
  declare namespace OllamaClient {
@@ -12014,6 +12304,37 @@ declare class SpansClient {
12014
12304
  private __updateSpanComment;
12015
12305
  }
12016
12306
 
12307
+ declare namespace SystemAnalyticsQueriesClient {
12308
+ type Options = BaseClientOptions;
12309
+ interface RequestOptions extends BaseRequestOptions {
12310
+ }
12311
+ }
12312
+ /**
12313
+ * Internal endpoint to run Agent Insights free-form SQL
12314
+ */
12315
+ declare class SystemAnalyticsQueriesClient {
12316
+ protected readonly _options: NormalizedClientOptions<SystemAnalyticsQueriesClient.Options>;
12317
+ constructor(options?: SystemAnalyticsQueriesClient.Options);
12318
+ /**
12319
+ * Runs Ollie-generated read-only SQL bounded to the caller's workspace and the requested project. Returns 501 when the Agent Insights toggle is off.
12320
+ *
12321
+ * @param {string} projectId
12322
+ * @param {OpikApi.AnalyticsQueryRequest} request
12323
+ * @param {SystemAnalyticsQueriesClient.RequestOptions} requestOptions - Request-specific configuration.
12324
+ *
12325
+ * @throws {@link OpikApi.BadRequestError}
12326
+ * @throws {@link OpikApi.UnprocessableEntityError}
12327
+ * @throws {@link OpikApi.NotImplementedError}
12328
+ *
12329
+ * @example
12330
+ * await client.systemAnalyticsQueries.executeAnalyticsQuery("projectId", {
12331
+ * query: "query"
12332
+ * })
12333
+ */
12334
+ executeAnalyticsQuery(projectId: string, request: AnalyticsQueryRequest, requestOptions?: SystemAnalyticsQueriesClient.RequestOptions): HttpResponsePromise<AnalyticsQueryResponse>;
12335
+ private __executeAnalyticsQuery;
12336
+ }
12337
+
12017
12338
  declare namespace SystemUsageClient {
12018
12339
  type Options = BaseClientOptions;
12019
12340
  interface RequestOptions extends BaseRequestOptions {
@@ -12774,8 +13095,10 @@ declare namespace OpikApiClient {
12774
13095
  declare class OpikApiClient {
12775
13096
  protected readonly _options: NormalizedClientOptions<OpikApiClient.Options>;
12776
13097
  protected _mcpOAuth: McpOAuthClient | undefined;
13098
+ protected _systemAnalyticsQueries: SystemAnalyticsQueriesClient | undefined;
12777
13099
  protected _systemUsage: SystemUsageClient | undefined;
12778
13100
  protected _agentConfigs: AgentConfigsClient | undefined;
13101
+ protected _agentInsights: AgentInsightsClient | undefined;
12779
13102
  protected _aiSpend: AiSpendClient | undefined;
12780
13103
  protected _alerts: AlertsClient | undefined;
12781
13104
  protected _annotationQueues: AnnotationQueuesClient | undefined;
@@ -12813,8 +13136,10 @@ declare class OpikApiClient {
12813
13136
  protected _redirect: RedirectClient | undefined;
12814
13137
  constructor(options?: OpikApiClient.Options);
12815
13138
  get mcpOAuth(): McpOAuthClient;
13139
+ get systemAnalyticsQueries(): SystemAnalyticsQueriesClient;
12816
13140
  get systemUsage(): SystemUsageClient;
12817
13141
  get agentConfigs(): AgentConfigsClient;
13142
+ get agentInsights(): AgentInsightsClient;
12818
13143
  get aiSpend(): AiSpendClient;
12819
13144
  get alerts(): AlertsClient;
12820
13145
  get annotationQueues(): AnnotationQueuesClient;