From cd4a2bcfad4f78472044602540fa2cd4bc9a6f69 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:15:31 +0000 Subject: [PATCH] feat(api): manual updates (#69) --- .stats.yml | 2 +- api.md | 25 +- src/index.ts | 16 +- src/resources/acls.ts | 112 ++--- src/resources/datasets.ts | 6 +- src/resources/experiments.ts | 6 +- src/resources/functions.ts | 170 ++++++- src/resources/index.ts | 12 +- src/resources/organizations/index.ts | 2 +- src/resources/organizations/members.ts | 21 +- src/resources/organizations/organizations.ts | 1 - src/resources/project-scores.ts | 9 +- src/resources/projects/logs.ts | 6 +- src/resources/projects/projects.ts | 15 +- src/resources/roles.ts | 24 +- src/resources/shared.ts | 477 ++++++++++--------- src/resources/views.ts | 18 +- 17 files changed, 499 insertions(+), 423 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4ac4103..77a0394 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/manugoyal%2Fbraintrust-sdk-30c1a668b911f97194bd12e54b88dab936753288186bc6a9f3116a03de3aaf62.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/manugoyal%2Fbraintrust-sdk-68955d9009ff58d23a1d859274ed4d3d38a7e84b5ea3e43a25209a40bbd84b6e.yml diff --git a/api.md b/api.md index 54caae2..da1b37e 100755 --- a/api.md +++ b/api.md @@ -4,8 +4,12 @@ Types: - AISecret - ACL +- ACLBatchUpdateResponse - APIKey -- Code +- ChatCompletionContentPartImage +- ChatCompletionContentPartText +- ChatCompletionMessageToolCall +- CodeBundle - CreateAPIKeyOutput - CrossObjectInsertResponse - DataSummary @@ -29,26 +33,24 @@ Types: - InsertExperimentEventReplace - InsertProjectLogsEventMerge - InsertProjectLogsEventReplace -- Messages - MetricSummary +- OnlineScoreConfig - Organization +- PatchOrganizationMembersOutput - PathLookupFilter - Project - ProjectLogsEvent - ProjectScore - ProjectScoreCategory +- ProjectSettings - ProjectTag - Prompt - PromptData -- PromptImageURL - RepoInfo - Role - ScoreSummary -- Scorer - SummarizeDatasetResponse - SummarizeExperimentResponse -- Task -- ToolChoiceFunction - User - View - ViewData @@ -149,10 +151,6 @@ Methods: # ACLs -Types: - -- ACLBatchUpdateResponse - Methods: - client.acls.create({ ...params }) -> ACL @@ -195,7 +193,6 @@ Methods: Types: -- ImageURL - FunctionInvokeResponse Methods: @@ -230,13 +227,9 @@ Methods: ## Members -Types: - -- MemberUpdateResponse - Methods: -- client.organizations.members.update({ ...params }) -> MemberUpdateResponse +- client.organizations.members.update({ ...params }) -> PatchOrganizationMembersOutput # APIKeys diff --git a/src/index.ts b/src/index.ts index ae76708..01ec77b 100755 --- a/src/index.ts +++ b/src/index.ts @@ -248,7 +248,6 @@ export namespace Braintrust { export import GroupReplaceParams = API.GroupReplaceParams; export import ACLs = API.ACLs; - export import ACLBatchUpdateResponse = API.ACLBatchUpdateResponse; export import ACLCreateParams = API.ACLCreateParams; export import ACLListParams = API.ACLListParams; export import ACLBatchUpdateParams = API.ACLBatchUpdateParams; @@ -270,7 +269,6 @@ export namespace Braintrust { export import ProjectTagReplaceParams = API.ProjectTagReplaceParams; export import Functions = API.Functions; - export import ImageURL = API.ImageURL; export import FunctionInvokeResponse = API.FunctionInvokeResponse; export import FunctionCreateParams = API.FunctionCreateParams; export import FunctionUpdateParams = API.FunctionUpdateParams; @@ -303,8 +301,12 @@ export namespace Braintrust { export import AISecret = API.AISecret; export import ACL = API.ACL; + export import ACLBatchUpdateResponse = API.ACLBatchUpdateResponse; export import APIKey = API.APIKey; - export import Code = API.Code; + export import ChatCompletionContentPartImage = API.ChatCompletionContentPartImage; + export import ChatCompletionContentPartText = API.ChatCompletionContentPartText; + export import ChatCompletionMessageToolCall = API.ChatCompletionMessageToolCall; + export import CodeBundle = API.CodeBundle; export import CreateAPIKeyOutput = API.CreateAPIKeyOutput; export import CrossObjectInsertResponse = API.CrossObjectInsertResponse; export import DataSummary = API.DataSummary; @@ -328,26 +330,24 @@ export namespace Braintrust { export import InsertExperimentEventReplace = API.InsertExperimentEventReplace; export import InsertProjectLogsEventMerge = API.InsertProjectLogsEventMerge; export import InsertProjectLogsEventReplace = API.InsertProjectLogsEventReplace; - export import Messages = API.Messages; export import MetricSummary = API.MetricSummary; + export import OnlineScoreConfig = API.OnlineScoreConfig; export import Organization = API.Organization; + export import PatchOrganizationMembersOutput = API.PatchOrganizationMembersOutput; export import PathLookupFilter = API.PathLookupFilter; export import Project = API.Project; export import ProjectLogsEvent = API.ProjectLogsEvent; export import ProjectScore = API.ProjectScore; export import ProjectScoreCategory = API.ProjectScoreCategory; + export import ProjectSettings = API.ProjectSettings; export import ProjectTag = API.ProjectTag; export import Prompt = API.Prompt; export import PromptData = API.PromptData; - export import PromptImageURL = API.PromptImageURL; export import RepoInfo = API.RepoInfo; export import Role = API.Role; export import ScoreSummary = API.ScoreSummary; - export import Scorer = API.Scorer; export import SummarizeDatasetResponse = API.SummarizeDatasetResponse; export import SummarizeExperimentResponse = API.SummarizeExperimentResponse; - export import Task = API.Task; - export import ToolChoiceFunction = API.ToolChoiceFunction; export import User = API.User; export import View = API.View; export import ViewData = API.ViewData; diff --git a/src/resources/acls.ts b/src/resources/acls.ts index 8e41b1f..497edd3 100644 --- a/src/resources/acls.ts +++ b/src/resources/acls.ts @@ -47,12 +47,12 @@ export class ACLs extends APIResource { batchUpdate( body?: ACLBatchUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise; - batchUpdate(options?: Core.RequestOptions): Core.APIPromise; + ): Core.APIPromise; + batchUpdate(options?: Core.RequestOptions): Core.APIPromise; batchUpdate( body: ACLBatchUpdateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { if (isRequestOptions(body)) { return this.batchUpdate({}, body); } @@ -67,36 +67,6 @@ export class ACLs extends APIResource { } } -export interface ACLBatchUpdateResponse { - /** - * An ACL grants a certain permission or role to a certain user or group on an - * object. - * - * ACLs are inherited across the object hierarchy. So for example, if a user has - * read permissions on a project, they will also have read permissions on any - * experiment, dataset, etc. created within that project. - * - * To restrict a grant to a particular sub-object, you may specify - * `restrict_object_type` in the ACL, as part of a direct permission grant or as - * part of a role. - */ - added_acls: Array; - - /** - * An ACL grants a certain permission or role to a certain user or group on an - * object. - * - * ACLs are inherited across the object hierarchy. So for example, if a user has - * read permissions on a project, they will also have read permissions on any - * experiment, dataset, etc. created within that project. - * - * To restrict a grant to a particular sub-object, you may specify - * `restrict_object_type` in the ACL, as part of a direct permission grant or as - * part of a role. - */ - removed_acls: Array; -} - export interface ACLCreateParams { /** * The id of the object the ACL applies to @@ -117,8 +87,7 @@ export interface ACLCreateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will @@ -127,8 +96,10 @@ export interface ACLCreateParams { group_id?: string | null; /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Each permission permits a certain type of operation on an object in the system + * + * Permissions can be assigned to to objects on an individual basis, or grouped + * into roles */ permission?: | 'create' @@ -138,12 +109,10 @@ export interface ACLCreateParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** - * When setting a permission directly, optionally restricts the permission grant to - * just the specified object type. Cannot be set alongside a `role_id`. + * The object type that the ACL applies to */ restrict_object_type?: | 'organization' @@ -156,8 +125,7 @@ export interface ACLCreateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be @@ -192,8 +160,7 @@ export interface ACLListParams extends ListObjectsParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Filter search results to a particular set of object IDs. To specify a list of @@ -265,8 +232,7 @@ export namespace ACLBatchUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will @@ -275,8 +241,10 @@ export namespace ACLBatchUpdateParams { group_id?: string | null; /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Each permission permits a certain type of operation on an object in the system + * + * Permissions can be assigned to to objects on an individual basis, or grouped + * into roles */ permission?: | 'create' @@ -286,12 +254,10 @@ export namespace ACLBatchUpdateParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** - * When setting a permission directly, optionally restricts the permission grant to - * just the specified object type. Cannot be set alongside a `role_id`. + * The object type that the ACL applies to */ restrict_object_type?: | 'organization' @@ -304,8 +270,7 @@ export namespace ACLBatchUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be @@ -352,8 +317,7 @@ export namespace ACLBatchUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will @@ -362,8 +326,10 @@ export namespace ACLBatchUpdateParams { group_id?: string | null; /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Each permission permits a certain type of operation on an object in the system + * + * Permissions can be assigned to to objects on an individual basis, or grouped + * into roles */ permission?: | 'create' @@ -373,12 +339,10 @@ export namespace ACLBatchUpdateParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** - * When setting a permission directly, optionally restricts the permission grant to - * just the specified object type. Cannot be set alongside a `role_id`. + * The object type that the ACL applies to */ restrict_object_type?: | 'organization' @@ -391,8 +355,7 @@ export namespace ACLBatchUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be @@ -428,8 +391,7 @@ export interface ACLFindAndDeleteParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will @@ -438,8 +400,10 @@ export interface ACLFindAndDeleteParams { group_id?: string | null; /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Each permission permits a certain type of operation on an object in the system + * + * Permissions can be assigned to to objects on an individual basis, or grouped + * into roles */ permission?: | 'create' @@ -449,12 +413,10 @@ export interface ACLFindAndDeleteParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** - * When setting a permission directly, optionally restricts the permission grant to - * just the specified object type. Cannot be set alongside a `role_id`. + * The object type that the ACL applies to */ restrict_object_type?: | 'organization' @@ -467,8 +429,7 @@ export interface ACLFindAndDeleteParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be @@ -484,7 +445,6 @@ export interface ACLFindAndDeleteParams { } export namespace ACLs { - export import ACLBatchUpdateResponse = ACLsAPI.ACLBatchUpdateResponse; export import ACLCreateParams = ACLsAPI.ACLCreateParams; export import ACLListParams = ACLsAPI.ACLListParams; export import ACLBatchUpdateParams = ACLsAPI.ACLBatchUpdateParams; diff --git a/src/resources/datasets.ts b/src/resources/datasets.ts index e4ff02f..2fc341f 100644 --- a/src/resources/datasets.ts +++ b/src/resources/datasets.ts @@ -340,7 +340,7 @@ export interface DatasetFetchPostParams { * value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` * for an overview of paginating fetch queries. */ - max_root_span_id?: string | null; + max_root_span_id?: string; /** * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in @@ -354,7 +354,7 @@ export interface DatasetFetchPostParams { * value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` * for an overview of paginating fetch queries. */ - max_xact_id?: string | null; + max_xact_id?: string; /** * Retrieve a snapshot of events from a past time @@ -363,7 +363,7 @@ export interface DatasetFetchPostParams { * can use the `max_xact_id` returned by a past fetch as the version to reproduce * that exact fetch. */ - version?: string | null; + version?: string; } export interface DatasetInsertParams { diff --git a/src/resources/experiments.ts b/src/resources/experiments.ts index 78facec..f8c703e 100644 --- a/src/resources/experiments.ts +++ b/src/resources/experiments.ts @@ -412,7 +412,7 @@ export interface ExperimentFetchPostParams { * value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` * for an overview of paginating fetch queries. */ - max_root_span_id?: string | null; + max_root_span_id?: string; /** * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in @@ -426,7 +426,7 @@ export interface ExperimentFetchPostParams { * value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` * for an overview of paginating fetch queries. */ - max_xact_id?: string | null; + max_xact_id?: string; /** * Retrieve a snapshot of events from a past time @@ -435,7 +435,7 @@ export interface ExperimentFetchPostParams { * can use the `max_xact_id` returned by a past fetch as the version to reproduce * that exact fetch. */ - version?: string | null; + version?: string; } export interface ExperimentInsertParams { diff --git a/src/resources/functions.ts b/src/resources/functions.ts index 739c7c3..f61f06e 100644 --- a/src/resources/functions.ts +++ b/src/resources/functions.ts @@ -103,16 +103,10 @@ export class Functions extends APIResource { } } -export interface ImageURL { - url: string; - - detail?: 'auto' | 'low' | 'high'; -} - export type FunctionInvokeResponse = unknown; export interface FunctionCreateParams { - function_data: FunctionCreateParams.Prompt | Shared.Code | FunctionCreateParams.Global; + function_data: FunctionCreateParams.Prompt | FunctionCreateParams.Code | FunctionCreateParams.Global; /** * Name of the prompt @@ -159,6 +153,34 @@ export namespace FunctionCreateParams { type: 'prompt'; } + export interface Code { + data: Code.Bundle | Code.Inline; + + type: 'code'; + } + + export namespace Code { + export interface Bundle extends Shared.CodeBundle { + type: 'bundle'; + } + + export interface Inline { + code: string; + + runtime_context: Inline.RuntimeContext; + + type: 'inline'; + } + + export namespace Inline { + export interface RuntimeContext { + runtime: 'node' | 'python'; + + version: string; + } + } + } + export interface Global { name: string; @@ -194,8 +216,7 @@ export namespace FunctionCreateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * The function exists for internal purposes and should not be displayed in the @@ -213,7 +234,7 @@ export interface FunctionUpdateParams { function_data?: | FunctionUpdateParams.Prompt - | Shared.Code + | FunctionUpdateParams.Code | FunctionUpdateParams.Global | FunctionUpdateParams.NullableVariant | null; @@ -239,6 +260,34 @@ export namespace FunctionUpdateParams { type: 'prompt'; } + export interface Code { + data: Code.Bundle | Code.Inline; + + type: 'code'; + } + + export namespace Code { + export interface Bundle extends Shared.CodeBundle { + type: 'bundle'; + } + + export interface Inline { + code: string; + + runtime_context: Inline.RuntimeContext; + + type: 'inline'; + } + + export namespace Inline { + export interface RuntimeContext { + runtime: 'node' | 'python'; + + version: string; + } + } + } + export interface Global { name: string; @@ -298,7 +347,14 @@ export interface FunctionInvokeParams { /** * If the function is an LLM, additional messages to pass along to it */ - messages?: Array; + messages?: Array< + | FunctionInvokeParams.System + | FunctionInvokeParams.User + | FunctionInvokeParams.Assistant + | FunctionInvokeParams.Tool + | FunctionInvokeParams.Function + | FunctionInvokeParams.Fallback + >; /** * The mode format of the returned value (defaults to 'auto') @@ -323,6 +379,64 @@ export interface FunctionInvokeParams { } export namespace FunctionInvokeParams { + export interface System { + role: 'system'; + + content?: string; + + name?: string; + } + + export interface User { + role: 'user'; + + content?: string | Array; + + name?: string; + } + + export interface Assistant { + role: 'assistant'; + + content?: string | null; + + function_call?: Assistant.FunctionCall | null; + + name?: string | null; + + tool_calls?: Array | null; + } + + export namespace Assistant { + export interface FunctionCall { + arguments: string; + + name: string; + } + } + + export interface Tool { + role: 'tool'; + + content?: string; + + tool_call_id?: string; + } + + export interface Function { + name: string; + + role: 'function'; + + content?: string; + } + + export interface Fallback { + role: 'model'; + + content?: string | null; + } + /** * Span parent properties */ @@ -369,7 +483,7 @@ export namespace FunctionInvokeParams { } export interface FunctionReplaceParams { - function_data: FunctionReplaceParams.Prompt | Shared.Code | FunctionReplaceParams.Global; + function_data: FunctionReplaceParams.Prompt | FunctionReplaceParams.Code | FunctionReplaceParams.Global; /** * Name of the prompt @@ -416,6 +530,34 @@ export namespace FunctionReplaceParams { type: 'prompt'; } + export interface Code { + data: Code.Bundle | Code.Inline; + + type: 'code'; + } + + export namespace Code { + export interface Bundle extends Shared.CodeBundle { + type: 'bundle'; + } + + export interface Inline { + code: string; + + runtime_context: Inline.RuntimeContext; + + type: 'inline'; + } + + export namespace Inline { + export interface RuntimeContext { + runtime: 'node' | 'python'; + + version: string; + } + } + } + export interface Global { name: string; @@ -451,8 +593,7 @@ export namespace FunctionReplaceParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * The function exists for internal purposes and should not be displayed in the @@ -463,7 +604,6 @@ export namespace FunctionReplaceParams { } export namespace Functions { - export import ImageURL = FunctionsAPI.ImageURL; export import FunctionInvokeResponse = FunctionsAPI.FunctionInvokeResponse; export import FunctionCreateParams = FunctionsAPI.FunctionCreateParams; export import FunctionUpdateParams = FunctionsAPI.FunctionUpdateParams; diff --git a/src/resources/index.ts b/src/resources/index.ts index 8da8fe3..9862e9e 100755 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,14 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './shared'; -export { - ACLBatchUpdateResponse, - ACLCreateParams, - ACLListParams, - ACLBatchUpdateParams, - ACLFindAndDeleteParams, - ACLs, -} from './acls'; +export { ACLCreateParams, ACLListParams, ACLBatchUpdateParams, ACLFindAndDeleteParams, ACLs } from './acls'; export { AISecretCreateParams, AISecretUpdateParams, @@ -40,9 +33,7 @@ export { ExperimentSummarizeParams, Experiments, } from './experiments'; -export { GroupCreateParams, GroupUpdateParams, GroupListParams, GroupReplaceParams, Groups } from './groups'; export { - ImageURL, FunctionInvokeResponse, FunctionCreateParams, FunctionUpdateParams, @@ -51,6 +42,7 @@ export { FunctionReplaceParams, Functions, } from './functions'; +export { GroupCreateParams, GroupUpdateParams, GroupListParams, GroupReplaceParams, Groups } from './groups'; export { OrganizationUpdateParams, OrganizationListParams, diff --git a/src/resources/organizations/index.ts b/src/resources/organizations/index.ts index 6e52ee7..4d04804 100644 --- a/src/resources/organizations/index.ts +++ b/src/resources/organizations/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { MemberUpdateResponse, MemberUpdateParams, Members } from './members'; +export { MemberUpdateParams, Members } from './members'; export { OrganizationUpdateParams, OrganizationListParams, Organizations } from './organizations'; diff --git a/src/resources/organizations/members.ts b/src/resources/organizations/members.ts index 40bb202..eebf22d 100644 --- a/src/resources/organizations/members.ts +++ b/src/resources/organizations/members.ts @@ -4,17 +4,21 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as MembersAPI from './members'; +import * as Shared from '../shared'; export class Members extends APIResource { /** * Modify organization membership */ - update(body?: MemberUpdateParams, options?: Core.RequestOptions): Core.APIPromise; - update(options?: Core.RequestOptions): Core.APIPromise; + update( + body?: MemberUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + update(options?: Core.RequestOptions): Core.APIPromise; update( body: MemberUpdateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { if (isRequestOptions(body)) { return this.update({}, body); } @@ -22,16 +26,6 @@ export class Members extends APIResource { } } -export interface MemberUpdateResponse { - status: 'success'; - - /** - * If invite emails failed to send for some reason, the patch operation will still - * complete, but we will return an error message here - */ - send_email_error?: string | null; -} - export interface MemberUpdateParams { /** * Users to invite to the organization @@ -118,6 +112,5 @@ export namespace MemberUpdateParams { } export namespace Members { - export import MemberUpdateResponse = MembersAPI.MemberUpdateResponse; export import MemberUpdateParams = MembersAPI.MemberUpdateParams; } diff --git a/src/resources/organizations/organizations.ts b/src/resources/organizations/organizations.ts index 14ad3c9..343a6fc 100644 --- a/src/resources/organizations/organizations.ts +++ b/src/resources/organizations/organizations.ts @@ -100,7 +100,6 @@ export namespace Organizations { export import OrganizationUpdateParams = OrganizationsAPI.OrganizationUpdateParams; export import OrganizationListParams = OrganizationsAPI.OrganizationListParams; export import Members = MembersAPI.Members; - export import MemberUpdateResponse = MembersAPI.MemberUpdateResponse; export import MemberUpdateParams = MembersAPI.MemberUpdateParams; } diff --git a/src/resources/project-scores.ts b/src/resources/project-scores.ts index 5589638..46e2787 100644 --- a/src/resources/project-scores.ts +++ b/src/resources/project-scores.ts @@ -103,7 +103,7 @@ export interface ProjectScoreCreateParams { /** * The type of the configured score */ - score_type: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online' | null; + score_type: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online'; /** * For categorical-type project scores, the list of all categories @@ -149,7 +149,7 @@ export interface ProjectScoreUpdateParams { /** * The type of the configured score */ - score_type?: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online' | null; + score_type?: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online'; } export namespace ProjectScoreUpdateParams { @@ -192,8 +192,7 @@ export interface ProjectScoreListParams extends ListObjectsParams { | 'weighted' | 'minimum' | 'online' - | null - | Array<'slider' | 'categorical' | 'weighted' | 'minimum' | 'online' | null>; + | Array<'slider' | 'categorical' | 'weighted' | 'minimum' | 'online'>; } export interface ProjectScoreReplaceParams { @@ -210,7 +209,7 @@ export interface ProjectScoreReplaceParams { /** * The type of the configured score */ - score_type: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online' | null; + score_type: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online'; /** * For categorical-type project scores, the list of all categories diff --git a/src/resources/projects/logs.ts b/src/resources/projects/logs.ts index 4f17f54..25ab847 100644 --- a/src/resources/projects/logs.ts +++ b/src/resources/projects/logs.ts @@ -192,7 +192,7 @@ export interface LogFetchPostParams { * value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` * for an overview of paginating fetch queries. */ - max_root_span_id?: string | null; + max_root_span_id?: string; /** * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in @@ -206,7 +206,7 @@ export interface LogFetchPostParams { * value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` * for an overview of paginating fetch queries. */ - max_xact_id?: string | null; + max_xact_id?: string; /** * Retrieve a snapshot of events from a past time @@ -215,7 +215,7 @@ export interface LogFetchPostParams { * can use the `max_xact_id` returned by a past fetch as the version to reproduce * that exact fetch. */ - version?: string | null; + version?: string; } export interface LogInsertParams { diff --git a/src/resources/projects/projects.ts b/src/resources/projects/projects.ts index 7590a35..30efd82 100644 --- a/src/resources/projects/projects.ts +++ b/src/resources/projects/projects.ts @@ -100,20 +100,7 @@ export interface ProjectUpdateParams { * Project settings. Patch operations replace all settings, so make sure you * include all settings you want to keep. */ - settings?: ProjectUpdateParams.Settings | null; -} - -export namespace ProjectUpdateParams { - /** - * Project settings. Patch operations replace all settings, so make sure you - * include all settings you want to keep. - */ - export interface Settings { - /** - * The key used to join two experiments (defaults to `input`). - */ - comparison_key?: string | null; - } + settings?: Shared.ProjectSettings | null; } export interface ProjectListParams extends ListObjectsParams { diff --git a/src/resources/roles.ts b/src/resources/roles.ts index 76d24eb..16ad10f 100644 --- a/src/resources/roles.ts +++ b/src/resources/roles.ts @@ -130,8 +130,7 @@ export namespace RoleCreateParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** * The object type that the ACL applies to @@ -147,8 +146,7 @@ export namespace RoleCreateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } } @@ -200,8 +198,7 @@ export namespace RoleUpdateParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** * The object type that the ACL applies to @@ -217,8 +214,7 @@ export namespace RoleUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } export interface RemoveMemberPermission { @@ -236,8 +232,7 @@ export namespace RoleUpdateParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** * The object type that the ACL applies to @@ -253,8 +248,7 @@ export namespace RoleUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } } @@ -324,8 +318,7 @@ export namespace RoleReplaceParams { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** * The object type that the ACL applies to @@ -341,8 +334,7 @@ export namespace RoleReplaceParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } } diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 3942965..5a20cca 100755 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Shared from './shared'; -import * as FunctionsAPI from './functions'; import { ListObjects } from '../pagination'; export interface AISecret { @@ -74,8 +73,7 @@ export interface ACL { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Date of acl creation @@ -89,8 +87,10 @@ export interface ACL { group_id?: string | null; /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Each permission permits a certain type of operation on an object in the system + * + * Permissions can be assigned to to objects on an individual basis, or grouped + * into roles */ permission?: | 'create' @@ -100,12 +100,10 @@ export interface ACL { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** - * When setting a permission directly, optionally restricts the permission grant to - * just the specified object type. Cannot be set alongside a `role_id`. + * The object type that the ACL applies to */ restrict_object_type?: | 'organization' @@ -118,8 +116,7 @@ export interface ACL { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be @@ -134,6 +131,36 @@ export interface ACL { user_id?: string | null; } +export interface ACLBatchUpdateResponse { + /** + * An ACL grants a certain permission or role to a certain user or group on an + * object. + * + * ACLs are inherited across the object hierarchy. So for example, if a user has + * read permissions on a project, they will also have read permissions on any + * experiment, dataset, etc. created within that project. + * + * To restrict a grant to a particular sub-object, you may specify + * `restrict_object_type` in the ACL, as part of a direct permission grant or as + * part of a role. + */ + added_acls: Array; + + /** + * An ACL grants a certain permission or role to a certain user or group on an + * object. + * + * ACLs are inherited across the object hierarchy. So for example, if a user has + * read permissions on a project, they will also have read permissions on any + * experiment, dataset, etc. created within that project. + * + * To restrict a grant to a particular sub-object, you may specify + * `restrict_object_type` in the ACL, as part of a direct permission grant or as + * part of a role. + */ + removed_acls: Array; +} + export interface APIKey { /** * Unique identifier for the api key @@ -163,64 +190,86 @@ export interface APIKey { user_id?: string | null; } -export interface Code { - data: Code.Bundle | Code.Inline; +export interface ChatCompletionContentPartImage { + image_url: ChatCompletionContentPartImage.ImageURL; - type: 'code'; + type: 'image_url'; } -export namespace Code { - export interface Bundle { - bundle_id: string; +export namespace ChatCompletionContentPartImage { + export interface ImageURL { + url: string; - location: Bundle.Experiment | Bundle.Function; + detail?: 'auto' | 'low' | 'high'; + } +} - runtime_context: Bundle.RuntimeContext; +export interface ChatCompletionContentPartText { + type: 'text'; - type: 'bundle'; + text?: string; +} - /** - * A preview of the code - */ - preview?: string | null; +export interface ChatCompletionMessageToolCall { + id: string; + + function: ChatCompletionMessageToolCall.Function; + + type: 'function'; +} + +export namespace ChatCompletionMessageToolCall { + export interface Function { + arguments: string; + + name: string; } +} - export namespace Bundle { - export interface Experiment { - eval_name: string; +export interface CodeBundle { + bundle_id: string; - position: Shared.Task | Shared.Scorer; + location: CodeBundle.Experiment | CodeBundle.Function; - type: 'experiment'; - } + runtime_context: CodeBundle.RuntimeContext; - export interface Function { - index: number; + /** + * A preview of the code + */ + preview?: string | null; +} + +export namespace CodeBundle { + export interface Experiment { + eval_name: string; - type: 'function'; + position: Experiment.Type | Experiment.Scorer; + + type: 'experiment'; + } + + export namespace Experiment { + export interface Type { + type: 'task'; } - export interface RuntimeContext { - runtime: 'node' | 'python'; + export interface Scorer { + index: number; - version: string; + type: 'scorer'; } } - export interface Inline { - code: string; - - runtime_context: Inline.RuntimeContext; + export interface Function { + index: number; - type: 'inline'; + type: 'function'; } - export namespace Inline { - export interface RuntimeContext { - runtime: 'node' | 'python'; + export interface RuntimeContext { + runtime: 'node' | 'python'; - version: string; - } + version: string; } } @@ -847,7 +896,7 @@ export interface Function { */ _xact_id: string; - function_data: Function.Prompt | Code | Function.Global; + function_data: Function.Prompt | Function.Code | Function.Global; /** * A literal 'p' which identifies the object as a project prompt @@ -914,6 +963,34 @@ export namespace Function { type: 'prompt'; } + export interface Code { + data: Code.Bundle | Code.Inline; + + type: 'code'; + } + + export namespace Code { + export interface Bundle extends Shared.CodeBundle { + type: 'bundle'; + } + + export interface Inline { + code: string; + + runtime_context: Inline.RuntimeContext; + + type: 'inline'; + } + + export namespace Inline { + export interface RuntimeContext { + runtime: 'node' | 'python'; + + version: string; + } + } + } + export interface Global { name: string; @@ -949,8 +1026,7 @@ export namespace Function { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * The function exists for internal purposes and should not be displayed in the @@ -2021,104 +2097,6 @@ export namespace InsertProjectLogsEventReplace { } } -export type Messages = - | Messages.System - | Messages.User - | Messages.Assistant - | Messages.Tool - | Messages.Function - | Messages.Fallback; - -export namespace Messages { - export interface System { - role: 'system'; - - content?: string; - - name?: string; - } - - export interface User { - role: 'user'; - - content?: string | Array; - - name?: string; - } - - export namespace User { - export interface Text { - type: 'text'; - - text?: string; - } - - export interface ImageURL { - image_url: FunctionsAPI.ImageURL; - - type: 'image_url'; - } - } - - export interface Assistant { - role: 'assistant'; - - content?: string | null; - - function_call?: Assistant.FunctionCall | null; - - name?: string | null; - - tool_calls?: Array | null; - } - - export namespace Assistant { - export interface FunctionCall { - arguments: string; - - name: string; - } - - export interface ToolCall { - id: string; - - function: ToolCall.Function; - - type: 'function'; - } - - export namespace ToolCall { - export interface Function { - arguments: string; - - name: string; - } - } - } - - export interface Tool { - role: 'tool'; - - content?: string; - - tool_call_id?: string; - } - - export interface Function { - name: string; - - role: 'function'; - - content?: string; - } - - export interface Fallback { - role: 'model'; - - content?: string | null; - } -} - /** * Summary of a metric's performance */ @@ -2154,6 +2132,42 @@ export interface MetricSummary { diff?: number; } +export interface OnlineScoreConfig { + /** + * The sampling rate for online scoring + */ + sampling_rate: number; + + /** + * The list of scorers to use for online scoring + */ + scorers: Array; + + /** + * Whether to trigger online scoring on the root span of each trace + */ + apply_to_root_span?: boolean | null; + + /** + * Trigger online scoring on any spans with a name in this list + */ + apply_to_span_names?: Array | null; +} + +export namespace OnlineScoreConfig { + export interface Function { + id: string; + + type: 'function'; + } + + export interface Global { + name: string; + + type: 'global'; + } +} + export interface Organization { /** * Unique identifier for the organization @@ -2179,6 +2193,16 @@ export interface Organization { realtime_url?: string | null; } +export interface PatchOrganizationMembersOutput { + status: 'success'; + + /** + * If invite emails failed to send for some reason, the patch operation will still + * complete, but we will return an error message here + */ + send_email_error?: string | null; +} + /** * A path-lookup filter describes an equality comparison against a specific * sub-field in the event row. For instance, if you wish to filter on the value of @@ -2234,7 +2258,7 @@ export interface Project { */ deleted_at?: string | null; - settings?: Project.Settings | null; + settings?: ProjectSettings | null; /** * Identifies the user who created the project @@ -2242,15 +2266,6 @@ export interface Project { user_id?: string | null; } -export namespace Project { - export interface Settings { - /** - * The key used to join two experiments (defaults to `input`). - */ - comparison_key?: string | null; - } -} - export interface ProjectLogsEvent { /** * A unique identifier for the project logs event. If you don't provide one, @@ -2485,7 +2500,7 @@ export interface ProjectScore { /** * The type of the configured score */ - score_type: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online' | null; + score_type: 'slider' | 'categorical' | 'weighted' | 'minimum' | 'online'; user_id: string; @@ -2526,45 +2541,7 @@ export namespace ProjectScore { multi_select?: boolean | null; - online?: Config.Online | null; - } - - export namespace Config { - export interface Online { - /** - * The sampling rate for online scoring - */ - sampling_rate: number; - - /** - * The list of scorers to use for online scoring - */ - scorers: Array; - - /** - * Whether to trigger online scoring on the root span of each trace - */ - apply_to_root_span?: boolean | null; - - /** - * Trigger online scoring on any spans with a name in this list - */ - apply_to_span_names?: Array | null; - } - - export namespace Online { - export interface Function { - id: string; - - type: 'function'; - } - - export interface Global { - name: string; - - type: 'global'; - } - } + online?: Shared.OnlineScoreConfig | null; } } @@ -2583,6 +2560,13 @@ export interface ProjectScoreCategory { value: number; } +export interface ProjectSettings { + /** + * The key used to join two experiments (defaults to `input`). + */ + comparison_key?: string | null; +} + /** * A project tag is a user-configured tag for tracking and filtering your * experiments, logs, and other data @@ -2752,10 +2736,16 @@ export namespace PromptData { } export interface Function { - function: Shared.ToolChoiceFunction; + function: Function.Function; type: 'function'; } + + export namespace Function { + export interface Function { + name: string; + } + } } export interface AnthropicModelParams { @@ -2825,13 +2815,73 @@ export namespace PromptData { } export interface Chat { - messages: Array; + messages: Array; type: 'chat'; tools?: string; } + export namespace Chat { + export interface System { + role: 'system'; + + content?: string; + + name?: string; + } + + export interface User { + role: 'user'; + + content?: string | Array; + + name?: string; + } + + export interface Assistant { + role: 'assistant'; + + content?: string | null; + + function_call?: Assistant.FunctionCall | null; + + name?: string | null; + + tool_calls?: Array | null; + } + + export namespace Assistant { + export interface FunctionCall { + arguments: string; + + name: string; + } + } + + export interface Tool { + role: 'tool'; + + content?: string; + + tool_call_id?: string; + } + + export interface Function { + name: string; + + role: 'function'; + + content?: string; + } + + export interface Fallback { + role: 'model'; + + content?: string | null; + } + } + export interface NullableVariant {} export interface Function { @@ -2847,12 +2897,6 @@ export namespace PromptData { } } -export interface PromptImageURL { - url: string; - - detail?: 'auto' | 'low' | 'high'; -} - /** * Metadata about the state of the repo when the experiment was created */ @@ -2981,8 +3025,7 @@ export namespace Role { | 'create_acls' | 'read_acls' | 'update_acls' - | 'delete_acls' - | null; + | 'delete_acls'; /** * The object type that the ACL applies to @@ -2998,8 +3041,7 @@ export namespace Role { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } } @@ -3033,12 +3075,6 @@ export interface ScoreSummary { diff?: number; } -export interface Scorer { - index: number; - - type: 'scorer'; -} - /** * Summary of a dataset */ @@ -3109,14 +3145,6 @@ export interface SummarizeExperimentResponse { scores?: Record | null; } -export interface Task { - type: 'task'; -} - -export interface ToolChoiceFunction { - name: string; -} - export interface User { /** * Unique identifier for the user @@ -3179,8 +3207,7 @@ export interface View { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Type of table that the view corresponds to. diff --git a/src/resources/views.ts b/src/resources/views.ts index 4b551d1..7d1cfc8 100644 --- a/src/resources/views.ts +++ b/src/resources/views.ts @@ -97,8 +97,7 @@ export interface ViewCreateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Type of table that the view corresponds to. @@ -155,8 +154,7 @@ export interface ViewRetrieveParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } export interface ViewUpdateParams { @@ -179,8 +177,7 @@ export interface ViewUpdateParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Name of the view @@ -237,8 +234,7 @@ export interface ViewListParams extends ListObjectsParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Filter search results to a particular set of object IDs. To specify a list of @@ -286,8 +282,7 @@ export interface ViewDeleteParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; } export interface ViewReplaceParams { @@ -315,8 +310,7 @@ export interface ViewReplaceParams { | 'role' | 'org_member' | 'project_log' - | 'org_project' - | null; + | 'org_project'; /** * Type of table that the view corresponds to.