@iblai/iblai-api 4.261.1-ai → 4.262.0-ai

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 (63) hide show
  1. package/dist/index.cjs.js +1575 -759
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +1573 -759
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.umd.js +1575 -759
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/types/index.d.ts +16 -1
  8. package/dist/types/models/LifecycleStageEnum.d.ts +14 -0
  9. package/dist/types/models/Mentor.d.ts +8 -0
  10. package/dist/types/models/MentorCreate.d.ts +8 -0
  11. package/dist/types/models/MentorFromTemplateWithSettingRequest.d.ts +2 -0
  12. package/dist/types/models/MentorSettings.d.ts +2 -0
  13. package/dist/types/models/MentorSettingsPublic.d.ts +2 -0
  14. package/dist/types/models/MentorSettingsRequest.d.ts +2 -0
  15. package/dist/types/models/Organization.d.ts +34 -0
  16. package/dist/types/models/PaginatedOrganizationList.d.ts +7 -0
  17. package/dist/types/models/PaginatedPersonList.d.ts +7 -0
  18. package/dist/types/models/PatchedMentorCreate.d.ts +8 -0
  19. package/dist/types/models/PatchedMentorSettings.d.ts +2 -0
  20. package/dist/types/models/PatchedOrganization.d.ts +34 -0
  21. package/dist/types/models/PatchedPerson.d.ts +73 -0
  22. package/dist/types/models/Person.d.ts +73 -0
  23. package/dist/types/models/PersonInviteConflict.d.ts +12 -0
  24. package/dist/types/models/PersonInviteRequest.d.ts +18 -0
  25. package/dist/types/models/PersonInviteResponse.d.ts +37 -0
  26. package/dist/types/models/PersonLinkUserRequest.d.ts +6 -0
  27. package/dist/types/models/PersonMergeRequest.d.ts +10 -0
  28. package/dist/types/models/PersonMergeResponse.d.ts +17 -0
  29. package/dist/types/services/AiMentorService.d.ts +362 -0
  30. package/dist/types/services/CrmService.d.ts +222 -0
  31. package/dist/types/services/OrganizationsService.d.ts +83 -0
  32. package/dist/types/services/PersonsService.d.ts +142 -0
  33. package/package.json +1 -1
  34. package/sdk_schema.yml +1907 -55
  35. package/src/core/OpenAPI.ts +1 -1
  36. package/src/index.ts +16 -1
  37. package/src/models/LifecycleStageEnum.ts +18 -0
  38. package/src/models/Mentor.ts +8 -0
  39. package/src/models/MentorCreate.ts +8 -0
  40. package/src/models/MentorFromTemplateWithSettingRequest.ts +2 -0
  41. package/src/models/MentorSettings.ts +2 -0
  42. package/src/models/MentorSettingsPublic.ts +2 -0
  43. package/src/models/MentorSettingsRequest.ts +2 -0
  44. package/src/models/Organization.ts +39 -0
  45. package/src/models/PaginatedOrganizationList.ts +12 -0
  46. package/src/models/PaginatedPersonList.ts +12 -0
  47. package/src/models/PatchedMentorCreate.ts +8 -0
  48. package/src/models/PatchedMentorSettings.ts +2 -0
  49. package/src/models/PatchedOrganization.ts +39 -0
  50. package/src/models/PatchedPerson.ts +78 -0
  51. package/src/models/Person.ts +78 -0
  52. package/src/models/PersonInviteConflict.ts +17 -0
  53. package/src/models/PersonInviteRequest.ts +23 -0
  54. package/src/models/PersonInviteResponse.ts +42 -0
  55. package/src/models/PersonLinkUserRequest.ts +11 -0
  56. package/src/models/PersonMergeRequest.ts +15 -0
  57. package/src/models/PersonMergeResponse.ts +22 -0
  58. package/src/services/AiMentorService.ts +860 -0
  59. package/src/services/CrmService.ts +481 -0
  60. package/src/services/OrganizationsService.ts +186 -0
  61. package/src/services/PersonsService.ts +304 -0
  62. package/dist/types/services/EvaluationsService.d.ts +0 -365
  63. package/src/services/EvaluationsService.ts +0 -869
package/dist/index.cjs.js CHANGED
@@ -110,7 +110,7 @@ class CancelablePromise {
110
110
 
111
111
  const OpenAPI = {
112
112
  BASE: 'https://base.manager.iblai.app',
113
- VERSION: '4.261.1-ai-plus',
113
+ VERSION: '4.262.0-ai-plus',
114
114
  WITH_CREDENTIALS: false,
115
115
  CREDENTIALS: 'include',
116
116
  TOKEN: undefined,
@@ -853,6 +853,26 @@ exports.KindEnum = void 0;
853
853
  KindEnum["HELP_REQUEST"] = "HelpRequest";
854
854
  })(exports.KindEnum || (exports.KindEnum = {}));
855
855
 
856
+ /* generated using openapi-typescript-codegen -- do not edit */
857
+ /* istanbul ignore file */
858
+ /* tslint:disable */
859
+ /* eslint-disable */
860
+ /**
861
+ * * `lead` - Lead
862
+ * * `qualified` - Qualified
863
+ * * `opportunity` - Opportunity
864
+ * * `customer` - Customer
865
+ * * `churned` - Churned
866
+ */
867
+ exports.LifecycleStageEnum = void 0;
868
+ (function (LifecycleStageEnum) {
869
+ LifecycleStageEnum["LEAD"] = "lead";
870
+ LifecycleStageEnum["QUALIFIED"] = "qualified";
871
+ LifecycleStageEnum["OPPORTUNITY"] = "opportunity";
872
+ LifecycleStageEnum["CUSTOMER"] = "customer";
873
+ LifecycleStageEnum["CHURNED"] = "churned";
874
+ })(exports.LifecycleStageEnum || (exports.LifecycleStageEnum = {}));
875
+
856
876
  /* generated using openapi-typescript-codegen -- do not edit */
857
877
  /* istanbul ignore file */
858
878
  /* tslint:disable */
@@ -20007,483 +20027,1107 @@ class AiMentorService {
20007
20027
  });
20008
20028
  }
20009
20029
  /**
20010
- * Retrieve the count of free usage credits available to a user.
20011
- *
20012
- * Args:
20013
- * request: The HTTP request.
20014
- * org: The organization/tenant identifier.
20015
- * user_id: The ID of the user to check free usage for.
20016
- *
20017
- * Returns:
20018
- * Response: The count of free usage credits available.
20019
- *
20020
- * Raises:
20021
- * NotFound: If the specified user does not exist.
20022
- * @returns FreeUsageCount
20023
- * @throws ApiError
20024
- */
20025
- static aiMentorOrgsUsersFreeUsageCountRetrieve({
20026
- org,
20027
- userId
20028
- }) {
20029
- return request(OpenAPI, {
20030
- method: 'GET',
20031
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/free-usage-count',
20032
- path: {
20033
- 'org': org,
20034
- 'user_id': userId
20035
- },
20036
- errors: {
20037
- 404: `User not found`
20038
- }
20039
- });
20040
- }
20041
- /**
20042
- * List all global memories for a user.
20043
- * @returns any No response body
20030
+ * List datasets
20031
+ * List datasets belonging to the tenant. Supports server-side filtering by name substring and creator email (matched against the cached `created_by_email` in Langfuse metadata).
20032
+ * @returns PaginatedDatasetList
20044
20033
  * @throws ApiError
20045
20034
  */
20046
- static aiMentorOrgsUsersGlobalMemoriesRetrieve({
20035
+ static evaluationsDatasetsList({
20047
20036
  org,
20048
20037
  userId,
20049
- content,
20050
- email,
20051
- endDate,
20052
- sessionId,
20053
- startDate
20038
+ limit,
20039
+ name,
20040
+ page,
20041
+ userEmail
20054
20042
  }) {
20055
20043
  return request(OpenAPI, {
20056
20044
  method: 'GET',
20057
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/global-memories/',
20045
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/',
20058
20046
  path: {
20059
20047
  'org': org,
20060
20048
  'user_id': userId
20061
20049
  },
20062
20050
  query: {
20063
- 'content': content,
20064
- 'email': email,
20065
- 'end_date': endDate,
20066
- 'session_id': sessionId,
20067
- 'start_date': startDate,
20068
- 'user_id': userId
20051
+ 'limit': limit,
20052
+ 'name': name,
20053
+ 'page': page,
20054
+ 'user_email': userEmail
20069
20055
  }
20070
20056
  });
20071
20057
  }
20072
20058
  /**
20073
- * Create a new global memory.
20074
- * @returns any No response body
20059
+ * Create a dataset
20060
+ * Create a Langfuse dataset under the tenant. The creator's `username` and `user_email` are captured into metadata so future list responses can attribute the row without an extra DB lookup.
20061
+ * @returns Dataset
20075
20062
  * @throws ApiError
20076
20063
  */
20077
- static aiMentorOrgsUsersGlobalMemoriesCreate({
20064
+ static aiMentorOrgsUsersEvaluationsDatasetsCreate({
20078
20065
  org,
20079
- userId
20066
+ userId,
20067
+ requestBody
20080
20068
  }) {
20081
20069
  return request(OpenAPI, {
20082
20070
  method: 'POST',
20083
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/global-memories/',
20071
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/',
20084
20072
  path: {
20085
20073
  'org': org,
20086
20074
  'user_id': userId
20075
+ },
20076
+ body: requestBody,
20077
+ mediaType: 'application/json',
20078
+ errors: {
20079
+ 400: `Validation error.`
20087
20080
  }
20088
20081
  });
20089
20082
  }
20090
20083
  /**
20091
- * Delete a global memory (user ownership check).
20092
- * @returns void
20084
+ * Retrieve a dataset
20085
+ * Get a single dataset by name.
20086
+ * @returns Dataset
20093
20087
  * @throws ApiError
20094
20088
  */
20095
- static aiMentorOrgsUsersGlobalMemoriesDestroy({
20096
- memoryId,
20089
+ static aiMentorOrgsUsersEvaluationsDatasetsRetrieve({
20090
+ datasetName,
20097
20091
  org,
20098
20092
  userId
20099
20093
  }) {
20100
20094
  return request(OpenAPI, {
20101
- method: 'DELETE',
20102
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/global-memories/{memory_id}/',
20095
+ method: 'GET',
20096
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/',
20103
20097
  path: {
20104
- 'memory_id': memoryId,
20098
+ 'dataset_name': datasetName,
20105
20099
  'org': org,
20106
20100
  'user_id': userId
20101
+ },
20102
+ errors: {
20103
+ 403: `Authenticated, but the resource belongs to another tenant.`,
20104
+ 404: `Not found within the tenant.`
20107
20105
  }
20108
20106
  });
20109
20107
  }
20110
20108
  /**
20111
- * Wires RBAC into a DRF view.
20112
- *
20113
- * Two responsibilities:
20114
- *
20115
- * 1. When RBAC is enabled, replace the view's `permission_classes` with
20116
- * `IsEdxAuthenticated` (the gate the RBAC layer assumes).
20117
- *
20118
- * 2. Detect server-to-server (Django auth) callers via `is_service_account`.
20119
- * Server-to-server tokens authenticate as Django auth users with no
20120
- * relationship to a platform EdxUser. The convention is "we trust this
20121
- * caller — bypass RBAC and serve the request."
20122
- *
20123
- * Combine it with the RBAC-disabled check at the top of `initial()` so
20124
- * the early exit skips all RBAC prep work:
20125
- *
20126
- * if not ConfigFlags.rbac_enabled() or self.is_service_account:
20127
- * return
20128
- *
20129
- * Use `is_service_account` at any other touch points where caller
20130
- * identity matters (queryset ownership filters, owner attribution on
20131
- * create, serializer context, etc.).
20132
- * @returns PaginatedGoogleAgentDetailList
20109
+ * List dataset items
20110
+ * List items in a dataset. Pass `?include_trace=true` to attach `trace_input` / `trace_output` for items linked to a source trace (one bulk ClickHouse query for the page — no per-row fan-out).
20111
+ * @returns PaginatedDatasetItemList
20133
20112
  * @throws ApiError
20134
20113
  */
20135
- static aiMentorOrgsUsersGoogleAgentsList({
20114
+ static evaluationsDatasetItemsList({
20115
+ datasetName,
20136
20116
  org,
20137
20117
  userId,
20118
+ includeTrace,
20119
+ limit,
20138
20120
  page,
20139
- pageSize
20121
+ status
20140
20122
  }) {
20141
20123
  return request(OpenAPI, {
20142
20124
  method: 'GET',
20143
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/',
20125
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/',
20144
20126
  path: {
20127
+ 'dataset_name': datasetName,
20145
20128
  'org': org,
20146
20129
  'user_id': userId
20147
20130
  },
20148
20131
  query: {
20132
+ 'include_trace': includeTrace,
20133
+ 'limit': limit,
20149
20134
  'page': page,
20150
- 'page_size': pageSize
20135
+ 'status': status
20136
+ },
20137
+ errors: {
20138
+ 404: `Not found within the tenant.`
20151
20139
  }
20152
20140
  });
20153
20141
  }
20154
20142
  /**
20155
- * Sample Request
20156
- * ```
20157
- * {"name": "my agent", "instruction": "you are a helpful agent",}
20158
- * ```
20159
- * @returns GoogleAgentDetail
20143
+ * Add dataset items
20144
+ * Add items to a dataset. Provide either an `items` array of `{input, expected_output}` objects OR a `trace_ids` array to seed items from existing traces (input/expected are then copied from the trace). Exactly one of the two must be present.
20145
+ * @returns DatasetItemBulkCreateResponse
20160
20146
  * @throws ApiError
20161
20147
  */
20162
- static aiMentorOrgsUsersGoogleAgentsCreate({
20148
+ static aiMentorOrgsUsersEvaluationsDatasetsItemsCreate({
20149
+ datasetName,
20163
20150
  org,
20164
20151
  userId,
20165
20152
  requestBody
20166
20153
  }) {
20167
20154
  return request(OpenAPI, {
20168
20155
  method: 'POST',
20169
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/',
20156
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/',
20170
20157
  path: {
20158
+ 'dataset_name': datasetName,
20171
20159
  'org': org,
20172
20160
  'user_id': userId
20173
20161
  },
20174
20162
  body: requestBody,
20175
- mediaType: 'application/json'
20163
+ mediaType: 'application/json',
20164
+ errors: {
20165
+ 400: `Validation error.`,
20166
+ 404: `Not found within the tenant.`
20167
+ }
20176
20168
  });
20177
20169
  }
20178
20170
  /**
20179
- * Wires RBAC into a DRF view.
20180
- *
20181
- * Two responsibilities:
20182
- *
20183
- * 1. When RBAC is enabled, replace the view's `permission_classes` with
20184
- * `IsEdxAuthenticated` (the gate the RBAC layer assumes).
20185
- *
20186
- * 2. Detect server-to-server (Django auth) callers via `is_service_account`.
20187
- * Server-to-server tokens authenticate as Django auth users with no
20188
- * relationship to a platform EdxUser. The convention is "we trust this
20189
- * caller — bypass RBAC and serve the request."
20190
- *
20191
- * Combine it with the RBAC-disabled check at the top of `initial()` so
20192
- * the early exit skips all RBAC prep work:
20193
- *
20194
- * if not ConfigFlags.rbac_enabled() or self.is_service_account:
20195
- * return
20196
- *
20197
- * Use `is_service_account` at any other touch points where caller
20198
- * identity matters (queryset ownership filters, owner attribution on
20199
- * create, serializer context, etc.).
20200
- * @returns GoogleAgentDetail
20171
+ * Retrieve a dataset item
20172
+ * Retrieve a single dataset item. `trace_input` / `trace_output` are always populated when the item has a `source_trace_id` (single-row case, no fan-out concern).
20173
+ * @returns DatasetItem
20201
20174
  * @throws ApiError
20202
20175
  */
20203
- static aiMentorOrgsUsersGoogleAgentsRetrieve({
20176
+ static aiMentorOrgsUsersEvaluationsDatasetsItemsRetrieve({
20177
+ datasetName,
20178
+ itemId,
20204
20179
  org,
20205
- uniqueId,
20206
20180
  userId
20207
20181
  }) {
20208
20182
  return request(OpenAPI, {
20209
20183
  method: 'GET',
20210
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/{unique_id}/',
20184
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/{item_id}/',
20211
20185
  path: {
20186
+ 'dataset_name': datasetName,
20187
+ 'item_id': itemId,
20212
20188
  'org': org,
20213
- 'unique_id': uniqueId,
20214
20189
  'user_id': userId
20190
+ },
20191
+ errors: {
20192
+ 404: `Not found within the tenant.`
20215
20193
  }
20216
20194
  });
20217
20195
  }
20218
20196
  /**
20219
- * Mainly used to update the sub agent list.
20220
- *
20221
- * Sample request:
20222
- * ```
20223
- * {
20224
- * "sub_agents": [
20225
- * "adc4bf84-c174-47e1-b11c-7713ef2dcd89",
20226
- * "3fb5806d-3be1-4bfd-bcb0-a48558465644",
20227
- * "339e44cd-6084-4530-be70-ac2a83759fb6"
20228
- * ]
20229
- * }
20230
- * ```
20231
- * @returns GoogleAgentDetail
20232
- * @throws ApiError
20233
- */
20234
- static aiMentorOrgsUsersGoogleAgentsPartialUpdate({
20197
+ * Update a dataset item
20198
+ * Update any subset of `input`, `expected_output`, `metadata`, or `status` on a dataset item. Uses Langfuse's id-based upsert.
20199
+ * @returns DatasetItem
20200
+ * @throws ApiError
20201
+ */
20202
+ static aiMentorOrgsUsersEvaluationsDatasetsItemsUpdate({
20203
+ datasetName,
20204
+ itemId,
20235
20205
  org,
20236
- uniqueId,
20237
20206
  userId,
20238
20207
  requestBody
20239
20208
  }) {
20240
20209
  return request(OpenAPI, {
20241
- method: 'PATCH',
20242
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/{unique_id}/',
20210
+ method: 'PUT',
20211
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/{item_id}/',
20243
20212
  path: {
20213
+ 'dataset_name': datasetName,
20214
+ 'item_id': itemId,
20244
20215
  'org': org,
20245
- 'unique_id': uniqueId,
20246
20216
  'user_id': userId
20247
20217
  },
20248
20218
  body: requestBody,
20249
- mediaType: 'application/json'
20219
+ mediaType: 'application/json',
20220
+ errors: {
20221
+ 400: `Validation error.`,
20222
+ 404: `Not found within the tenant.`
20223
+ }
20250
20224
  });
20251
20225
  }
20252
20226
  /**
20253
- * Wires RBAC into a DRF view.
20254
- *
20255
- * Two responsibilities:
20256
- *
20257
- * 1. When RBAC is enabled, replace the view's `permission_classes` with
20258
- * `IsEdxAuthenticated` (the gate the RBAC layer assumes).
20259
- *
20260
- * 2. Detect server-to-server (Django auth) callers via `is_service_account`.
20261
- * Server-to-server tokens authenticate as Django auth users with no
20262
- * relationship to a platform EdxUser. The convention is "we trust this
20263
- * caller — bypass RBAC and serve the request."
20264
- *
20265
- * Combine it with the RBAC-disabled check at the top of `initial()` so
20266
- * the early exit skips all RBAC prep work:
20267
- *
20268
- * if not ConfigFlags.rbac_enabled() or self.is_service_account:
20269
- * return
20270
- *
20271
- * Use `is_service_account` at any other touch points where caller
20272
- * identity matters (queryset ownership filters, owner attribution on
20273
- * create, serializer context, etc.).
20274
- * @returns void
20227
+ * Delete a dataset item
20228
+ * Queues the item for deletion in Langfuse. List/get endpoints hide this id immediately, but Langfuse's worker can take up to a few minutes to remove it from its own stores.
20229
+ * @returns any Deletion queued.
20275
20230
  * @throws ApiError
20276
20231
  */
20277
- static aiMentorOrgsUsersGoogleAgentsDestroy({
20232
+ static aiMentorOrgsUsersEvaluationsDatasetsItemsDestroy({
20233
+ datasetName,
20234
+ itemId,
20278
20235
  org,
20279
- uniqueId,
20280
20236
  userId
20281
20237
  }) {
20282
20238
  return request(OpenAPI, {
20283
20239
  method: 'DELETE',
20284
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/{unique_id}/',
20240
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/{item_id}/',
20285
20241
  path: {
20242
+ 'dataset_name': datasetName,
20243
+ 'item_id': itemId,
20286
20244
  'org': org,
20287
- 'unique_id': uniqueId,
20288
20245
  'user_id': userId
20246
+ },
20247
+ errors: {
20248
+ 404: `Not found within the tenant.`
20289
20249
  }
20290
20250
  });
20291
20251
  }
20292
20252
  /**
20293
- * Override list to handle object ownership.
20294
- *
20295
- * RBAC filtering may remove owned objects if no explicit permissions.
20296
- * This adds back user-scoped connections owned by the requesting user.
20297
- * @returns PaginatedMCPServerConnectionList
20253
+ * Upload a CSV of dataset items
20254
+ * Bulk-create items from a CSV (multipart `file` field). The CSV must have an `input` column; `expected_output` is optional. Rows with empty `input` are skipped.
20255
+ * @returns DatasetItemBulkCreateResponse
20298
20256
  * @throws ApiError
20299
20257
  */
20300
- static aiMentorOrgsUsersMcpServerConnectionsList({
20258
+ static aiMentorOrgsUsersEvaluationsDatasetsItemsUploadCreate({
20259
+ datasetName,
20301
20260
  org,
20302
20261
  userId,
20303
- authType,
20304
- isActive,
20305
- mentor,
20262
+ formData
20263
+ }) {
20264
+ return request(OpenAPI, {
20265
+ method: 'POST',
20266
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/upload/',
20267
+ path: {
20268
+ 'dataset_name': datasetName,
20269
+ 'org': org,
20270
+ 'user_id': userId
20271
+ },
20272
+ formData: formData,
20273
+ mediaType: 'multipart/form-data',
20274
+ errors: {
20275
+ 400: `Validation error.`,
20276
+ 404: `Not found within the tenant.`
20277
+ }
20278
+ });
20279
+ }
20280
+ /**
20281
+ * List experiment runs
20282
+ * List runs for a dataset. The response merges Langfuse-persisted runs with in-flight `EvaluationTaskRecord` rows (status `pending` / `in_progress`), deduplicated by `run_name`. `pending_count` reports how many pending entries are in the page so the UI can badge in-flight work.
20283
+ * @returns PaginatedRunList
20284
+ * @throws ApiError
20285
+ */
20286
+ static evaluationsRunsList({
20287
+ datasetName,
20288
+ org,
20289
+ userId,
20290
+ limit,
20291
+ name,
20306
20292
  page,
20307
- pageSize,
20308
- scope,
20309
- search,
20310
- server,
20311
- user
20293
+ userEmail
20312
20294
  }) {
20313
20295
  return request(OpenAPI, {
20314
20296
  method: 'GET',
20315
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/',
20297
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/',
20316
20298
  path: {
20299
+ 'dataset_name': datasetName,
20317
20300
  'org': org,
20318
20301
  'user_id': userId
20319
20302
  },
20320
20303
  query: {
20321
- 'auth_type': authType,
20322
- 'is_active': isActive,
20323
- 'mentor': mentor,
20304
+ 'limit': limit,
20305
+ 'name': name,
20324
20306
  'page': page,
20325
- 'page_size': pageSize,
20326
- 'scope': scope,
20327
- 'search': search,
20328
- 'server': server,
20329
- 'user': user
20307
+ 'user_email': userEmail
20308
+ },
20309
+ errors: {
20310
+ 404: `Not found within the tenant.`
20330
20311
  }
20331
20312
  });
20332
20313
  }
20333
20314
  /**
20334
- * ViewSet for MCP server connections.
20335
- *
20336
- * Tenant administrators can create user- or platform-scoped connections that
20337
- * encapsulate the authentication configuration for invoking an MCP server.
20338
- *
20339
- * RBAC Resource Hierarchy:
20340
- * MCPServerConnection is a subresource of MCPServer. Resource paths are:
20341
- * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
20342
- * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
20343
- * @returns MCPServerConnection
20315
+ * Start an experiment run
20316
+ * Dispatch a Celery task that runs the chosen mentor against every item in the dataset. Returns immediately (HTTP 202) with the new task record. Poll the list endpoint (or the run-detail endpoint once Langfuse persists the run) to watch the `pending → in_progress → completed` transition.
20317
+ * @returns Run
20344
20318
  * @throws ApiError
20345
20319
  */
20346
- static aiMentorOrgsUsersMcpServerConnectionsCreate({
20320
+ static aiMentorOrgsUsersEvaluationsDatasetsRunsCreate({
20321
+ datasetName,
20347
20322
  org,
20348
20323
  userId,
20349
20324
  requestBody
20350
20325
  }) {
20351
20326
  return request(OpenAPI, {
20352
20327
  method: 'POST',
20353
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/',
20328
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/',
20354
20329
  path: {
20330
+ 'dataset_name': datasetName,
20355
20331
  'org': org,
20356
20332
  'user_id': userId
20357
20333
  },
20358
20334
  body: requestBody,
20359
- mediaType: 'application/json'
20335
+ mediaType: 'application/json',
20336
+ errors: {
20337
+ 400: `Validation error.`,
20338
+ 404: `Dataset or mentor not found within the tenant.`
20339
+ }
20360
20340
  });
20361
20341
  }
20362
20342
  /**
20363
- * Override retrieve to pass is_owner to action enforcement.
20364
- * @returns MCPServerConnection
20343
+ * Retrieve experiment run details
20344
+ * Returns the run header plus every `dataset_run_item` fully expanded with `input`, `expected_output`, `actual_output`, `trace_id`, and per-item `scores`. Also embeds a `pending_judges` array for any in-flight LLM-as-Judge evaluations against this run.
20345
+ *
20346
+ * Cost: 1 PG query + 2 ClickHouse queries + 1 score query regardless of run size.
20347
+ * @returns RunDetailResponse
20365
20348
  * @throws ApiError
20366
20349
  */
20367
- static aiMentorOrgsUsersMcpServerConnectionsRetrieve({
20368
- id,
20350
+ static aiMentorOrgsUsersEvaluationsDatasetsRunsRetrieve({
20351
+ datasetName,
20369
20352
  org,
20353
+ runName,
20370
20354
  userId
20371
20355
  }) {
20372
20356
  return request(OpenAPI, {
20373
20357
  method: 'GET',
20374
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
20358
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/',
20375
20359
  path: {
20376
- 'id': id,
20360
+ 'dataset_name': datasetName,
20377
20361
  'org': org,
20362
+ 'run_name': runName,
20378
20363
  'user_id': userId
20364
+ },
20365
+ errors: {
20366
+ 403: `Authenticated, but the resource belongs to another tenant.`,
20367
+ 404: `Not found within the tenant.`
20379
20368
  }
20380
20369
  });
20381
20370
  }
20382
20371
  /**
20383
- * ViewSet for MCP server connections.
20384
- *
20385
- * Tenant administrators can create user- or platform-scoped connections that
20386
- * encapsulate the authentication configuration for invoking an MCP server.
20387
- *
20388
- * RBAC Resource Hierarchy:
20389
- * MCPServerConnection is a subresource of MCPServer. Resource paths are:
20390
- * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
20391
- * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
20392
- * @returns MCPServerConnection
20372
+ * Delete an experiment run
20373
+ * Queues the run for deletion in Langfuse. List/get endpoints hide this run immediately, but Langfuse's worker can take up to a few minutes to remove it from its own stores.
20374
+ * @returns any Deletion queued.
20393
20375
  * @throws ApiError
20394
20376
  */
20395
- static aiMentorOrgsUsersMcpServerConnectionsUpdate({
20396
- id,
20377
+ static aiMentorOrgsUsersEvaluationsDatasetsRunsDestroy({
20378
+ datasetName,
20397
20379
  org,
20398
- userId,
20399
- requestBody
20380
+ runName,
20381
+ userId
20400
20382
  }) {
20401
20383
  return request(OpenAPI, {
20402
- method: 'PUT',
20403
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
20384
+ method: 'DELETE',
20385
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/',
20404
20386
  path: {
20405
- 'id': id,
20387
+ 'dataset_name': datasetName,
20406
20388
  'org': org,
20389
+ 'run_name': runName,
20407
20390
  'user_id': userId
20408
20391
  },
20409
- body: requestBody,
20410
- mediaType: 'application/json'
20392
+ errors: {
20393
+ 403: `Authenticated, but the resource belongs to another tenant.`,
20394
+ 404: `Not found within the tenant.`
20395
+ }
20411
20396
  });
20412
20397
  }
20413
20398
  /**
20414
- * ViewSet for MCP server connections.
20415
- *
20416
- * Tenant administrators can create user- or platform-scoped connections that
20417
- * encapsulate the authentication configuration for invoking an MCP server.
20418
- *
20419
- * RBAC Resource Hierarchy:
20420
- * MCPServerConnection is a subresource of MCPServer. Resource paths are:
20421
- * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
20422
- * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
20423
- * @returns MCPServerConnection
20399
+ * List LLM-as-Judge evaluations for a run
20400
+ * Returns every judge task record (any status) targeting this run. Useful for showing an 'Evaluations' history on a run-detail view, including failed and pending ones.
20401
+ * @returns PaginatedJudgeList
20424
20402
  * @throws ApiError
20425
20403
  */
20426
- static aiMentorOrgsUsersMcpServerConnectionsPartialUpdate({
20427
- id,
20404
+ static evaluationsRunJudgesList({
20405
+ datasetName,
20428
20406
  org,
20407
+ runName,
20429
20408
  userId,
20430
- requestBody
20409
+ limit,
20410
+ page,
20411
+ status,
20412
+ userEmail
20431
20413
  }) {
20432
20414
  return request(OpenAPI, {
20433
- method: 'PATCH',
20434
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
20415
+ method: 'GET',
20416
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/evaluate/',
20435
20417
  path: {
20436
- 'id': id,
20418
+ 'dataset_name': datasetName,
20437
20419
  'org': org,
20420
+ 'run_name': runName,
20438
20421
  'user_id': userId
20439
20422
  },
20440
- body: requestBody,
20441
- mediaType: 'application/json'
20423
+ query: {
20424
+ 'limit': limit,
20425
+ 'page': page,
20426
+ 'status': status,
20427
+ 'user_email': userEmail
20428
+ }
20442
20429
  });
20443
20430
  }
20444
20431
  /**
20445
- * ViewSet for MCP server connections.
20446
- *
20447
- * Tenant administrators can create user- or platform-scoped connections that
20448
- * encapsulate the authentication configuration for invoking an MCP server.
20432
+ * Start an LLM-as-Judge evaluation
20433
+ * Dispatch a Celery task that runs a separate LLM over every item in the run, scoring the actual output against the input + expected output using the provided criteria. The judge's score lands in Langfuse with `score_name`, and its reasoning is stored in the score's `comment`.
20449
20434
  *
20450
- * RBAC Resource Hierarchy:
20451
- * MCPServerConnection is a subresource of MCPServer. Resource paths are:
20452
- * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
20453
- * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
20454
- * @returns void
20435
+ * Returns immediately (HTTP 202) with the new task record. The task transitions through `pending → in_progress → completed` (or `failed`); poll the list endpoint or the run-detail endpoint to watch.
20436
+ * @returns JudgeRecord
20455
20437
  * @throws ApiError
20456
20438
  */
20457
- static aiMentorOrgsUsersMcpServerConnectionsDestroy({
20458
- id,
20439
+ static evaluationsRunJudgeCreate({
20440
+ datasetName,
20459
20441
  org,
20460
- userId
20442
+ runName,
20443
+ userId,
20444
+ requestBody
20461
20445
  }) {
20462
20446
  return request(OpenAPI, {
20463
- method: 'DELETE',
20464
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
20447
+ method: 'POST',
20448
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/evaluate/',
20465
20449
  path: {
20466
- 'id': id,
20450
+ 'dataset_name': datasetName,
20467
20451
  'org': org,
20452
+ 'run_name': runName,
20468
20453
  'user_id': userId
20454
+ },
20455
+ body: requestBody,
20456
+ mediaType: 'application/json',
20457
+ errors: {
20458
+ 400: `Empty run or invalid input.`,
20459
+ 404: `Not found within the tenant.`
20469
20460
  }
20470
20461
  });
20471
20462
  }
20472
20463
  /**
20473
- * List MCP servers with mentor-scoped and platform-scoped filtering.
20474
- *
20475
- * Query Parameters:
20476
- * - mentor_unique_id (optional): Filter to mentor-scoped servers for this mentor
20477
- * - include_global (optional): Include platform-scoped servers (only with mentor_unique_id)
20478
- *
20479
- * RBAC Logic:
20480
- * - No params: Returns all accessible servers (owned + granted access + platform-scoped)
20481
- * - mentor_unique_id only: Returns mentor-scoped servers for that mentor
20482
- * - mentor_unique_id + include_global: Returns both mentor-scoped and platform-scoped servers
20483
- *
20484
- * Note: Queryset filtering is handled in get_queryset() since rbac_manager.enforce_list_data_access
20485
- * will call get_queryset() internally.
20486
- * @returns PaginatedMCPServerList
20464
+ * Export experiment results as CSV
20465
+ * Download the run as a CSV. Columns: `item_id`, `input`, `expected_output`, `trace_id`, `actual_output`, and one `score_<name>` column per distinct score name in the run.
20466
+ * @returns binary CSV file download.
20467
+ * @throws ApiError
20468
+ */
20469
+ static aiMentorOrgsUsersEvaluationsDatasetsRunsExportRetrieve({
20470
+ datasetName,
20471
+ org,
20472
+ runName,
20473
+ userId
20474
+ }) {
20475
+ return request(OpenAPI, {
20476
+ method: 'GET',
20477
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/export/',
20478
+ path: {
20479
+ 'dataset_name': datasetName,
20480
+ 'org': org,
20481
+ 'run_name': runName,
20482
+ 'user_id': userId
20483
+ },
20484
+ errors: {
20485
+ 403: `Authenticated, but the resource belongs to another tenant.`,
20486
+ 404: `Not found within the tenant.`
20487
+ }
20488
+ });
20489
+ }
20490
+ /**
20491
+ * List LLM-as-Judge evaluations (tenant-wide)
20492
+ * Returns every judge task record in the tenant, across all datasets and runs. Useful for a tenant-wide 'Evaluations' inbox.
20493
+ * @returns PaginatedJudgeList
20494
+ * @throws ApiError
20495
+ */
20496
+ static evaluationsJudgesGlobalList({
20497
+ org,
20498
+ userId,
20499
+ datasetName,
20500
+ limit,
20501
+ page,
20502
+ status,
20503
+ userEmail
20504
+ }) {
20505
+ return request(OpenAPI, {
20506
+ method: 'GET',
20507
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/judges/',
20508
+ path: {
20509
+ 'org': org,
20510
+ 'user_id': userId
20511
+ },
20512
+ query: {
20513
+ 'dataset_name': datasetName,
20514
+ 'limit': limit,
20515
+ 'page': page,
20516
+ 'status': status,
20517
+ 'user_email': userEmail
20518
+ }
20519
+ });
20520
+ }
20521
+ /**
20522
+ * List score configurations
20523
+ * Score configurations define reusable rubrics (numeric ranges, boolean, or categorical labels). They are optional — scores work without one — but useful for enforcing consistent grading.
20524
+ * @returns PaginatedScoreConfigList
20525
+ * @throws ApiError
20526
+ */
20527
+ static aiMentorOrgsUsersEvaluationsScoreConfigsRetrieve({
20528
+ org,
20529
+ userId,
20530
+ limit,
20531
+ page
20532
+ }) {
20533
+ return request(OpenAPI, {
20534
+ method: 'GET',
20535
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/score-configs/',
20536
+ path: {
20537
+ 'org': org,
20538
+ 'user_id': userId
20539
+ },
20540
+ query: {
20541
+ 'limit': limit,
20542
+ 'page': page
20543
+ }
20544
+ });
20545
+ }
20546
+ /**
20547
+ * Create a score configuration
20548
+ * Create a score configuration.
20549
+ * @returns ScoreConfig
20550
+ * @throws ApiError
20551
+ */
20552
+ static aiMentorOrgsUsersEvaluationsScoreConfigsCreate({
20553
+ org,
20554
+ userId,
20555
+ requestBody
20556
+ }) {
20557
+ return request(OpenAPI, {
20558
+ method: 'POST',
20559
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/score-configs/',
20560
+ path: {
20561
+ 'org': org,
20562
+ 'user_id': userId
20563
+ },
20564
+ body: requestBody,
20565
+ mediaType: 'application/json',
20566
+ errors: {
20567
+ 400: `Validation error.`
20568
+ }
20569
+ });
20570
+ }
20571
+ /**
20572
+ * List scores
20573
+ * List scores (human annotations and LLM-judge results) with optional filters. Pair `dataset_run_id` with a run id to scope to one experiment; pass `trace_id` to scope to a single chat turn or mentor invocation.
20574
+ * @returns PaginatedScoreList
20575
+ * @throws ApiError
20576
+ */
20577
+ static aiMentorOrgsUsersEvaluationsScoresRetrieve({
20578
+ org,
20579
+ userId,
20580
+ datasetRunId,
20581
+ limit,
20582
+ name,
20583
+ page,
20584
+ traceId,
20585
+ userEmail
20586
+ }) {
20587
+ return request(OpenAPI, {
20588
+ method: 'GET',
20589
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/scores/',
20590
+ path: {
20591
+ 'org': org,
20592
+ 'user_id': userId
20593
+ },
20594
+ query: {
20595
+ 'dataset_run_id': datasetRunId,
20596
+ 'limit': limit,
20597
+ 'name': name,
20598
+ 'page': page,
20599
+ 'trace_id': traceId,
20600
+ 'user_email': userEmail
20601
+ }
20602
+ });
20603
+ }
20604
+ /**
20605
+ * Create a score
20606
+ * Create a score on a trace or observation. Use this to record human grading of a single chat message (pass the chat frame's `generation_id` as `trace_id`) or to score an experiment-run item (also pass `dataset_run_id` so the score shows up in the run's CSV export).
20607
+ * @returns ScoreCreateResponse
20608
+ * @throws ApiError
20609
+ */
20610
+ static aiMentorOrgsUsersEvaluationsScoresCreate({
20611
+ org,
20612
+ userId,
20613
+ requestBody
20614
+ }) {
20615
+ return request(OpenAPI, {
20616
+ method: 'POST',
20617
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/scores/',
20618
+ path: {
20619
+ 'org': org,
20620
+ 'user_id': userId
20621
+ },
20622
+ body: requestBody,
20623
+ mediaType: 'application/json',
20624
+ errors: {
20625
+ 400: `Validation error.`
20626
+ }
20627
+ });
20628
+ }
20629
+ /**
20630
+ * Delete a score
20631
+ * Queues the score for deletion in Langfuse. The list endpoint hides this id immediately, but Langfuse's worker can take up to a few minutes to remove it from its own stores.
20632
+ * @returns any Deletion queued.
20633
+ * @throws ApiError
20634
+ */
20635
+ static aiMentorOrgsUsersEvaluationsScoresDestroy({
20636
+ org,
20637
+ scoreId,
20638
+ userId
20639
+ }) {
20640
+ return request(OpenAPI, {
20641
+ method: 'DELETE',
20642
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/scores/{score_id}/',
20643
+ path: {
20644
+ 'org': org,
20645
+ 'score_id': scoreId,
20646
+ 'user_id': userId
20647
+ },
20648
+ errors: {
20649
+ 404: `Not found within the tenant.`
20650
+ }
20651
+ });
20652
+ }
20653
+ /**
20654
+ * Retrieve the count of free usage credits available to a user.
20655
+ *
20656
+ * Args:
20657
+ * request: The HTTP request.
20658
+ * org: The organization/tenant identifier.
20659
+ * user_id: The ID of the user to check free usage for.
20660
+ *
20661
+ * Returns:
20662
+ * Response: The count of free usage credits available.
20663
+ *
20664
+ * Raises:
20665
+ * NotFound: If the specified user does not exist.
20666
+ * @returns FreeUsageCount
20667
+ * @throws ApiError
20668
+ */
20669
+ static aiMentorOrgsUsersFreeUsageCountRetrieve({
20670
+ org,
20671
+ userId
20672
+ }) {
20673
+ return request(OpenAPI, {
20674
+ method: 'GET',
20675
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/free-usage-count',
20676
+ path: {
20677
+ 'org': org,
20678
+ 'user_id': userId
20679
+ },
20680
+ errors: {
20681
+ 404: `User not found`
20682
+ }
20683
+ });
20684
+ }
20685
+ /**
20686
+ * List all global memories for a user.
20687
+ * @returns any No response body
20688
+ * @throws ApiError
20689
+ */
20690
+ static aiMentorOrgsUsersGlobalMemoriesRetrieve({
20691
+ org,
20692
+ userId,
20693
+ content,
20694
+ email,
20695
+ endDate,
20696
+ sessionId,
20697
+ startDate
20698
+ }) {
20699
+ return request(OpenAPI, {
20700
+ method: 'GET',
20701
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/global-memories/',
20702
+ path: {
20703
+ 'org': org,
20704
+ 'user_id': userId
20705
+ },
20706
+ query: {
20707
+ 'content': content,
20708
+ 'email': email,
20709
+ 'end_date': endDate,
20710
+ 'session_id': sessionId,
20711
+ 'start_date': startDate,
20712
+ 'user_id': userId
20713
+ }
20714
+ });
20715
+ }
20716
+ /**
20717
+ * Create a new global memory.
20718
+ * @returns any No response body
20719
+ * @throws ApiError
20720
+ */
20721
+ static aiMentorOrgsUsersGlobalMemoriesCreate({
20722
+ org,
20723
+ userId
20724
+ }) {
20725
+ return request(OpenAPI, {
20726
+ method: 'POST',
20727
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/global-memories/',
20728
+ path: {
20729
+ 'org': org,
20730
+ 'user_id': userId
20731
+ }
20732
+ });
20733
+ }
20734
+ /**
20735
+ * Delete a global memory (user ownership check).
20736
+ * @returns void
20737
+ * @throws ApiError
20738
+ */
20739
+ static aiMentorOrgsUsersGlobalMemoriesDestroy({
20740
+ memoryId,
20741
+ org,
20742
+ userId
20743
+ }) {
20744
+ return request(OpenAPI, {
20745
+ method: 'DELETE',
20746
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/global-memories/{memory_id}/',
20747
+ path: {
20748
+ 'memory_id': memoryId,
20749
+ 'org': org,
20750
+ 'user_id': userId
20751
+ }
20752
+ });
20753
+ }
20754
+ /**
20755
+ * Wires RBAC into a DRF view.
20756
+ *
20757
+ * Two responsibilities:
20758
+ *
20759
+ * 1. When RBAC is enabled, replace the view's `permission_classes` with
20760
+ * `IsEdxAuthenticated` (the gate the RBAC layer assumes).
20761
+ *
20762
+ * 2. Detect server-to-server (Django auth) callers via `is_service_account`.
20763
+ * Server-to-server tokens authenticate as Django auth users with no
20764
+ * relationship to a platform EdxUser. The convention is "we trust this
20765
+ * caller — bypass RBAC and serve the request."
20766
+ *
20767
+ * Combine it with the RBAC-disabled check at the top of `initial()` so
20768
+ * the early exit skips all RBAC prep work:
20769
+ *
20770
+ * if not ConfigFlags.rbac_enabled() or self.is_service_account:
20771
+ * return
20772
+ *
20773
+ * Use `is_service_account` at any other touch points where caller
20774
+ * identity matters (queryset ownership filters, owner attribution on
20775
+ * create, serializer context, etc.).
20776
+ * @returns PaginatedGoogleAgentDetailList
20777
+ * @throws ApiError
20778
+ */
20779
+ static aiMentorOrgsUsersGoogleAgentsList({
20780
+ org,
20781
+ userId,
20782
+ page,
20783
+ pageSize
20784
+ }) {
20785
+ return request(OpenAPI, {
20786
+ method: 'GET',
20787
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/',
20788
+ path: {
20789
+ 'org': org,
20790
+ 'user_id': userId
20791
+ },
20792
+ query: {
20793
+ 'page': page,
20794
+ 'page_size': pageSize
20795
+ }
20796
+ });
20797
+ }
20798
+ /**
20799
+ * Sample Request
20800
+ * ```
20801
+ * {"name": "my agent", "instruction": "you are a helpful agent",}
20802
+ * ```
20803
+ * @returns GoogleAgentDetail
20804
+ * @throws ApiError
20805
+ */
20806
+ static aiMentorOrgsUsersGoogleAgentsCreate({
20807
+ org,
20808
+ userId,
20809
+ requestBody
20810
+ }) {
20811
+ return request(OpenAPI, {
20812
+ method: 'POST',
20813
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/',
20814
+ path: {
20815
+ 'org': org,
20816
+ 'user_id': userId
20817
+ },
20818
+ body: requestBody,
20819
+ mediaType: 'application/json'
20820
+ });
20821
+ }
20822
+ /**
20823
+ * Wires RBAC into a DRF view.
20824
+ *
20825
+ * Two responsibilities:
20826
+ *
20827
+ * 1. When RBAC is enabled, replace the view's `permission_classes` with
20828
+ * `IsEdxAuthenticated` (the gate the RBAC layer assumes).
20829
+ *
20830
+ * 2. Detect server-to-server (Django auth) callers via `is_service_account`.
20831
+ * Server-to-server tokens authenticate as Django auth users with no
20832
+ * relationship to a platform EdxUser. The convention is "we trust this
20833
+ * caller — bypass RBAC and serve the request."
20834
+ *
20835
+ * Combine it with the RBAC-disabled check at the top of `initial()` so
20836
+ * the early exit skips all RBAC prep work:
20837
+ *
20838
+ * if not ConfigFlags.rbac_enabled() or self.is_service_account:
20839
+ * return
20840
+ *
20841
+ * Use `is_service_account` at any other touch points where caller
20842
+ * identity matters (queryset ownership filters, owner attribution on
20843
+ * create, serializer context, etc.).
20844
+ * @returns GoogleAgentDetail
20845
+ * @throws ApiError
20846
+ */
20847
+ static aiMentorOrgsUsersGoogleAgentsRetrieve({
20848
+ org,
20849
+ uniqueId,
20850
+ userId
20851
+ }) {
20852
+ return request(OpenAPI, {
20853
+ method: 'GET',
20854
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/{unique_id}/',
20855
+ path: {
20856
+ 'org': org,
20857
+ 'unique_id': uniqueId,
20858
+ 'user_id': userId
20859
+ }
20860
+ });
20861
+ }
20862
+ /**
20863
+ * Mainly used to update the sub agent list.
20864
+ *
20865
+ * Sample request:
20866
+ * ```
20867
+ * {
20868
+ * "sub_agents": [
20869
+ * "adc4bf84-c174-47e1-b11c-7713ef2dcd89",
20870
+ * "3fb5806d-3be1-4bfd-bcb0-a48558465644",
20871
+ * "339e44cd-6084-4530-be70-ac2a83759fb6"
20872
+ * ]
20873
+ * }
20874
+ * ```
20875
+ * @returns GoogleAgentDetail
20876
+ * @throws ApiError
20877
+ */
20878
+ static aiMentorOrgsUsersGoogleAgentsPartialUpdate({
20879
+ org,
20880
+ uniqueId,
20881
+ userId,
20882
+ requestBody
20883
+ }) {
20884
+ return request(OpenAPI, {
20885
+ method: 'PATCH',
20886
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/{unique_id}/',
20887
+ path: {
20888
+ 'org': org,
20889
+ 'unique_id': uniqueId,
20890
+ 'user_id': userId
20891
+ },
20892
+ body: requestBody,
20893
+ mediaType: 'application/json'
20894
+ });
20895
+ }
20896
+ /**
20897
+ * Wires RBAC into a DRF view.
20898
+ *
20899
+ * Two responsibilities:
20900
+ *
20901
+ * 1. When RBAC is enabled, replace the view's `permission_classes` with
20902
+ * `IsEdxAuthenticated` (the gate the RBAC layer assumes).
20903
+ *
20904
+ * 2. Detect server-to-server (Django auth) callers via `is_service_account`.
20905
+ * Server-to-server tokens authenticate as Django auth users with no
20906
+ * relationship to a platform EdxUser. The convention is "we trust this
20907
+ * caller — bypass RBAC and serve the request."
20908
+ *
20909
+ * Combine it with the RBAC-disabled check at the top of `initial()` so
20910
+ * the early exit skips all RBAC prep work:
20911
+ *
20912
+ * if not ConfigFlags.rbac_enabled() or self.is_service_account:
20913
+ * return
20914
+ *
20915
+ * Use `is_service_account` at any other touch points where caller
20916
+ * identity matters (queryset ownership filters, owner attribution on
20917
+ * create, serializer context, etc.).
20918
+ * @returns void
20919
+ * @throws ApiError
20920
+ */
20921
+ static aiMentorOrgsUsersGoogleAgentsDestroy({
20922
+ org,
20923
+ uniqueId,
20924
+ userId
20925
+ }) {
20926
+ return request(OpenAPI, {
20927
+ method: 'DELETE',
20928
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/google-agents/{unique_id}/',
20929
+ path: {
20930
+ 'org': org,
20931
+ 'unique_id': uniqueId,
20932
+ 'user_id': userId
20933
+ }
20934
+ });
20935
+ }
20936
+ /**
20937
+ * Override list to handle object ownership.
20938
+ *
20939
+ * RBAC filtering may remove owned objects if no explicit permissions.
20940
+ * This adds back user-scoped connections owned by the requesting user.
20941
+ * @returns PaginatedMCPServerConnectionList
20942
+ * @throws ApiError
20943
+ */
20944
+ static aiMentorOrgsUsersMcpServerConnectionsList({
20945
+ org,
20946
+ userId,
20947
+ authType,
20948
+ isActive,
20949
+ mentor,
20950
+ page,
20951
+ pageSize,
20952
+ scope,
20953
+ search,
20954
+ server,
20955
+ user
20956
+ }) {
20957
+ return request(OpenAPI, {
20958
+ method: 'GET',
20959
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/',
20960
+ path: {
20961
+ 'org': org,
20962
+ 'user_id': userId
20963
+ },
20964
+ query: {
20965
+ 'auth_type': authType,
20966
+ 'is_active': isActive,
20967
+ 'mentor': mentor,
20968
+ 'page': page,
20969
+ 'page_size': pageSize,
20970
+ 'scope': scope,
20971
+ 'search': search,
20972
+ 'server': server,
20973
+ 'user': user
20974
+ }
20975
+ });
20976
+ }
20977
+ /**
20978
+ * ViewSet for MCP server connections.
20979
+ *
20980
+ * Tenant administrators can create user- or platform-scoped connections that
20981
+ * encapsulate the authentication configuration for invoking an MCP server.
20982
+ *
20983
+ * RBAC Resource Hierarchy:
20984
+ * MCPServerConnection is a subresource of MCPServer. Resource paths are:
20985
+ * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
20986
+ * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
20987
+ * @returns MCPServerConnection
20988
+ * @throws ApiError
20989
+ */
20990
+ static aiMentorOrgsUsersMcpServerConnectionsCreate({
20991
+ org,
20992
+ userId,
20993
+ requestBody
20994
+ }) {
20995
+ return request(OpenAPI, {
20996
+ method: 'POST',
20997
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/',
20998
+ path: {
20999
+ 'org': org,
21000
+ 'user_id': userId
21001
+ },
21002
+ body: requestBody,
21003
+ mediaType: 'application/json'
21004
+ });
21005
+ }
21006
+ /**
21007
+ * Override retrieve to pass is_owner to action enforcement.
21008
+ * @returns MCPServerConnection
21009
+ * @throws ApiError
21010
+ */
21011
+ static aiMentorOrgsUsersMcpServerConnectionsRetrieve({
21012
+ id,
21013
+ org,
21014
+ userId
21015
+ }) {
21016
+ return request(OpenAPI, {
21017
+ method: 'GET',
21018
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
21019
+ path: {
21020
+ 'id': id,
21021
+ 'org': org,
21022
+ 'user_id': userId
21023
+ }
21024
+ });
21025
+ }
21026
+ /**
21027
+ * ViewSet for MCP server connections.
21028
+ *
21029
+ * Tenant administrators can create user- or platform-scoped connections that
21030
+ * encapsulate the authentication configuration for invoking an MCP server.
21031
+ *
21032
+ * RBAC Resource Hierarchy:
21033
+ * MCPServerConnection is a subresource of MCPServer. Resource paths are:
21034
+ * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
21035
+ * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
21036
+ * @returns MCPServerConnection
21037
+ * @throws ApiError
21038
+ */
21039
+ static aiMentorOrgsUsersMcpServerConnectionsUpdate({
21040
+ id,
21041
+ org,
21042
+ userId,
21043
+ requestBody
21044
+ }) {
21045
+ return request(OpenAPI, {
21046
+ method: 'PUT',
21047
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
21048
+ path: {
21049
+ 'id': id,
21050
+ 'org': org,
21051
+ 'user_id': userId
21052
+ },
21053
+ body: requestBody,
21054
+ mediaType: 'application/json'
21055
+ });
21056
+ }
21057
+ /**
21058
+ * ViewSet for MCP server connections.
21059
+ *
21060
+ * Tenant administrators can create user- or platform-scoped connections that
21061
+ * encapsulate the authentication configuration for invoking an MCP server.
21062
+ *
21063
+ * RBAC Resource Hierarchy:
21064
+ * MCPServerConnection is a subresource of MCPServer. Resource paths are:
21065
+ * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
21066
+ * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
21067
+ * @returns MCPServerConnection
21068
+ * @throws ApiError
21069
+ */
21070
+ static aiMentorOrgsUsersMcpServerConnectionsPartialUpdate({
21071
+ id,
21072
+ org,
21073
+ userId,
21074
+ requestBody
21075
+ }) {
21076
+ return request(OpenAPI, {
21077
+ method: 'PATCH',
21078
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
21079
+ path: {
21080
+ 'id': id,
21081
+ 'org': org,
21082
+ 'user_id': userId
21083
+ },
21084
+ body: requestBody,
21085
+ mediaType: 'application/json'
21086
+ });
21087
+ }
21088
+ /**
21089
+ * ViewSet for MCP server connections.
21090
+ *
21091
+ * Tenant administrators can create user- or platform-scoped connections that
21092
+ * encapsulate the authentication configuration for invoking an MCP server.
21093
+ *
21094
+ * RBAC Resource Hierarchy:
21095
+ * MCPServerConnection is a subresource of MCPServer. Resource paths are:
21096
+ * - Collection: /platforms/{platform_id}/mcpservers/{server_id}/connections/
21097
+ * - Object: /platforms/{platform_id}/mcpservers/{server_id}/connections/{connection_id}
21098
+ * @returns void
21099
+ * @throws ApiError
21100
+ */
21101
+ static aiMentorOrgsUsersMcpServerConnectionsDestroy({
21102
+ id,
21103
+ org,
21104
+ userId
21105
+ }) {
21106
+ return request(OpenAPI, {
21107
+ method: 'DELETE',
21108
+ url: '/api/ai-mentor/orgs/{org}/users/{user_id}/mcp-server-connections/{id}/',
21109
+ path: {
21110
+ 'id': id,
21111
+ 'org': org,
21112
+ 'user_id': userId
21113
+ }
21114
+ });
21115
+ }
21116
+ /**
21117
+ * List MCP servers with mentor-scoped and platform-scoped filtering.
21118
+ *
21119
+ * Query Parameters:
21120
+ * - mentor_unique_id (optional): Filter to mentor-scoped servers for this mentor
21121
+ * - include_global (optional): Include platform-scoped servers (only with mentor_unique_id)
21122
+ *
21123
+ * RBAC Logic:
21124
+ * - No params: Returns all accessible servers (owned + granted access + platform-scoped)
21125
+ * - mentor_unique_id only: Returns mentor-scoped servers for that mentor
21126
+ * - mentor_unique_id + include_global: Returns both mentor-scoped and platform-scoped servers
21127
+ *
21128
+ * Note: Queryset filtering is handled in get_queryset() since rbac_manager.enforce_list_data_access
21129
+ * will call get_queryset() internally.
21130
+ * @returns PaginatedMCPServerList
20487
21131
  * @throws ApiError
20488
21132
  */
20489
21133
  static aiMentorOrgsUsersMcpServersList({
@@ -43863,726 +44507,496 @@ class CreditsService {
43863
44507
  * @returns any No response body
43864
44508
  * @throws ApiError
43865
44509
  */
43866
- static creditsSampleActionCreate() {
43867
- return request(OpenAPI, {
43868
- method: 'POST',
43869
- url: '/credits/sample-action/'
43870
- });
43871
- }
43872
- }
43873
-
43874
- class CustomDomainsService {
43875
- /**
43876
- * API endpoint to get custom domains (public, no authentication or permission checks)
43877
- * @returns any No response body
43878
- * @throws ApiError
43879
- */
43880
- static customDomainsRetrieve() {
43881
- return request(OpenAPI, {
43882
- method: 'GET',
43883
- url: '/api/custom-domains/'
43884
- });
43885
- }
43886
- /**
43887
- * API endpoint to hard delete a custom domain
43888
- * @returns void
43889
- * @throws ApiError
43890
- */
43891
- static customDomainsDeleteDestroy({
43892
- domainId
43893
- }) {
43894
- return request(OpenAPI, {
43895
- method: 'DELETE',
43896
- url: '/api/custom-domains/{domain_id}/delete/',
43897
- path: {
43898
- 'domain_id': domainId
43899
- }
43900
- });
43901
- }
43902
- /**
43903
- * API endpoint to update the is_deleted status of a custom domain
43904
- * @returns any No response body
43905
- * @throws ApiError
43906
- */
43907
- static customDomainsDeletedStatusCreate({
43908
- domainId
43909
- }) {
43910
- return request(OpenAPI, {
43911
- method: 'POST',
43912
- url: '/api/custom-domains/{domain_id}/deleted-status/',
43913
- path: {
43914
- 'domain_id': domainId
43915
- }
43916
- });
43917
- }
43918
- /**
43919
- * API endpoint to update custom domain SPA type
43920
- * @returns any No response body
43921
- * @throws ApiError
43922
- */
43923
- static customDomainsStatusUpdate({
43924
- domainId
43925
- }) {
43926
- return request(OpenAPI, {
43927
- method: 'PUT',
43928
- url: '/api/custom-domains/{domain_id}/status/',
43929
- path: {
43930
- 'domain_id': domainId
43931
- }
43932
- });
43933
- }
43934
- /**
43935
- * API endpoint to update custom domain SPA type by domain name
43936
- * @returns any No response body
43937
- * @throws ApiError
43938
- */
43939
- static customDomainsByNameStatusUpdate({
43940
- domainName
43941
- }) {
43942
- return request(OpenAPI, {
43943
- method: 'PUT',
43944
- url: '/api/custom-domains/by-name/{domain_name}/status/',
43945
- path: {
43946
- 'domain_name': domainName
43947
- }
43948
- });
43949
- }
43950
- /**
43951
- * API endpoint to create a custom domain
43952
- * @returns any No response body
43953
- * @throws ApiError
43954
- */
43955
- static customDomainsCreateCreate() {
44510
+ static creditsSampleActionCreate() {
43956
44511
  return request(OpenAPI, {
43957
44512
  method: 'POST',
43958
- url: '/api/custom-domains/create/'
44513
+ url: '/credits/sample-action/'
43959
44514
  });
43960
44515
  }
43961
44516
  }
43962
44517
 
43963
- class EvaluationsService {
44518
+ class CrmService {
43964
44519
  /**
43965
- * List datasets
43966
- * List datasets belonging to the tenant. Supports server-side filtering by name substring and creator email (matched against the cached `created_by_email` in Langfuse metadata).
43967
- * @returns PaginatedDatasetList
44520
+ * List organizations
44521
+ * Returns a paginated list of organizations in your Platform. Supports filtering by `owner` and by `name` (case-insensitive substring match).
44522
+ *
44523
+ * **Required permission:** `Ibl.CRM/Organizations/list`.
44524
+ * @returns PaginatedOrganizationList
43968
44525
  * @throws ApiError
43969
44526
  */
43970
- static evaluationsDatasetsList({
43971
- org,
43972
- userId,
43973
- limit,
44527
+ static crmOrganizationsList({
43974
44528
  name,
44529
+ owner,
43975
44530
  page,
43976
- userEmail
44531
+ pageSize
43977
44532
  }) {
43978
44533
  return request(OpenAPI, {
43979
44534
  method: 'GET',
43980
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/',
43981
- path: {
43982
- 'org': org,
43983
- 'user_id': userId
43984
- },
44535
+ url: '/api/crm/organizations/',
43985
44536
  query: {
43986
- 'limit': limit,
43987
44537
  'name': name,
44538
+ 'owner': owner,
43988
44539
  'page': page,
43989
- 'user_email': userEmail
44540
+ 'page_size': pageSize
44541
+ },
44542
+ errors: {
44543
+ 401: `Authentication required.`,
44544
+ 403: `Missing required permission \`Ibl.CRM/Organizations/list\`.`
43990
44545
  }
43991
44546
  });
43992
44547
  }
43993
44548
  /**
43994
- * Create a dataset
43995
- * Create a Langfuse dataset under the tenant. The creator's `username` and `user_email` are captured into metadata so future list responses can attribute the row without an extra DB lookup.
43996
- * @returns Dataset
44549
+ * Create an organization
44550
+ * Creates a new organization in your Platform. The Platform is inferred from your credentials. `name` must be unique within your Platform.
44551
+ *
44552
+ * **Required permission:** `Ibl.CRM/Organizations/write`.
44553
+ * @returns Organization
43997
44554
  * @throws ApiError
43998
44555
  */
43999
- static aiMentorOrgsUsersEvaluationsDatasetsCreate({
44000
- org,
44001
- userId,
44556
+ static crmOrganizationsCreate({
44002
44557
  requestBody
44003
44558
  }) {
44004
44559
  return request(OpenAPI, {
44005
44560
  method: 'POST',
44006
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/',
44007
- path: {
44008
- 'org': org,
44009
- 'user_id': userId
44010
- },
44561
+ url: '/api/crm/organizations/',
44011
44562
  body: requestBody,
44012
44563
  mediaType: 'application/json',
44013
44564
  errors: {
44014
- 400: `Validation error.`
44015
- }
44016
- });
44017
- }
44018
- /**
44019
- * Retrieve a dataset
44020
- * Get a single dataset by name.
44021
- * @returns Dataset
44022
- * @throws ApiError
44023
- */
44024
- static aiMentorOrgsUsersEvaluationsDatasetsRetrieve({
44025
- datasetName,
44026
- org,
44027
- userId
44028
- }) {
44029
- return request(OpenAPI, {
44030
- method: 'GET',
44031
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/',
44032
- path: {
44033
- 'dataset_name': datasetName,
44034
- 'org': org,
44035
- 'user_id': userId
44036
- },
44037
- errors: {
44038
- 403: `Authenticated, but the resource belongs to another tenant.`,
44039
- 404: `Not found within the tenant.`
44565
+ 400: `Validation error (for example, duplicate name).`,
44566
+ 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`
44040
44567
  }
44041
44568
  });
44042
44569
  }
44043
44570
  /**
44044
- * List dataset items
44045
- * List items in a dataset. Pass `?include_trace=true` to attach `trace_input` / `trace_output` for items linked to a source trace (one bulk ClickHouse query for the page — no per-row fan-out).
44046
- * @returns PaginatedDatasetItemList
44571
+ * Retrieve an organization
44572
+ * Returns a single organization by id.
44573
+ *
44574
+ * **Required permission:** `Ibl.CRM/Organizations/read`.
44575
+ * @returns Organization
44047
44576
  * @throws ApiError
44048
44577
  */
44049
- static evaluationsDatasetItemsList({
44050
- datasetName,
44051
- org,
44052
- userId,
44053
- includeTrace,
44054
- limit,
44055
- page,
44056
- status
44578
+ static crmOrganizationsRetrieve({
44579
+ id
44057
44580
  }) {
44058
44581
  return request(OpenAPI, {
44059
44582
  method: 'GET',
44060
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/',
44583
+ url: '/api/crm/organizations/{id}/',
44061
44584
  path: {
44062
- 'dataset_name': datasetName,
44063
- 'org': org,
44064
- 'user_id': userId
44065
- },
44066
- query: {
44067
- 'include_trace': includeTrace,
44068
- 'limit': limit,
44069
- 'page': page,
44070
- 'status': status
44585
+ 'id': id
44071
44586
  },
44072
44587
  errors: {
44073
- 404: `Not found within the tenant.`
44588
+ 403: `Missing required permission \`Ibl.CRM/Organizations/read\`.`,
44589
+ 404: `Organization not found.`
44074
44590
  }
44075
44591
  });
44076
44592
  }
44077
44593
  /**
44078
- * Add dataset items
44079
- * Add items to a dataset. Provide either an `items` array of `{input, expected_output}` objects OR a `trace_ids` array to seed items from existing traces (input/expected are then copied from the trace). Exactly one of the two must be present.
44080
- * @returns DatasetItemBulkCreateResponse
44594
+ * Replace an organization
44595
+ * Replaces all editable fields on the organization.
44596
+ *
44597
+ * **Required permission:** `Ibl.CRM/Organizations/write`.
44598
+ * @returns Organization
44081
44599
  * @throws ApiError
44082
44600
  */
44083
- static aiMentorOrgsUsersEvaluationsDatasetsItemsCreate({
44084
- datasetName,
44085
- org,
44086
- userId,
44601
+ static crmOrganizationsUpdate({
44602
+ id,
44087
44603
  requestBody
44088
44604
  }) {
44089
44605
  return request(OpenAPI, {
44090
- method: 'POST',
44091
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/',
44606
+ method: 'PUT',
44607
+ url: '/api/crm/organizations/{id}/',
44092
44608
  path: {
44093
- 'dataset_name': datasetName,
44094
- 'org': org,
44095
- 'user_id': userId
44609
+ 'id': id
44096
44610
  },
44097
44611
  body: requestBody,
44098
44612
  mediaType: 'application/json',
44099
44613
  errors: {
44100
44614
  400: `Validation error.`,
44101
- 404: `Not found within the tenant.`
44615
+ 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
44616
+ 404: `Organization not found.`
44102
44617
  }
44103
44618
  });
44104
44619
  }
44105
44620
  /**
44106
- * Retrieve a dataset item
44107
- * Retrieve a single dataset item. `trace_input` / `trace_output` are always populated when the item has a `source_trace_id` (single-row case, no fan-out concern).
44108
- * @returns DatasetItem
44621
+ * Update an organization
44622
+ * Updates only the supplied fields on the organization.
44623
+ *
44624
+ * **Required permission:** `Ibl.CRM/Organizations/write`.
44625
+ * @returns Organization
44109
44626
  * @throws ApiError
44110
44627
  */
44111
- static aiMentorOrgsUsersEvaluationsDatasetsItemsRetrieve({
44112
- datasetName,
44113
- itemId,
44114
- org,
44115
- userId
44628
+ static crmOrganizationsPartialUpdate({
44629
+ id,
44630
+ requestBody
44116
44631
  }) {
44117
44632
  return request(OpenAPI, {
44118
- method: 'GET',
44119
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/{item_id}/',
44633
+ method: 'PATCH',
44634
+ url: '/api/crm/organizations/{id}/',
44120
44635
  path: {
44121
- 'dataset_name': datasetName,
44122
- 'item_id': itemId,
44123
- 'org': org,
44124
- 'user_id': userId
44636
+ 'id': id
44125
44637
  },
44638
+ body: requestBody,
44639
+ mediaType: 'application/json',
44126
44640
  errors: {
44127
- 404: `Not found within the tenant.`
44641
+ 400: `Validation error.`,
44642
+ 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
44643
+ 404: `Organization not found.`
44128
44644
  }
44129
44645
  });
44130
44646
  }
44131
44647
  /**
44132
- * Update a dataset item
44133
- * Update any subset of `input`, `expected_output`, `metadata`, or `status` on a dataset item. Uses Langfuse's id-based upsert.
44134
- * @returns DatasetItem
44648
+ * Delete an organization
44649
+ * Deletes the organization. Any persons linked to it are kept; their organization reference is cleared.
44650
+ *
44651
+ * **Required permission:** `Ibl.CRM/Organizations/delete`.
44652
+ * @returns void
44135
44653
  * @throws ApiError
44136
44654
  */
44137
- static aiMentorOrgsUsersEvaluationsDatasetsItemsUpdate({
44138
- datasetName,
44139
- itemId,
44140
- org,
44141
- userId,
44142
- requestBody
44655
+ static crmOrganizationsDestroy({
44656
+ id
44143
44657
  }) {
44144
44658
  return request(OpenAPI, {
44145
- method: 'PUT',
44146
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/{item_id}/',
44659
+ method: 'DELETE',
44660
+ url: '/api/crm/organizations/{id}/',
44147
44661
  path: {
44148
- 'dataset_name': datasetName,
44149
- 'item_id': itemId,
44150
- 'org': org,
44151
- 'user_id': userId
44662
+ 'id': id
44152
44663
  },
44153
- body: requestBody,
44154
- mediaType: 'application/json',
44155
44664
  errors: {
44156
- 400: `Validation error.`,
44157
- 404: `Not found within the tenant.`
44665
+ 403: `Missing required permission \`Ibl.CRM/Organizations/delete\`.`,
44666
+ 404: `Organization not found.`
44158
44667
  }
44159
44668
  });
44160
44669
  }
44161
44670
  /**
44162
- * Delete a dataset item
44163
- * Queues the item for deletion in Langfuse. List/get endpoints hide this id immediately, but Langfuse's worker can take up to a few minutes to remove it from its own stores.
44164
- * @returns any Deletion queued.
44671
+ * List persons
44672
+ * Returns a paginated list of persons in your Platform. Supports filtering by `lifecycle_stage`, `owner`, `organization`, `created_at__gte`/`created_at__lte`, and `metadata__has_key`.
44673
+ *
44674
+ * **Required permission:** `Ibl.CRM/Persons/list`.
44675
+ * @returns PaginatedPersonList
44165
44676
  * @throws ApiError
44166
44677
  */
44167
- static aiMentorOrgsUsersEvaluationsDatasetsItemsDestroy({
44168
- datasetName,
44169
- itemId,
44170
- org,
44171
- userId
44678
+ static crmPersonsList({
44679
+ createdAtGte,
44680
+ createdAtLte,
44681
+ lifecycleStage,
44682
+ metadataHasKey,
44683
+ organization,
44684
+ owner,
44685
+ page,
44686
+ pageSize
44172
44687
  }) {
44173
44688
  return request(OpenAPI, {
44174
- method: 'DELETE',
44175
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/{item_id}/',
44176
- path: {
44177
- 'dataset_name': datasetName,
44178
- 'item_id': itemId,
44179
- 'org': org,
44180
- 'user_id': userId
44689
+ method: 'GET',
44690
+ url: '/api/crm/persons/',
44691
+ query: {
44692
+ 'created_at__gte': createdAtGte,
44693
+ 'created_at__lte': createdAtLte,
44694
+ 'lifecycle_stage': lifecycleStage,
44695
+ 'metadata__has_key': metadataHasKey,
44696
+ 'organization': organization,
44697
+ 'owner': owner,
44698
+ 'page': page,
44699
+ 'page_size': pageSize
44181
44700
  },
44182
44701
  errors: {
44183
- 404: `Not found within the tenant.`
44702
+ 401: `Authentication required.`,
44703
+ 403: `Missing required permission \`Ibl.CRM/Persons/list\`.`
44184
44704
  }
44185
44705
  });
44186
44706
  }
44187
44707
  /**
44188
- * Upload a CSV of dataset items
44189
- * Bulk-create items from a CSV (multipart `file` field). The CSV must have an `input` column; `expected_output` is optional. Rows with empty `input` are skipped.
44190
- * @returns DatasetItemBulkCreateResponse
44708
+ * Create a person
44709
+ * Creates a new person in your Platform. The Platform is inferred from your credentials. If `organization` is supplied, it must reference an organization in your Platform.
44710
+ *
44711
+ * **Required permission:** `Ibl.CRM/Persons/write`.
44712
+ * @returns Person
44191
44713
  * @throws ApiError
44192
44714
  */
44193
- static aiMentorOrgsUsersEvaluationsDatasetsItemsUploadCreate({
44194
- datasetName,
44195
- org,
44196
- userId,
44197
- formData
44715
+ static crmPersonsCreate({
44716
+ requestBody
44198
44717
  }) {
44199
44718
  return request(OpenAPI, {
44200
44719
  method: 'POST',
44201
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/items/upload/',
44202
- path: {
44203
- 'dataset_name': datasetName,
44204
- 'org': org,
44205
- 'user_id': userId
44206
- },
44207
- formData: formData,
44208
- mediaType: 'multipart/form-data',
44720
+ url: '/api/crm/persons/',
44721
+ body: requestBody,
44722
+ mediaType: 'application/json',
44209
44723
  errors: {
44210
44724
  400: `Validation error.`,
44211
- 404: `Not found within the tenant.`
44725
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`
44212
44726
  }
44213
44727
  });
44214
44728
  }
44215
44729
  /**
44216
- * List experiment runs
44217
- * List runs for a dataset. The response merges Langfuse-persisted runs with in-flight `EvaluationTaskRecord` rows (status `pending` / `in_progress`), deduplicated by `run_name`. `pending_count` reports how many pending entries are in the page so the UI can badge in-flight work.
44218
- * @returns PaginatedRunList
44730
+ * Retrieve a person
44731
+ * Returns a single person by id.
44732
+ *
44733
+ * **Required permission:** `Ibl.CRM/Persons/read`.
44734
+ * @returns Person
44219
44735
  * @throws ApiError
44220
44736
  */
44221
- static evaluationsRunsList({
44222
- datasetName,
44223
- org,
44224
- userId,
44225
- limit,
44226
- name,
44227
- page,
44228
- userEmail
44737
+ static crmPersonsRetrieve({
44738
+ id
44229
44739
  }) {
44230
44740
  return request(OpenAPI, {
44231
44741
  method: 'GET',
44232
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/',
44742
+ url: '/api/crm/persons/{id}/',
44233
44743
  path: {
44234
- 'dataset_name': datasetName,
44235
- 'org': org,
44236
- 'user_id': userId
44237
- },
44238
- query: {
44239
- 'limit': limit,
44240
- 'name': name,
44241
- 'page': page,
44242
- 'user_email': userEmail
44744
+ 'id': id
44243
44745
  },
44244
44746
  errors: {
44245
- 404: `Not found within the tenant.`
44747
+ 403: `Missing required permission \`Ibl.CRM/Persons/read\`.`,
44748
+ 404: `Person not found.`
44246
44749
  }
44247
44750
  });
44248
44751
  }
44249
44752
  /**
44250
- * Start an experiment run
44251
- * Dispatch a Celery task that runs the chosen mentor against every item in the dataset. Returns immediately (HTTP 202) with the new task record. Poll the list endpoint (or the run-detail endpoint once Langfuse persists the run) to watch the `pending → in_progress → completed` transition.
44252
- * @returns Run
44753
+ * Replace a person
44754
+ * Replaces all editable fields on the person.
44755
+ *
44756
+ * **Required permission:** `Ibl.CRM/Persons/write`.
44757
+ * @returns Person
44253
44758
  * @throws ApiError
44254
44759
  */
44255
- static aiMentorOrgsUsersEvaluationsDatasetsRunsCreate({
44256
- datasetName,
44257
- org,
44258
- userId,
44760
+ static crmPersonsUpdate({
44761
+ id,
44259
44762
  requestBody
44260
44763
  }) {
44261
44764
  return request(OpenAPI, {
44262
- method: 'POST',
44263
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/',
44765
+ method: 'PUT',
44766
+ url: '/api/crm/persons/{id}/',
44264
44767
  path: {
44265
- 'dataset_name': datasetName,
44266
- 'org': org,
44267
- 'user_id': userId
44768
+ 'id': id
44268
44769
  },
44269
44770
  body: requestBody,
44270
44771
  mediaType: 'application/json',
44271
44772
  errors: {
44272
44773
  400: `Validation error.`,
44273
- 404: `Dataset or mentor not found within the tenant.`
44774
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
44775
+ 404: `Person not found.`
44274
44776
  }
44275
44777
  });
44276
44778
  }
44277
44779
  /**
44278
- * Retrieve experiment run details
44279
- * Returns the run header plus every `dataset_run_item` fully expanded with `input`, `expected_output`, `actual_output`, `trace_id`, and per-item `scores`. Also embeds a `pending_judges` array for any in-flight LLM-as-Judge evaluations against this run.
44780
+ * Update a person
44781
+ * Updates only the supplied fields on the person.
44280
44782
  *
44281
- * Cost: 1 PG query + 2 ClickHouse queries + 1 score query regardless of run size.
44282
- * @returns RunDetailResponse
44783
+ * **Required permission:** `Ibl.CRM/Persons/write`.
44784
+ * @returns Person
44283
44785
  * @throws ApiError
44284
44786
  */
44285
- static aiMentorOrgsUsersEvaluationsDatasetsRunsRetrieve({
44286
- datasetName,
44287
- org,
44288
- runName,
44289
- userId
44787
+ static crmPersonsPartialUpdate({
44788
+ id,
44789
+ requestBody
44290
44790
  }) {
44291
44791
  return request(OpenAPI, {
44292
- method: 'GET',
44293
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/',
44792
+ method: 'PATCH',
44793
+ url: '/api/crm/persons/{id}/',
44294
44794
  path: {
44295
- 'dataset_name': datasetName,
44296
- 'org': org,
44297
- 'run_name': runName,
44298
- 'user_id': userId
44795
+ 'id': id
44299
44796
  },
44797
+ body: requestBody,
44798
+ mediaType: 'application/json',
44300
44799
  errors: {
44301
- 403: `Authenticated, but the resource belongs to another tenant.`,
44302
- 404: `Not found within the tenant.`
44800
+ 400: `Validation error.`,
44801
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
44802
+ 404: `Person not found.`
44303
44803
  }
44304
44804
  });
44305
44805
  }
44306
44806
  /**
44307
- * Delete an experiment run
44308
- * Queues the run for deletion in Langfuse. List/get endpoints hide this run immediately, but Langfuse's worker can take up to a few minutes to remove it from its own stores.
44309
- * @returns any Deletion queued.
44807
+ * Delete a person
44808
+ * Deletes the person.
44809
+ *
44810
+ * **Required permission:** `Ibl.CRM/Persons/delete`.
44811
+ * @returns void
44310
44812
  * @throws ApiError
44311
44813
  */
44312
- static aiMentorOrgsUsersEvaluationsDatasetsRunsDestroy({
44313
- datasetName,
44314
- org,
44315
- runName,
44316
- userId
44814
+ static crmPersonsDestroy({
44815
+ id
44317
44816
  }) {
44318
44817
  return request(OpenAPI, {
44319
44818
  method: 'DELETE',
44320
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/',
44819
+ url: '/api/crm/persons/{id}/',
44321
44820
  path: {
44322
- 'dataset_name': datasetName,
44323
- 'org': org,
44324
- 'run_name': runName,
44325
- 'user_id': userId
44821
+ 'id': id
44326
44822
  },
44327
44823
  errors: {
44328
- 403: `Authenticated, but the resource belongs to another tenant.`,
44329
- 404: `Not found within the tenant.`
44824
+ 403: `Missing required permission \`Ibl.CRM/Persons/delete\`.`,
44825
+ 404: `Person not found.`
44330
44826
  }
44331
44827
  });
44332
44828
  }
44333
44829
  /**
44334
- * List LLM-as-Judge evaluations for a run
44335
- * Returns every judge task record (any status) targeting this run. Useful for showing an 'Evaluations' history on a run-detail view, including failed and pending ones.
44336
- * @returns PaginatedJudgeList
44830
+ * Invite a person to the platform
44831
+ * Sends a platform invitation to the person's `primary_email`. On acceptance, the invitee joins your Platform with the privileges configured in the request body.
44832
+ *
44833
+ * Returns `409 Conflict` if an active invitation already exists for this email in your Platform, and `422 Unprocessable Entity` if the person is already linked to a platform user.
44834
+ *
44835
+ * **Required permission:** `Ibl.CRM/Invite/action`.
44836
+ * @returns PersonInviteResponse
44337
44837
  * @throws ApiError
44338
44838
  */
44339
- static evaluationsRunJudgesList({
44340
- datasetName,
44341
- org,
44342
- runName,
44343
- userId,
44344
- limit,
44345
- page,
44346
- status,
44347
- userEmail
44839
+ static crmPersonsInviteCreate({
44840
+ id,
44841
+ requestBody
44348
44842
  }) {
44349
44843
  return request(OpenAPI, {
44350
- method: 'GET',
44351
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/evaluate/',
44844
+ method: 'POST',
44845
+ url: '/api/crm/persons/{id}/invite/',
44352
44846
  path: {
44353
- 'dataset_name': datasetName,
44354
- 'org': org,
44355
- 'run_name': runName,
44356
- 'user_id': userId
44847
+ 'id': id
44357
44848
  },
44358
- query: {
44359
- 'limit': limit,
44360
- 'page': page,
44361
- 'status': status,
44362
- 'user_email': userEmail
44849
+ body: requestBody,
44850
+ mediaType: 'application/json',
44851
+ errors: {
44852
+ 400: `Person has no \`primary_email\`; cannot invite.`,
44853
+ 403: `Missing required permission \`Ibl.CRM/Invite/action\`.`,
44854
+ 404: `Person not found.`,
44855
+ 422: `Person is already linked to a platform user.`
44363
44856
  }
44364
44857
  });
44365
44858
  }
44366
44859
  /**
44367
- * Start an LLM-as-Judge evaluation
44368
- * Dispatch a Celery task that runs a separate LLM over every item in the run, scoring the actual output against the input + expected output using the provided criteria. The judge's score lands in Langfuse with `score_name`, and its reasoning is stored in the score's `comment`.
44860
+ * Bind a person to an existing platform user
44861
+ * Links this person to an existing platform user. The target user must already be a member of your Platform if they are not, send them an invitation via `POST /persons/{id}/invite/` instead.
44369
44862
  *
44370
- * Returns immediately (HTTP 202) with the new task record. The task transitions through `pending in_progress completed` (or `failed`); poll the list endpoint or the run-detail endpoint to watch.
44371
- * @returns JudgeRecord
44863
+ * This call is idempotent: linking a person that is already bound to the same user is a no-op. Re-linking a person that is already bound to a *different* user is refused; the existing binding is preserved and the unchanged person is returned.
44864
+ *
44865
+ * **Required permission:** `Ibl.CRM/Persons/write`.
44866
+ * @returns Person
44372
44867
  * @throws ApiError
44373
44868
  */
44374
- static evaluationsRunJudgeCreate({
44375
- datasetName,
44376
- org,
44377
- runName,
44378
- userId,
44869
+ static crmPersonsLinkUserCreate({
44870
+ id,
44379
44871
  requestBody
44380
44872
  }) {
44381
44873
  return request(OpenAPI, {
44382
44874
  method: 'POST',
44383
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/evaluate/',
44875
+ url: '/api/crm/persons/{id}/link-user/',
44384
44876
  path: {
44385
- 'dataset_name': datasetName,
44386
- 'org': org,
44387
- 'run_name': runName,
44388
- 'user_id': userId
44877
+ 'id': id
44389
44878
  },
44390
44879
  body: requestBody,
44391
44880
  mediaType: 'application/json',
44392
44881
  errors: {
44393
- 400: `Empty run or invalid input.`,
44394
- 404: `Not found within the tenant.`
44882
+ 400: `Validation error.`,
44883
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`, or the target user is not a member of your Platform.`,
44884
+ 404: `Person or user not found.`
44395
44885
  }
44396
44886
  });
44397
44887
  }
44398
44888
  /**
44399
- * Export experiment results as CSV
44400
- * Download the run as a CSV. Columns: `item_id`, `input`, `expected_output`, `trace_id`, `actual_output`, and one `score_<name>` column per distinct score name in the run.
44401
- * @returns binary CSV file download.
44889
+ * Merge duplicate persons into a primary
44890
+ * Marks each person in `duplicate_ids` as inactive and reports how many related records (deals, activities, tags) were re-parented onto `primary_id`.
44891
+ *
44892
+ * All ids — both the primary and every duplicate — must belong to your Platform. `primary_id` may not appear in `duplicate_ids`.
44893
+ *
44894
+ * **Required permission:** `Ibl.CRM/Persons/write`.
44895
+ * @returns PersonMergeResponse
44402
44896
  * @throws ApiError
44403
44897
  */
44404
- static aiMentorOrgsUsersEvaluationsDatasetsRunsExportRetrieve({
44405
- datasetName,
44406
- org,
44407
- runName,
44408
- userId
44898
+ static crmPersonsMergeCreate({
44899
+ requestBody
44409
44900
  }) {
44410
44901
  return request(OpenAPI, {
44411
- method: 'GET',
44412
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/datasets/{dataset_name}/runs/{run_name}/export/',
44413
- path: {
44414
- 'dataset_name': datasetName,
44415
- 'org': org,
44416
- 'run_name': runName,
44417
- 'user_id': userId
44418
- },
44902
+ method: 'POST',
44903
+ url: '/api/crm/persons/merge/',
44904
+ body: requestBody,
44905
+ mediaType: 'application/json',
44419
44906
  errors: {
44420
- 403: `Authenticated, but the resource belongs to another tenant.`,
44421
- 404: `Not found within the tenant.`
44907
+ 400: `Validation error: the primary appears in duplicates, or one or more ids belong to another Platform.`,
44908
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
44909
+ 404: `Primary person not found.`
44422
44910
  }
44423
44911
  });
44424
44912
  }
44913
+ }
44914
+
44915
+ class CustomDomainsService {
44425
44916
  /**
44426
- * List LLM-as-Judge evaluations (tenant-wide)
44427
- * Returns every judge task record in the tenant, across all datasets and runs. Useful for a tenant-wide 'Evaluations' inbox.
44428
- * @returns PaginatedJudgeList
44917
+ * API endpoint to get custom domains (public, no authentication or permission checks)
44918
+ * @returns any No response body
44429
44919
  * @throws ApiError
44430
44920
  */
44431
- static evaluationsJudgesGlobalList({
44432
- org,
44433
- userId,
44434
- datasetName,
44435
- limit,
44436
- page,
44437
- status,
44438
- userEmail
44439
- }) {
44921
+ static customDomainsRetrieve() {
44440
44922
  return request(OpenAPI, {
44441
44923
  method: 'GET',
44442
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/judges/',
44443
- path: {
44444
- 'org': org,
44445
- 'user_id': userId
44446
- },
44447
- query: {
44448
- 'dataset_name': datasetName,
44449
- 'limit': limit,
44450
- 'page': page,
44451
- 'status': status,
44452
- 'user_email': userEmail
44453
- }
44924
+ url: '/api/custom-domains/'
44454
44925
  });
44455
44926
  }
44456
44927
  /**
44457
- * List score configurations
44458
- * Score configurations define reusable rubrics (numeric ranges, boolean, or categorical labels). They are optional — scores work without one — but useful for enforcing consistent grading.
44459
- * @returns PaginatedScoreConfigList
44928
+ * API endpoint to hard delete a custom domain
44929
+ * @returns void
44460
44930
  * @throws ApiError
44461
44931
  */
44462
- static aiMentorOrgsUsersEvaluationsScoreConfigsRetrieve({
44463
- org,
44464
- userId,
44465
- limit,
44466
- page
44932
+ static customDomainsDeleteDestroy({
44933
+ domainId
44467
44934
  }) {
44468
44935
  return request(OpenAPI, {
44469
- method: 'GET',
44470
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/score-configs/',
44936
+ method: 'DELETE',
44937
+ url: '/api/custom-domains/{domain_id}/delete/',
44471
44938
  path: {
44472
- 'org': org,
44473
- 'user_id': userId
44474
- },
44475
- query: {
44476
- 'limit': limit,
44477
- 'page': page
44939
+ 'domain_id': domainId
44478
44940
  }
44479
44941
  });
44480
44942
  }
44481
44943
  /**
44482
- * Create a score configuration
44483
- * Create a score configuration.
44484
- * @returns ScoreConfig
44944
+ * API endpoint to update the is_deleted status of a custom domain
44945
+ * @returns any No response body
44485
44946
  * @throws ApiError
44486
44947
  */
44487
- static aiMentorOrgsUsersEvaluationsScoreConfigsCreate({
44488
- org,
44489
- userId,
44490
- requestBody
44948
+ static customDomainsDeletedStatusCreate({
44949
+ domainId
44491
44950
  }) {
44492
44951
  return request(OpenAPI, {
44493
44952
  method: 'POST',
44494
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/score-configs/',
44953
+ url: '/api/custom-domains/{domain_id}/deleted-status/',
44495
44954
  path: {
44496
- 'org': org,
44497
- 'user_id': userId
44498
- },
44499
- body: requestBody,
44500
- mediaType: 'application/json',
44501
- errors: {
44502
- 400: `Validation error.`
44955
+ 'domain_id': domainId
44503
44956
  }
44504
44957
  });
44505
44958
  }
44506
44959
  /**
44507
- * List scores
44508
- * List scores (human annotations and LLM-judge results) with optional filters. Pair `dataset_run_id` with a run id to scope to one experiment; pass `trace_id` to scope to a single chat turn or mentor invocation.
44509
- * @returns PaginatedScoreList
44960
+ * API endpoint to update custom domain SPA type
44961
+ * @returns any No response body
44510
44962
  * @throws ApiError
44511
44963
  */
44512
- static aiMentorOrgsUsersEvaluationsScoresRetrieve({
44513
- org,
44514
- userId,
44515
- datasetRunId,
44516
- limit,
44517
- name,
44518
- page,
44519
- traceId,
44520
- userEmail
44964
+ static customDomainsStatusUpdate({
44965
+ domainId
44521
44966
  }) {
44522
44967
  return request(OpenAPI, {
44523
- method: 'GET',
44524
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/scores/',
44968
+ method: 'PUT',
44969
+ url: '/api/custom-domains/{domain_id}/status/',
44525
44970
  path: {
44526
- 'org': org,
44527
- 'user_id': userId
44528
- },
44529
- query: {
44530
- 'dataset_run_id': datasetRunId,
44531
- 'limit': limit,
44532
- 'name': name,
44533
- 'page': page,
44534
- 'trace_id': traceId,
44535
- 'user_email': userEmail
44971
+ 'domain_id': domainId
44536
44972
  }
44537
44973
  });
44538
44974
  }
44539
44975
  /**
44540
- * Create a score
44541
- * Create a score on a trace or observation. Use this to record human grading of a single chat message (pass the chat frame's `generation_id` as `trace_id`) or to score an experiment-run item (also pass `dataset_run_id` so the score shows up in the run's CSV export).
44542
- * @returns ScoreCreateResponse
44976
+ * API endpoint to update custom domain SPA type by domain name
44977
+ * @returns any No response body
44543
44978
  * @throws ApiError
44544
44979
  */
44545
- static aiMentorOrgsUsersEvaluationsScoresCreate({
44546
- org,
44547
- userId,
44548
- requestBody
44980
+ static customDomainsByNameStatusUpdate({
44981
+ domainName
44549
44982
  }) {
44550
44983
  return request(OpenAPI, {
44551
- method: 'POST',
44552
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/scores/',
44984
+ method: 'PUT',
44985
+ url: '/api/custom-domains/by-name/{domain_name}/status/',
44553
44986
  path: {
44554
- 'org': org,
44555
- 'user_id': userId
44556
- },
44557
- body: requestBody,
44558
- mediaType: 'application/json',
44559
- errors: {
44560
- 400: `Validation error.`
44987
+ 'domain_name': domainName
44561
44988
  }
44562
44989
  });
44563
44990
  }
44564
44991
  /**
44565
- * Delete a score
44566
- * Queues the score for deletion in Langfuse. The list endpoint hides this id immediately, but Langfuse's worker can take up to a few minutes to remove it from its own stores.
44567
- * @returns any Deletion queued.
44992
+ * API endpoint to create a custom domain
44993
+ * @returns any No response body
44568
44994
  * @throws ApiError
44569
44995
  */
44570
- static aiMentorOrgsUsersEvaluationsScoresDestroy({
44571
- org,
44572
- scoreId,
44573
- userId
44574
- }) {
44996
+ static customDomainsCreateCreate() {
44575
44997
  return request(OpenAPI, {
44576
- method: 'DELETE',
44577
- url: '/api/ai-mentor/orgs/{org}/users/{user_id}/evaluations/scores/{score_id}/',
44578
- path: {
44579
- 'org': org,
44580
- 'score_id': scoreId,
44581
- 'user_id': userId
44582
- },
44583
- errors: {
44584
- 404: `Not found within the tenant.`
44585
- }
44998
+ method: 'POST',
44999
+ url: '/api/custom-domains/create/'
44586
45000
  });
44587
45001
  }
44588
45002
  }
@@ -45637,6 +46051,406 @@ class NotificationsService {
45637
46051
  }
45638
46052
  }
45639
46053
 
46054
+ class OrganizationsService {
46055
+ /**
46056
+ * List organizations
46057
+ * Returns a paginated list of organizations in your Platform. Supports filtering by `owner` and by `name` (case-insensitive substring match).
46058
+ *
46059
+ * **Required permission:** `Ibl.CRM/Organizations/list`.
46060
+ * @returns PaginatedOrganizationList
46061
+ * @throws ApiError
46062
+ */
46063
+ static organizationsList({
46064
+ name,
46065
+ owner,
46066
+ page,
46067
+ pageSize
46068
+ }) {
46069
+ return request(OpenAPI, {
46070
+ method: 'GET',
46071
+ url: '/organizations/',
46072
+ query: {
46073
+ 'name': name,
46074
+ 'owner': owner,
46075
+ 'page': page,
46076
+ 'page_size': pageSize
46077
+ },
46078
+ errors: {
46079
+ 401: `Authentication required.`,
46080
+ 403: `Missing required permission \`Ibl.CRM/Organizations/list\`.`
46081
+ }
46082
+ });
46083
+ }
46084
+ /**
46085
+ * Create an organization
46086
+ * Creates a new organization in your Platform. The Platform is inferred from your credentials. `name` must be unique within your Platform.
46087
+ *
46088
+ * **Required permission:** `Ibl.CRM/Organizations/write`.
46089
+ * @returns Organization
46090
+ * @throws ApiError
46091
+ */
46092
+ static organizationsCreate({
46093
+ requestBody
46094
+ }) {
46095
+ return request(OpenAPI, {
46096
+ method: 'POST',
46097
+ url: '/organizations/',
46098
+ body: requestBody,
46099
+ mediaType: 'application/json',
46100
+ errors: {
46101
+ 400: `Validation error (for example, duplicate name).`,
46102
+ 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`
46103
+ }
46104
+ });
46105
+ }
46106
+ /**
46107
+ * Retrieve an organization
46108
+ * Returns a single organization by id.
46109
+ *
46110
+ * **Required permission:** `Ibl.CRM/Organizations/read`.
46111
+ * @returns Organization
46112
+ * @throws ApiError
46113
+ */
46114
+ static organizationsRetrieve({
46115
+ id
46116
+ }) {
46117
+ return request(OpenAPI, {
46118
+ method: 'GET',
46119
+ url: '/organizations/{id}/',
46120
+ path: {
46121
+ 'id': id
46122
+ },
46123
+ errors: {
46124
+ 403: `Missing required permission \`Ibl.CRM/Organizations/read\`.`,
46125
+ 404: `Organization not found.`
46126
+ }
46127
+ });
46128
+ }
46129
+ /**
46130
+ * Replace an organization
46131
+ * Replaces all editable fields on the organization.
46132
+ *
46133
+ * **Required permission:** `Ibl.CRM/Organizations/write`.
46134
+ * @returns Organization
46135
+ * @throws ApiError
46136
+ */
46137
+ static organizationsUpdate({
46138
+ id,
46139
+ requestBody
46140
+ }) {
46141
+ return request(OpenAPI, {
46142
+ method: 'PUT',
46143
+ url: '/organizations/{id}/',
46144
+ path: {
46145
+ 'id': id
46146
+ },
46147
+ body: requestBody,
46148
+ mediaType: 'application/json',
46149
+ errors: {
46150
+ 400: `Validation error.`,
46151
+ 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
46152
+ 404: `Organization not found.`
46153
+ }
46154
+ });
46155
+ }
46156
+ /**
46157
+ * Update an organization
46158
+ * Updates only the supplied fields on the organization.
46159
+ *
46160
+ * **Required permission:** `Ibl.CRM/Organizations/write`.
46161
+ * @returns Organization
46162
+ * @throws ApiError
46163
+ */
46164
+ static organizationsPartialUpdate({
46165
+ id,
46166
+ requestBody
46167
+ }) {
46168
+ return request(OpenAPI, {
46169
+ method: 'PATCH',
46170
+ url: '/organizations/{id}/',
46171
+ path: {
46172
+ 'id': id
46173
+ },
46174
+ body: requestBody,
46175
+ mediaType: 'application/json',
46176
+ errors: {
46177
+ 400: `Validation error.`,
46178
+ 403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
46179
+ 404: `Organization not found.`
46180
+ }
46181
+ });
46182
+ }
46183
+ /**
46184
+ * Delete an organization
46185
+ * Deletes the organization. Any persons linked to it are kept; their organization reference is cleared.
46186
+ *
46187
+ * **Required permission:** `Ibl.CRM/Organizations/delete`.
46188
+ * @returns void
46189
+ * @throws ApiError
46190
+ */
46191
+ static organizationsDestroy({
46192
+ id
46193
+ }) {
46194
+ return request(OpenAPI, {
46195
+ method: 'DELETE',
46196
+ url: '/organizations/{id}/',
46197
+ path: {
46198
+ 'id': id
46199
+ },
46200
+ errors: {
46201
+ 403: `Missing required permission \`Ibl.CRM/Organizations/delete\`.`,
46202
+ 404: `Organization not found.`
46203
+ }
46204
+ });
46205
+ }
46206
+ }
46207
+
46208
+ class PersonsService {
46209
+ /**
46210
+ * List persons
46211
+ * Returns a paginated list of persons in your Platform. Supports filtering by `lifecycle_stage`, `owner`, `organization`, `created_at__gte`/`created_at__lte`, and `metadata__has_key`.
46212
+ *
46213
+ * **Required permission:** `Ibl.CRM/Persons/list`.
46214
+ * @returns PaginatedPersonList
46215
+ * @throws ApiError
46216
+ */
46217
+ static personsList({
46218
+ createdAtGte,
46219
+ createdAtLte,
46220
+ lifecycleStage,
46221
+ metadataHasKey,
46222
+ organization,
46223
+ owner,
46224
+ page,
46225
+ pageSize
46226
+ }) {
46227
+ return request(OpenAPI, {
46228
+ method: 'GET',
46229
+ url: '/persons/',
46230
+ query: {
46231
+ 'created_at__gte': createdAtGte,
46232
+ 'created_at__lte': createdAtLte,
46233
+ 'lifecycle_stage': lifecycleStage,
46234
+ 'metadata__has_key': metadataHasKey,
46235
+ 'organization': organization,
46236
+ 'owner': owner,
46237
+ 'page': page,
46238
+ 'page_size': pageSize
46239
+ },
46240
+ errors: {
46241
+ 401: `Authentication required.`,
46242
+ 403: `Missing required permission \`Ibl.CRM/Persons/list\`.`
46243
+ }
46244
+ });
46245
+ }
46246
+ /**
46247
+ * Create a person
46248
+ * Creates a new person in your Platform. The Platform is inferred from your credentials. If `organization` is supplied, it must reference an organization in your Platform.
46249
+ *
46250
+ * **Required permission:** `Ibl.CRM/Persons/write`.
46251
+ * @returns Person
46252
+ * @throws ApiError
46253
+ */
46254
+ static personsCreate({
46255
+ requestBody
46256
+ }) {
46257
+ return request(OpenAPI, {
46258
+ method: 'POST',
46259
+ url: '/persons/',
46260
+ body: requestBody,
46261
+ mediaType: 'application/json',
46262
+ errors: {
46263
+ 400: `Validation error.`,
46264
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`
46265
+ }
46266
+ });
46267
+ }
46268
+ /**
46269
+ * Retrieve a person
46270
+ * Returns a single person by id.
46271
+ *
46272
+ * **Required permission:** `Ibl.CRM/Persons/read`.
46273
+ * @returns Person
46274
+ * @throws ApiError
46275
+ */
46276
+ static personsRetrieve({
46277
+ id
46278
+ }) {
46279
+ return request(OpenAPI, {
46280
+ method: 'GET',
46281
+ url: '/persons/{id}/',
46282
+ path: {
46283
+ 'id': id
46284
+ },
46285
+ errors: {
46286
+ 403: `Missing required permission \`Ibl.CRM/Persons/read\`.`,
46287
+ 404: `Person not found.`
46288
+ }
46289
+ });
46290
+ }
46291
+ /**
46292
+ * Replace a person
46293
+ * Replaces all editable fields on the person.
46294
+ *
46295
+ * **Required permission:** `Ibl.CRM/Persons/write`.
46296
+ * @returns Person
46297
+ * @throws ApiError
46298
+ */
46299
+ static personsUpdate({
46300
+ id,
46301
+ requestBody
46302
+ }) {
46303
+ return request(OpenAPI, {
46304
+ method: 'PUT',
46305
+ url: '/persons/{id}/',
46306
+ path: {
46307
+ 'id': id
46308
+ },
46309
+ body: requestBody,
46310
+ mediaType: 'application/json',
46311
+ errors: {
46312
+ 400: `Validation error.`,
46313
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
46314
+ 404: `Person not found.`
46315
+ }
46316
+ });
46317
+ }
46318
+ /**
46319
+ * Update a person
46320
+ * Updates only the supplied fields on the person.
46321
+ *
46322
+ * **Required permission:** `Ibl.CRM/Persons/write`.
46323
+ * @returns Person
46324
+ * @throws ApiError
46325
+ */
46326
+ static personsPartialUpdate({
46327
+ id,
46328
+ requestBody
46329
+ }) {
46330
+ return request(OpenAPI, {
46331
+ method: 'PATCH',
46332
+ url: '/persons/{id}/',
46333
+ path: {
46334
+ 'id': id
46335
+ },
46336
+ body: requestBody,
46337
+ mediaType: 'application/json',
46338
+ errors: {
46339
+ 400: `Validation error.`,
46340
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
46341
+ 404: `Person not found.`
46342
+ }
46343
+ });
46344
+ }
46345
+ /**
46346
+ * Delete a person
46347
+ * Deletes the person.
46348
+ *
46349
+ * **Required permission:** `Ibl.CRM/Persons/delete`.
46350
+ * @returns void
46351
+ * @throws ApiError
46352
+ */
46353
+ static personsDestroy({
46354
+ id
46355
+ }) {
46356
+ return request(OpenAPI, {
46357
+ method: 'DELETE',
46358
+ url: '/persons/{id}/',
46359
+ path: {
46360
+ 'id': id
46361
+ },
46362
+ errors: {
46363
+ 403: `Missing required permission \`Ibl.CRM/Persons/delete\`.`,
46364
+ 404: `Person not found.`
46365
+ }
46366
+ });
46367
+ }
46368
+ /**
46369
+ * Invite a person to the platform
46370
+ * Sends a platform invitation to the person's `primary_email`. On acceptance, the invitee joins your Platform with the privileges configured in the request body.
46371
+ *
46372
+ * Returns `409 Conflict` if an active invitation already exists for this email in your Platform, and `422 Unprocessable Entity` if the person is already linked to a platform user.
46373
+ *
46374
+ * **Required permission:** `Ibl.CRM/Invite/action`.
46375
+ * @returns PersonInviteResponse
46376
+ * @throws ApiError
46377
+ */
46378
+ static personsInviteCreate({
46379
+ id,
46380
+ requestBody
46381
+ }) {
46382
+ return request(OpenAPI, {
46383
+ method: 'POST',
46384
+ url: '/persons/{id}/invite/',
46385
+ path: {
46386
+ 'id': id
46387
+ },
46388
+ body: requestBody,
46389
+ mediaType: 'application/json',
46390
+ errors: {
46391
+ 400: `Person has no \`primary_email\`; cannot invite.`,
46392
+ 403: `Missing required permission \`Ibl.CRM/Invite/action\`.`,
46393
+ 404: `Person not found.`,
46394
+ 422: `Person is already linked to a platform user.`
46395
+ }
46396
+ });
46397
+ }
46398
+ /**
46399
+ * Bind a person to an existing platform user
46400
+ * Links this person to an existing platform user. The target user must already be a member of your Platform — if they are not, send them an invitation via `POST /persons/{id}/invite/` instead.
46401
+ *
46402
+ * This call is idempotent: linking a person that is already bound to the same user is a no-op. Re-linking a person that is already bound to a *different* user is refused; the existing binding is preserved and the unchanged person is returned.
46403
+ *
46404
+ * **Required permission:** `Ibl.CRM/Persons/write`.
46405
+ * @returns Person
46406
+ * @throws ApiError
46407
+ */
46408
+ static personsLinkUserCreate({
46409
+ id,
46410
+ requestBody
46411
+ }) {
46412
+ return request(OpenAPI, {
46413
+ method: 'POST',
46414
+ url: '/persons/{id}/link-user/',
46415
+ path: {
46416
+ 'id': id
46417
+ },
46418
+ body: requestBody,
46419
+ mediaType: 'application/json',
46420
+ errors: {
46421
+ 400: `Validation error.`,
46422
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`, or the target user is not a member of your Platform.`,
46423
+ 404: `Person or user not found.`
46424
+ }
46425
+ });
46426
+ }
46427
+ /**
46428
+ * Merge duplicate persons into a primary
46429
+ * Marks each person in `duplicate_ids` as inactive and reports how many related records (deals, activities, tags) were re-parented onto `primary_id`.
46430
+ *
46431
+ * All ids — both the primary and every duplicate — must belong to your Platform. `primary_id` may not appear in `duplicate_ids`.
46432
+ *
46433
+ * **Required permission:** `Ibl.CRM/Persons/write`.
46434
+ * @returns PersonMergeResponse
46435
+ * @throws ApiError
46436
+ */
46437
+ static personsMergeCreate({
46438
+ requestBody
46439
+ }) {
46440
+ return request(OpenAPI, {
46441
+ method: 'POST',
46442
+ url: '/persons/merge/',
46443
+ body: requestBody,
46444
+ mediaType: 'application/json',
46445
+ errors: {
46446
+ 400: `Validation error: the primary appears in duplicates, or one or more ids belong to another Platform.`,
46447
+ 403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
46448
+ 404: `Primary person not found.`
46449
+ }
46450
+ });
46451
+ }
46452
+ }
46453
+
45640
46454
  class PlatformsService {
45641
46455
  /**
45642
46456
  * Check whether the authenticated user has payment access to an item on a scoped platform.
@@ -48506,14 +49320,16 @@ exports.CommerceService = CommerceService;
48506
49320
  exports.CoreService = CoreService;
48507
49321
  exports.CredentialsService = CredentialsService;
48508
49322
  exports.CreditsService = CreditsService;
49323
+ exports.CrmService = CrmService;
48509
49324
  exports.CustomDomainsService = CustomDomainsService;
48510
- exports.EvaluationsService = EvaluationsService;
48511
49325
  exports.FeaturesService = FeaturesService;
48512
49326
  exports.IntegrationCredentialsService = IntegrationCredentialsService;
48513
49327
  exports.ItemsService = ItemsService;
48514
49328
  exports.MediaService = MediaService;
48515
49329
  exports.NotificationsService = NotificationsService;
48516
49330
  exports.OpenAPI = OpenAPI;
49331
+ exports.OrganizationsService = OrganizationsService;
49332
+ exports.PersonsService = PersonsService;
48517
49333
  exports.PlatformsService = PlatformsService;
48518
49334
  exports.PricesService = PricesService;
48519
49335
  exports.RecommendationsService = RecommendationsService;