From f4a934ccffd361516e67b1e353e89b33fdde9dc9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 06:32:22 +0000 Subject: [PATCH] docs: deduplicate and refine comments --- .../client/okhttp/BraintrustOkHttpClient.kt | 1 + .../okhttp/BraintrustOkHttpClientAsync.kt | 1 + .../braintrustdata/api/core/ClientOptions.kt | 1 + .../com/braintrustdata/api/core/Timeout.kt | 35 +- .../com/braintrustdata/api/models/AISecret.kt | 157 +- .../com/braintrustdata/api/models/Acl.kt | 206 +- .../api/models/AclBatchUpdateParams.kt | 467 +++-- .../api/models/AclBatchUpdateResponse.kt | 65 +- .../api/models/AclCreateParams.kt | 286 ++- .../api/models/AclFindAndDeleteParams.kt | 286 ++- .../api/models/AclListParams.kt | 39 +- .../api/models/AiSecretCreateParams.kt | 193 +- .../api/models/AiSecretFindAndDeleteParams.kt | 87 +- .../api/models/AiSecretListParams.kt | 46 +- .../api/models/AiSecretReplaceParams.kt | 193 +- .../api/models/AiSecretUpdateParams.kt | 146 +- .../com/braintrustdata/api/models/ApiKey.kt | 124 +- .../api/models/ApiKeyCreateParams.kt | 87 +- .../api/models/ApiKeyListParams.kt | 43 +- .../models/ChatCompletionContentPartImage.kt | 63 + .../models/ChatCompletionContentPartText.kt | 30 + .../models/ChatCompletionMessageToolCall.kt | 78 + .../braintrustdata/api/models/CodeBundle.kt | 246 ++- .../api/models/CreateApiKeyOutput.kt | 144 +- .../api/models/CrossObjectInsertResponse.kt | 69 +- .../braintrustdata/api/models/DataSummary.kt | 22 +- .../com/braintrustdata/api/models/Dataset.kt | 176 +- .../api/models/DatasetCreateParams.kt | 176 +- .../braintrustdata/api/models/DatasetEvent.kt | 263 ++- .../api/models/DatasetFeedbackParams.kt | 55 +- .../api/models/DatasetFetchParams.kt | 63 +- .../api/models/DatasetFetchPostParams.kt | 379 +--- .../api/models/DatasetInsertParams.kt | 55 +- .../api/models/DatasetListParams.kt | 47 +- .../api/models/DatasetSummarizeParams.kt | 8 +- .../api/models/DatasetUpdateParams.kt | 138 +- .../com/braintrustdata/api/models/EnvVar.kt | 127 +- .../api/models/EnvVarCreateParams.kt | 169 +- .../api/models/EnvVarListParams.kt | 29 +- .../api/models/EnvVarListResponse.kt | 28 +- .../api/models/EnvVarReplaceParams.kt | 169 +- .../api/models/EnvVarUpdateParams.kt | 87 +- .../api/models/EvalCreateParams.kt | 1748 ++++++++++++++--- .../braintrustdata/api/models/Experiment.kt | 301 ++- .../api/models/ExperimentCreateParams.kt | 462 +++-- .../api/models/ExperimentEvent.kt | 599 ++++-- .../api/models/ExperimentFeedbackParams.kt | 55 +- .../api/models/ExperimentFetchParams.kt | 63 +- .../api/models/ExperimentFetchPostParams.kt | 379 +--- .../api/models/ExperimentInsertParams.kt | 55 +- .../api/models/ExperimentListParams.kt | 47 +- .../api/models/ExperimentSummarizeParams.kt | 16 +- .../api/models/ExperimentUpdateParams.kt | 362 +++- .../api/models/FeedbackDatasetItem.kt | 110 +- .../api/models/FeedbackExperimentItem.kt | 129 +- .../api/models/FeedbackProjectLogsItem.kt | 129 +- .../api/models/FeedbackResponseSchema.kt | 15 + .../api/models/FetchDatasetEventsResponse.kt | 49 +- .../models/FetchExperimentEventsResponse.kt | 49 +- .../models/FetchProjectLogsEventsResponse.kt | 49 +- .../com/braintrustdata/api/models/Function.kt | 681 ++++++- .../api/models/FunctionCreateParams.kt | 776 +++++++- .../api/models/FunctionInvokeParams.kt | 828 +++++++- .../api/models/FunctionListParams.kt | 56 +- .../api/models/FunctionReplaceParams.kt | 776 +++++++- .../api/models/FunctionUpdateParams.kt | 517 ++++- .../com/braintrustdata/api/models/Group.kt | 200 +- .../api/models/GroupCreateParams.kt | 246 ++- .../api/models/GroupListParams.kt | 43 +- .../api/models/GroupReplaceParams.kt | 246 ++- .../api/models/GroupUpdateParams.kt | 337 +++- .../api/models/InsertDatasetEvent.kt | 513 ++--- .../api/models/InsertEventsResponse.kt | 20 +- .../api/models/InsertExperimentEvent.kt | 824 ++++---- .../api/models/InsertProjectLogsEvent.kt | 824 ++++---- .../api/models/MetricSummary.kt | 123 +- .../api/models/ObjectReference.kt | 103 +- .../api/models/OnlineScoreConfig.kt | 179 +- .../braintrustdata/api/models/Organization.kt | 135 +- .../api/models/OrganizationListParams.kt | 41 +- .../models/OrganizationMemberUpdateParams.kt | 439 ++++- .../api/models/OrganizationUpdateParams.kt | 191 +- .../models/PatchOrganizationMembersOutput.kt | 55 +- .../com/braintrustdata/api/models/Project.kt | 146 +- .../api/models/ProjectCreateParams.kt | 87 +- .../api/models/ProjectListParams.kt | 43 +- .../api/models/ProjectLogFeedbackParams.kt | 55 +- .../api/models/ProjectLogFetchParams.kt | 63 +- .../api/models/ProjectLogFetchPostParams.kt | 379 +--- .../api/models/ProjectLogInsertParams.kt | 55 +- .../api/models/ProjectLogsEvent.kt | 620 ++++-- .../braintrustdata/api/models/ProjectScore.kt | 211 +- .../api/models/ProjectScoreCategory.kt | 41 +- .../api/models/ProjectScoreConfig.kt | 57 + .../api/models/ProjectScoreCreateParams.kt | 263 ++- .../api/models/ProjectScoreListParams.kt | 55 +- .../api/models/ProjectScoreReplaceParams.kt | 263 ++- .../api/models/ProjectScoreUpdateParams.kt | 229 ++- .../api/models/ProjectSettings.kt | 144 +- .../braintrustdata/api/models/ProjectTag.kt | 145 +- .../api/models/ProjectTagCreateParams.kt | 175 +- .../api/models/ProjectTagListParams.kt | 47 +- .../api/models/ProjectTagReplaceParams.kt | 175 +- .../api/models/ProjectTagUpdateParams.kt | 137 +- .../api/models/ProjectUpdateParams.kt | 86 +- .../com/braintrustdata/api/models/Prompt.kt | 275 ++- .../api/models/PromptCreateParams.kt | 309 ++- .../braintrustdata/api/models/PromptData.kt | 736 +++++++ .../api/models/PromptListParams.kt | 56 +- .../api/models/PromptOptions.kt | 802 +++++++- .../api/models/PromptReplaceParams.kt | 309 ++- .../api/models/PromptUpdateParams.kt | 241 ++- .../com/braintrustdata/api/models/RepoInfo.kt | 206 +- .../com/braintrustdata/api/models/Role.kt | 257 ++- .../api/models/RoleCreateParams.kt | 290 ++- .../api/models/RoleListParams.kt | 43 +- .../api/models/RoleReplaceParams.kt | 290 ++- .../api/models/RoleUpdateParams.kt | 427 +++- .../braintrustdata/api/models/ScoreSummary.kt | 103 +- .../api/models/SpanAttributes.kt | 45 +- .../braintrustdata/api/models/SpanIFrame.kt | 198 +- .../api/models/SpanIframeCreateParams.kt | 221 ++- .../api/models/SpanIframeListParams.kt | 43 +- .../api/models/SpanIframeReplaceParams.kt | 221 ++- .../api/models/SpanIframeUpdateParams.kt | 187 +- .../api/models/SummarizeDatasetResponse.kt | 108 +- .../api/models/SummarizeExperimentResponse.kt | 156 +- .../com/braintrustdata/api/models/User.kt | 135 +- .../api/models/UserListParams.kt | 86 +- .../com/braintrustdata/api/models/View.kt | 218 +- .../api/models/ViewCreateParams.kt | 353 +++- .../com/braintrustdata/api/models/ViewData.kt | 18 + .../api/models/ViewDataSearch.kt | 89 + .../api/models/ViewDeleteParams.kt | 84 +- .../api/models/ViewListParams.kt | 43 +- .../braintrustdata/api/models/ViewOptions.kt | 107 + .../api/models/ViewReplaceParams.kt | 353 +++- .../api/models/ViewUpdateParams.kt | 311 ++- 138 files changed, 21642 insertions(+), 7008 deletions(-) diff --git a/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClient.kt b/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClient.kt index 94c291ac..3bcb97dc 100755 --- a/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClient.kt +++ b/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClient.kt @@ -146,6 +146,7 @@ class BraintrustOkHttpClient private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } diff --git a/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClientAsync.kt b/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClientAsync.kt index ffc88f5c..008b59ad 100755 --- a/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClientAsync.kt +++ b/braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClientAsync.kt @@ -148,6 +148,7 @@ class BraintrustOkHttpClientAsync private constructor() { fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/ClientOptions.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/ClientOptions.kt index 38dc1b87..0c70ecf4 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/ClientOptions.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/ClientOptions.kt @@ -94,6 +94,7 @@ private constructor( fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } + /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) fun headers(headers: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/Timeout.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/Timeout.kt index 6a0cdcc7..0ca642cc 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/Timeout.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/core/Timeout.kt @@ -90,13 +90,7 @@ private constructor( */ fun connect(connect: Duration?) = apply { this.connect = connect } - /** - * The maximum time allowed to establish a connection with a host. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `Duration.ofMinutes(1)`. - */ + /** Alias for calling [Builder.connect] with `connect.orElse(null)`. */ fun connect(connect: Optional) = connect(connect.getOrNull()) /** @@ -108,13 +102,7 @@ private constructor( */ fun read(read: Duration?) = apply { this.read = read } - /** - * The maximum time allowed between two data packets when waiting for the server’s response. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `request()`. - */ + /** Alias for calling [Builder.read] with `read.orElse(null)`. */ fun read(read: Optional) = read(read.getOrNull()) /** @@ -126,13 +114,7 @@ private constructor( */ fun write(write: Duration?) = apply { this.write = write } - /** - * The maximum time allowed between two data packets when sending the request to the server. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `request()`. - */ + /** Alias for calling [Builder.write] with `write.orElse(null)`. */ fun write(write: Optional) = write(write.getOrNull()) /** @@ -147,16 +129,7 @@ private constructor( */ fun request(request: Duration?) = apply { this.request = request } - /** - * The maximum time allowed for a complete HTTP call, not including retries. - * - * This includes resolving DNS, connecting, writing the request body, server processing, as - * well as reading the response body. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `Duration.ofMinutes(1)`. - */ + /** Alias for calling [Builder.request] with `request.orElse(null)`. */ fun request(request: Optional) = request(request.getOrNull()) fun build(): Timeout = Timeout(connect, read, write, request) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AISecret.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AISecret.kt index b0cad87e..041565d0 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AISecret.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AISecret.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -42,50 +43,122 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the AI secret */ + /** + * Unique identifier for the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the organization */ + /** + * Unique identifier for the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun orgId(): String = orgId.getRequired("org_id") - /** Date of AI secret creation */ + /** + * Date of AI secret creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun previewSecret(): Optional = Optional.ofNullable(previewSecret.getNullable("preview_secret")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** Date of last AI secret update */ + /** + * Date of last AI secret update + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun updatedAt(): Optional = Optional.ofNullable(updatedAt.getNullable("updated_at")) - /** Unique identifier for the AI secret */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the organization */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Date of AI secret creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [previewSecret]. + * + * Unlike [previewSecret], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("preview_secret") @ExcludeMissing fun _previewSecret(): JsonField = previewSecret + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** Date of last AI secret update */ + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("updated_at") @ExcludeMissing fun _updatedAt(): JsonField = updatedAt @@ -158,59 +231,109 @@ private constructor( /** Unique identifier for the AI secret */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the AI secret */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the AI secret */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the organization */ fun orgId(orgId: String) = orgId(JsonField.of(orgId)) - /** Unique identifier for the organization */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Date of AI secret creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of AI secret creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of AI secret creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun previewSecret(previewSecret: String?) = previewSecret(JsonField.ofNullable(previewSecret)) + /** Alias for calling [Builder.previewSecret] with `previewSecret.orElse(null)`. */ fun previewSecret(previewSecret: Optional) = previewSecret(previewSecret.getOrNull()) + /** + * Sets [Builder.previewSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.previewSecret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun previewSecret(previewSecret: JsonField) = apply { this.previewSecret = previewSecret } fun type(type: String?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } /** Date of last AI secret update */ fun updatedAt(updatedAt: OffsetDateTime?) = updatedAt(JsonField.ofNullable(updatedAt)) - /** Date of last AI secret update */ + /** Alias for calling [Builder.updatedAt] with `updatedAt.orElse(null)`. */ fun updatedAt(updatedAt: Optional) = updatedAt(updatedAt.getOrNull()) - /** Date of last AI secret update */ + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Acl.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Acl.kt index bf184e19..09ff74d7 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Acl.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Acl.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -64,87 +65,165 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the acl */ + /** + * Unique identifier for the acl + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The organization the ACL's referred object belongs to */ + /** + * The organization the ACL's referred object belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun _objectOrgId(): String = _objectOrgId.getRequired("_object_org_id") - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") - /** Date of acl creation */ + /** + * Date of acl creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun groupId(): Optional = Optional.ofNullable(groupId.getNullable("group_id")) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun permission(): Optional = Optional.ofNullable(permission.getNullable("permission")) /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) - /** Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun roleId(): Optional = Optional.ofNullable(roleId.getNullable("role_id")) /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the acl */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The organization the ACL's referred object belongs to */ + /** + * Returns the raw JSON value of [_objectOrgId]. + * + * Unlike [_objectOrgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("_object_org_id") @ExcludeMissing fun __objectOrgId(): JsonField = _objectOrgId - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Date of acl creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("group_id") @ExcludeMissing fun _groupId(): JsonField = groupId - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType - /** Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role_id") @ExcludeMissing fun _roleId(): JsonField = roleId /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @@ -223,13 +302,24 @@ private constructor( /** Unique identifier for the acl */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the acl */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The organization the ACL's referred object belongs to */ fun _objectOrgId(_objectOrgId: String) = _objectOrgId(JsonField.of(_objectOrgId)) - /** The organization the ACL's referred object belongs to */ + /** + * Sets [Builder._objectOrgId] to an arbitrary JSON value. + * + * You should usually call [Builder._objectOrgId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun _objectOrgId(_objectOrgId: JsonField) = apply { this._objectOrgId = _objectOrgId } @@ -237,13 +327,24 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -251,10 +352,16 @@ private constructor( /** Date of acl creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of acl creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of acl creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** @@ -263,25 +370,30 @@ private constructor( */ fun groupId(groupId: String?) = groupId(JsonField.ofNullable(groupId)) - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun groupId(groupId: JsonField) = apply { this.groupId = groupId } /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ fun permission(permission: Permission?) = permission(JsonField.ofNullable(permission)) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun permission(permission: JsonField) = apply { this.permission = permission } /** @@ -292,15 +404,17 @@ private constructor( restrictObjectType(JsonField.ofNullable(restrictObjectType)) /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed [AclObjectType] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType @@ -311,13 +425,14 @@ private constructor( */ fun roleId(roleId: String?) = roleId(JsonField.ofNullable(roleId)) - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun roleId(roleId: JsonField) = apply { this.roleId = roleId } @@ -327,15 +442,14 @@ private constructor( */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun userId(userId: JsonField) = apply { this.userId = userId } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateParams.kt index c133533b..2160900e 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -42,6 +43,9 @@ private constructor( * * 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. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun addAcls(): Optional> = body.addAcls() @@ -54,30 +58,23 @@ private constructor( * * 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. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun removeAcls(): Optional> = body.removeAcls() /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Returns the raw JSON value of [addAcls]. * - * 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. + * Unlike [addAcls], this method doesn't throw if the JSON field has an unexpected type. */ fun _addAcls(): JsonField> = body._addAcls() /** - * 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. + * Returns the raw JSON value of [removeAcls]. * - * 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. + * Unlike [removeAcls], this method doesn't throw if the JSON field has an unexpected type. */ fun _removeAcls(): JsonField> = body._removeAcls() @@ -116,6 +113,9 @@ private constructor( * * 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. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun addAcls(): Optional> = Optional.ofNullable(addAcls.getNullable("add_acls")) @@ -128,31 +128,24 @@ private constructor( * * 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. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun removeAcls(): Optional> = Optional.ofNullable(removeAcls.getNullable("remove_acls")) /** - * 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. + * Returns the raw JSON value of [addAcls]. * - * 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. + * Unlike [addAcls], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("add_acls") @ExcludeMissing fun _addAcls(): JsonField> = addAcls /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Returns the raw JSON value of [removeAcls]. * - * 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. + * Unlike [removeAcls], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("remove_acls") @ExcludeMissing @@ -209,44 +202,24 @@ private constructor( */ fun addAcls(addAcls: List?) = addAcls(JsonField.ofNullable(addAcls)) - /** - * 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. - */ + /** Alias for calling [Builder.addAcls] with `addAcls.orElse(null)`. */ fun addAcls(addAcls: Optional>) = addAcls(addAcls.getOrNull()) /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Sets [Builder.addAcls] to an arbitrary JSON value. * - * 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. + * You should usually call [Builder.addAcls] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun addAcls(addAcls: JsonField>) = apply { this.addAcls = addAcls.map { it.toMutableList() } } /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Adds a single [AddAcl] to [addAcls]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addAddAcl(addAcl: AddAcl) = apply { addAcls = @@ -269,45 +242,25 @@ private constructor( fun removeAcls(removeAcls: List?) = removeAcls(JsonField.ofNullable(removeAcls)) - /** - * 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. - */ + /** Alias for calling [Builder.removeAcls] with `removeAcls.orElse(null)`. */ fun removeAcls(removeAcls: Optional>) = removeAcls(removeAcls.getOrNull()) /** - * 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. + * Sets [Builder.removeAcls] to an arbitrary JSON value. * - * 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. + * You should usually call [Builder.removeAcls] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun removeAcls(removeAcls: JsonField>) = apply { this.removeAcls = removeAcls.map { it.toMutableList() } } /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Adds a single [RemoveAcl] to [removeAcls]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addRemoveAcl(removeAcl: RemoveAcl) = apply { removeAcls = @@ -398,39 +351,22 @@ private constructor( */ fun addAcls(addAcls: List?) = apply { body.addAcls(addAcls) } - /** - * 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. - */ + /** Alias for calling [Builder.addAcls] with `addAcls.orElse(null)`. */ fun addAcls(addAcls: Optional>) = addAcls(addAcls.getOrNull()) /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Sets [Builder.addAcls] to an arbitrary JSON value. * - * 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. + * You should usually call [Builder.addAcls] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun addAcls(addAcls: JsonField>) = apply { body.addAcls(addAcls) } /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Adds a single [AddAcl] to [addAcls]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addAddAcl(addAcl: AddAcl) = apply { body.addAddAcl(addAcl) } @@ -446,41 +382,24 @@ private constructor( */ fun removeAcls(removeAcls: List?) = apply { body.removeAcls(removeAcls) } - /** - * 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. - */ + /** Alias for calling [Builder.removeAcls] with `removeAcls.orElse(null)`. */ fun removeAcls(removeAcls: Optional>) = removeAcls(removeAcls.getOrNull()) /** - * 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. + * Sets [Builder.removeAcls] to an arbitrary JSON value. * - * 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. + * You should usually call [Builder.removeAcls] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun removeAcls(removeAcls: JsonField>) = apply { body.removeAcls(removeAcls) } /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Adds a single [RemoveAcl] to [removeAcls]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addRemoveAcl(removeAcl: RemoveAcl) = apply { body.addRemoveAcl(removeAcl) } @@ -648,75 +567,120 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun groupId(): Optional = Optional.ofNullable(groupId.getNullable("group_id")) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun permission(): Optional = Optional.ofNullable(permission.getNullable("permission")) /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun roleId(): Optional = Optional.ofNullable(roleId.getNullable("role_id")) /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("group_id") @ExcludeMissing fun _groupId(): JsonField = groupId - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("role_id") @ExcludeMissing fun _roleId(): JsonField = roleId /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @@ -784,13 +748,25 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -801,15 +777,15 @@ private constructor( */ fun groupId(groupId: String?) = groupId(JsonField.ofNullable(groupId)) - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun groupId(groupId: JsonField) = apply { this.groupId = groupId } @@ -818,13 +794,15 @@ private constructor( */ fun permission(permission: Permission?) = permission(JsonField.ofNullable(permission)) - /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -838,15 +816,18 @@ private constructor( restrictObjectType(JsonField.ofNullable(restrictObjectType)) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType @@ -858,15 +839,15 @@ private constructor( */ fun roleId(roleId: String?) = roleId(JsonField.ofNullable(roleId)) - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun roleId(roleId: JsonField) = apply { this.roleId = roleId } @@ -876,15 +857,15 @@ private constructor( */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun userId(userId: JsonField) = apply { this.userId = userId } @@ -977,75 +958,120 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun groupId(): Optional = Optional.ofNullable(groupId.getNullable("group_id")) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun permission(): Optional = Optional.ofNullable(permission.getNullable("permission")) /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun roleId(): Optional = Optional.ofNullable(roleId.getNullable("role_id")) /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("group_id") @ExcludeMissing fun _groupId(): JsonField = groupId - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("role_id") @ExcludeMissing fun _roleId(): JsonField = roleId /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @@ -1113,13 +1139,25 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -1130,15 +1168,15 @@ private constructor( */ fun groupId(groupId: String?) = groupId(JsonField.ofNullable(groupId)) - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun groupId(groupId: JsonField) = apply { this.groupId = groupId } @@ -1147,13 +1185,15 @@ private constructor( */ fun permission(permission: Permission?) = permission(JsonField.ofNullable(permission)) - /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -1167,15 +1207,18 @@ private constructor( restrictObjectType(JsonField.ofNullable(restrictObjectType)) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType @@ -1187,15 +1230,15 @@ private constructor( */ fun roleId(roleId: String?) = roleId(JsonField.ofNullable(roleId)) - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun roleId(roleId: JsonField) = apply { this.roleId = roleId } @@ -1205,15 +1248,15 @@ private constructor( */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun userId(userId: JsonField) = apply { this.userId = userId } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateResponse.kt index eec25147..bb393790 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclBatchUpdateResponse.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -39,6 +40,9 @@ private constructor( * * 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. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun addedAcls(): List = addedAcls.getRequired("added_acls") @@ -51,30 +55,23 @@ private constructor( * * 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. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun removedAcls(): List = removedAcls.getRequired("removed_acls") /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Returns the raw JSON value of [addedAcls]. * - * 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. + * Unlike [addedAcls], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("added_acls") @ExcludeMissing fun _addedAcls(): JsonField> = addedAcls /** - * 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. + * Returns the raw JSON value of [removedAcls]. * - * 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. + * Unlike [removedAcls], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("removed_acls") @ExcludeMissing @@ -139,28 +136,20 @@ private constructor( fun addedAcls(addedAcls: List) = addedAcls(JsonField.of(addedAcls)) /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Sets [Builder.addedAcls] to an arbitrary JSON value. * - * 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. + * You should usually call [Builder.addedAcls] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun addedAcls(addedAcls: JsonField>) = apply { this.addedAcls = addedAcls.map { it.toMutableList() } } /** - * 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. + * Adds a single [Acl] to [addedAcls]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addAddedAcl(addedAcl: Acl) = apply { addedAcls = @@ -182,28 +171,20 @@ private constructor( fun removedAcls(removedAcls: List) = removedAcls(JsonField.of(removedAcls)) /** - * 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. + * Sets [Builder.removedAcls] to an arbitrary JSON value. * - * 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. + * You should usually call [Builder.removedAcls] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun removedAcls(removedAcls: JsonField>) = apply { this.removedAcls = removedAcls.map { it.toMutableList() } } /** - * An ACL grants a certain permission or role to a certain user or group on an object. + * Adds a single [Acl] to [removedAcls]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addRemovedAcl(removedAcl: Acl) = apply { removedAcls = diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclCreateParams.kt index c6266e37..387d9a11 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,59 +33,110 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = body.objectType() /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun groupId(): Optional = body.groupId() - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun permission(): Optional = body.permission() /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun restrictObjectType(): Optional = body.restrictObjectType() - /** Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun roleId(): Optional = body.roleId() /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun userId(): Optional = body.userId() - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ fun _groupId(): JsonField = body._groupId() - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ fun _permission(): JsonField = body._permission() /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an unexpected + * type. */ fun _restrictObjectType(): JsonField = body._restrictObjectType() - /** Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _roleId(): JsonField = body._roleId() /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ fun _userId(): JsonField = body._userId() @@ -139,75 +191,120 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun groupId(): Optional = Optional.ofNullable(groupId.getNullable("group_id")) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun permission(): Optional = Optional.ofNullable(permission.getNullable("permission")) /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun roleId(): Optional = Optional.ofNullable(roleId.getNullable("role_id")) /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("group_id") @ExcludeMissing fun _groupId(): JsonField = groupId - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("role_id") @ExcludeMissing fun _roleId(): JsonField = roleId /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @@ -275,13 +372,25 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -292,15 +401,15 @@ private constructor( */ fun groupId(groupId: String?) = groupId(JsonField.ofNullable(groupId)) - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun groupId(groupId: JsonField) = apply { this.groupId = groupId } @@ -309,13 +418,15 @@ private constructor( */ fun permission(permission: Permission?) = permission(JsonField.ofNullable(permission)) - /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -329,15 +440,18 @@ private constructor( restrictObjectType(JsonField.ofNullable(restrictObjectType)) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType @@ -349,15 +463,15 @@ private constructor( */ fun roleId(roleId: String?) = roleId(JsonField.ofNullable(roleId)) - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun roleId(roleId: JsonField) = apply { this.roleId = roleId } @@ -367,15 +481,15 @@ private constructor( */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun userId(userId: JsonField) = apply { this.userId = userId } @@ -463,13 +577,24 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = apply { body.objectType(objectType) } - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** @@ -478,25 +603,30 @@ private constructor( */ fun groupId(groupId: String?) = apply { body.groupId(groupId) } - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun groupId(groupId: JsonField) = apply { body.groupId(groupId) } /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ fun permission(permission: Permission?) = apply { body.permission(permission) } - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun permission(permission: JsonField) = apply { body.permission(permission) } /** @@ -508,15 +638,17 @@ private constructor( } /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed [AclObjectType] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { body.restrictObjectType(restrictObjectType) @@ -527,13 +659,14 @@ private constructor( */ fun roleId(roleId: String?) = apply { body.roleId(roleId) } - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun roleId(roleId: JsonField) = apply { body.roleId(roleId) } @@ -543,15 +676,14 @@ private constructor( */ fun userId(userId: String?) = apply { body.userId(userId) } - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun userId(userId: JsonField) = apply { body.userId(userId) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclFindAndDeleteParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclFindAndDeleteParams.kt index 237fc6b6..968fe6ce 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclFindAndDeleteParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclFindAndDeleteParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -29,59 +30,110 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = body.objectType() /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun groupId(): Optional = body.groupId() - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun permission(): Optional = body.permission() /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun restrictObjectType(): Optional = body.restrictObjectType() - /** Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun roleId(): Optional = body.roleId() /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun userId(): Optional = body.userId() - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ fun _groupId(): JsonField = body._groupId() - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ fun _permission(): JsonField = body._permission() /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an unexpected + * type. */ fun _restrictObjectType(): JsonField = body._restrictObjectType() - /** Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _roleId(): JsonField = body._roleId() /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ fun _userId(): JsonField = body._userId() @@ -136,75 +188,120 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the object the ACL applies to */ + /** + * The id of the object the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun groupId(): Optional = Optional.ofNullable(groupId.getNullable("group_id")) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun permission(): Optional = Optional.ofNullable(permission.getNullable("permission")) /** * When setting a permission directly, optionally restricts the permission grant to just the * specified object type. Cannot be set alongside a `role_id`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun roleId(): Optional = Optional.ofNullable(roleId.getNullable("role_id")) /** * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be * provided + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The id of the object the ACL applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("group_id") @ExcludeMissing fun _groupId(): JsonField = groupId - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Returns the raw JSON value of [permission]. + * + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Returns the raw JSON value of [roleId]. + * + * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("role_id") @ExcludeMissing fun _roleId(): JsonField = roleId /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @@ -272,13 +369,25 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -289,15 +398,15 @@ private constructor( */ fun groupId(groupId: String?) = groupId(JsonField.ofNullable(groupId)) - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun groupId(groupId: JsonField) = apply { this.groupId = groupId } @@ -306,13 +415,15 @@ private constructor( */ fun permission(permission: Permission?) = permission(JsonField.ofNullable(permission)) - /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -326,15 +437,18 @@ private constructor( restrictObjectType(JsonField.ofNullable(restrictObjectType)) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just - * the specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType @@ -346,15 +460,15 @@ private constructor( */ fun roleId(roleId: String?) = roleId(JsonField.ofNullable(roleId)) - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be - * provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun roleId(roleId: JsonField) = apply { this.roleId = roleId } @@ -364,15 +478,15 @@ private constructor( */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun userId(userId: JsonField) = apply { this.userId = userId } @@ -460,13 +574,24 @@ private constructor( /** The id of the object the ACL applies to */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the ACL applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = apply { body.objectType(objectType) } - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** @@ -475,25 +600,30 @@ private constructor( */ fun groupId(groupId: String?) = apply { body.groupId(groupId) } - /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) /** - * Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun groupId(groupId: JsonField) = apply { body.groupId(groupId) } /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ fun permission(permission: Permission?) = apply { body.permission(permission) } - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** Alias for calling [Builder.permission] with `permission.orElse(null)`. */ fun permission(permission: Optional) = permission(permission.getOrNull()) - /** Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ + /** + * Sets [Builder.permission] to an arbitrary JSON value. + * + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun permission(permission: JsonField) = apply { body.permission(permission) } /** @@ -505,15 +635,17 @@ private constructor( } /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Alias for calling [Builder.restrictObjectType] with `restrictObjectType.orElse(null)`. */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) /** - * When setting a permission directly, optionally restricts the permission grant to just the - * specified object type. Cannot be set alongside a `role_id`. + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed [AclObjectType] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun restrictObjectType(restrictObjectType: JsonField) = apply { body.restrictObjectType(restrictObjectType) @@ -524,13 +656,14 @@ private constructor( */ fun roleId(roleId: String?) = apply { body.roleId(roleId) } - /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ + /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */ fun roleId(roleId: Optional) = roleId(roleId.getOrNull()) /** - * Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be provided + * Sets [Builder.roleId] to an arbitrary JSON value. + * + * You should usually call [Builder.roleId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun roleId(roleId: JsonField) = apply { body.roleId(roleId) } @@ -540,15 +673,14 @@ private constructor( */ fun userId(userId: String?) = apply { body.userId(userId) } - /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided - */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) /** - * Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will be - * provided + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun userId(userId: JsonField) = apply { body.userId(userId) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclListParams.kt index 6f389829..c61cbd7d 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AclListParams.kt @@ -146,13 +146,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -161,31 +155,26 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** @@ -197,13 +186,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt index 4de28c65..9092df23 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,44 +33,78 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * AI Secret belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() /** * Secret value. If omitted in a PUT request, the existing secret value will be left intact, not * replaced with null. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun secret(): Optional = body.secret() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = body.type() - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * AI Secret belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, not - * replaced with null. + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. */ fun _secret(): JsonField = body._secret() + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ fun _type(): JsonField = body._type() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -107,44 +142,78 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the AI Secret belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) /** * Secret value. If omitted in a PUT request, the existing secret value will be left intact, * not replaced with null. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun secret(): Optional = Optional.ofNullable(secret.getNullable("secret")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, - * not replaced with null. + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("secret") @ExcludeMissing fun _secret(): JsonField = secret + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -204,13 +273,27 @@ private constructor( /** Name of the AI secret */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** @@ -220,17 +303,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -240,22 +321,30 @@ private constructor( */ fun secret(secret: String?) = secret(JsonField.ofNullable(secret)) - /** - * Secret value. If omitted in a PUT request, the existing secret value will be left - * intact, not replaced with null. - */ + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ fun secret(secret: Optional) = secret(secret.getOrNull()) /** - * Secret value. If omitted in a PUT request, the existing secret value will be left - * intact, not replaced with null. + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun secret(secret: JsonField) = apply { this.secret = secret } fun type(type: String?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -339,13 +428,26 @@ private constructor( /** Name of the AI secret */ fun name(name: String) = apply { body.name(name) } - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** @@ -355,17 +457,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } @@ -375,22 +474,28 @@ private constructor( */ fun secret(secret: String?) = apply { body.secret(secret) } - /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, - * not replaced with null. - */ + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ fun secret(secret: Optional) = secret(secret.getOrNull()) /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, - * not replaced with null. + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun secret(secret: JsonField) = apply { body.secret(secret) } fun type(type: String?) = apply { body.type(type) } + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { body.type(type) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt index 09e2cfab..4dfef4d2 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -29,23 +30,35 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * AI Secret belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * AI Secret belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -75,23 +88,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the AI Secret belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -143,7 +168,13 @@ private constructor( /** Name of the AI secret */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -153,17 +184,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -241,7 +270,12 @@ private constructor( /** Name of the AI secret */ fun name(name: String) = apply { body.name(name) } - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -251,17 +285,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt index d41f9f78..da87f527 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt @@ -133,16 +133,19 @@ private constructor( /** Name of the ai_secret to search for */ fun aiSecretName(aiSecretName: String?) = apply { this.aiSecretName = aiSecretName } - /** Name of the ai_secret to search for */ + /** Alias for calling [Builder.aiSecretName] with `aiSecretName.orElse(null)`. */ fun aiSecretName(aiSecretName: Optional) = aiSecretName(aiSecretName.getOrNull()) fun aiSecretType(aiSecretType: AiSecretType?) = apply { this.aiSecretType = aiSecretType } + /** Alias for calling [Builder.aiSecretType] with `aiSecretType.orElse(null)`. */ fun aiSecretType(aiSecretType: Optional) = aiSecretType(aiSecretType.getOrNull()) + /** Alias for calling [aiSecretType] with `AiSecretType.ofString(string)`. */ fun aiSecretType(string: String) = aiSecretType(AiSecretType.ofString(string)) + /** Alias for calling [aiSecretType] with `AiSecretType.ofStrings(strings)`. */ fun aiSecretTypeOfStrings(strings: List) = aiSecretType(AiSecretType.ofStrings(strings)) @@ -155,13 +158,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -170,37 +167,32 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** @@ -212,13 +204,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt index 30fafd07..875a99c6 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,44 +33,78 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * AI Secret belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() /** * Secret value. If omitted in a PUT request, the existing secret value will be left intact, not * replaced with null. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun secret(): Optional = body.secret() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = body.type() - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * AI Secret belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, not - * replaced with null. + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. */ fun _secret(): JsonField = body._secret() + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ fun _type(): JsonField = body._type() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -107,44 +142,78 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the AI Secret belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) /** * Secret value. If omitted in a PUT request, the existing secret value will be left intact, * not replaced with null. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun secret(): Optional = Optional.ofNullable(secret.getNullable("secret")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, - * not replaced with null. + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("secret") @ExcludeMissing fun _secret(): JsonField = secret + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -204,13 +273,27 @@ private constructor( /** Name of the AI secret */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** @@ -220,17 +303,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -240,22 +321,30 @@ private constructor( */ fun secret(secret: String?) = secret(JsonField.ofNullable(secret)) - /** - * Secret value. If omitted in a PUT request, the existing secret value will be left - * intact, not replaced with null. - */ + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ fun secret(secret: Optional) = secret(secret.getOrNull()) /** - * Secret value. If omitted in a PUT request, the existing secret value will be left - * intact, not replaced with null. + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun secret(secret: JsonField) = apply { this.secret = secret } fun type(type: String?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -339,13 +428,26 @@ private constructor( /** Name of the AI secret */ fun name(name: String) = apply { body.name(name) } - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** @@ -355,17 +457,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the AI Secret belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } @@ -375,22 +474,28 @@ private constructor( */ fun secret(secret: String?) = apply { body.secret(secret) } - /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, - * not replaced with null. - */ + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ fun secret(secret: Optional) = secret(secret.getOrNull()) /** - * Secret value. If omitted in a PUT request, the existing secret value will be left intact, - * not replaced with null. + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun secret(secret: JsonField) = apply { body.secret(secret) } fun type(type: String?) = apply { body.type(type) } + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { body.type(type) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt index a1146def..42e63b47 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,22 +38,58 @@ private constructor( /** AiSecret id */ fun aiSecretId(): String = aiSecretId + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun secret(): Optional = body.secret() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = body.type() + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() + /** + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. + */ fun _secret(): JsonField = body._secret() + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ fun _type(): JsonField = body._type() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -94,22 +131,58 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Name of the AI secret */ + /** + * Name of the AI secret + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun secret(): Optional = Optional.ofNullable(secret.getNullable("secret")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Name of the AI secret */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("secret") @ExcludeMissing fun _secret(): JsonField = secret + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -158,29 +231,59 @@ private constructor( fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Name of the AI secret */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the AI secret */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun secret(secret: String?) = secret(JsonField.ofNullable(secret)) + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ fun secret(secret: Optional) = secret(secret.getOrNull()) + /** + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun secret(secret: JsonField) = apply { this.secret = secret } fun type(type: String?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -261,29 +364,56 @@ private constructor( fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** Name of the AI secret */ fun name(name: String?) = apply { body.name(name) } - /** Name of the AI secret */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the AI secret */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } fun secret(secret: String?) = apply { body.secret(secret) } + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ fun secret(secret: Optional) = secret(secret.getOrNull()) + /** + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun secret(secret: JsonField) = apply { body.secret(secret) } fun type(type: String?) = apply { body.type(type) } + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { body.type(type) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKey.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKey.kt index 0b88b229..0a18e742 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKey.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKey.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -38,40 +39,94 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the api key */ + /** + * Unique identifier for the api key + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the api key */ + /** + * Name of the api key + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun previewName(): String = previewName.getRequired("preview_name") - /** Date of api key creation */ + /** + * Date of api key creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Unique identifier for the organization */ + /** + * Unique identifier for the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun orgId(): Optional = Optional.ofNullable(orgId.getNullable("org_id")) - /** Unique identifier for the user */ + /** + * Unique identifier for the user + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the api key */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the api key */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [previewName]. + * + * Unlike [previewName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("preview_name") @ExcludeMissing fun _previewName(): JsonField = previewName - /** Date of api key creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Unique identifier for the organization */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Unique identifier for the user */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -136,44 +191,77 @@ private constructor( /** Unique identifier for the api key */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the api key */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the api key */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the api key */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun previewName(previewName: String) = previewName(JsonField.of(previewName)) + /** + * Sets [Builder.previewName] to an arbitrary JSON value. + * + * You should usually call [Builder.previewName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun previewName(previewName: JsonField) = apply { this.previewName = previewName } /** Date of api key creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of api key creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of api key creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Unique identifier for the organization */ fun orgId(orgId: String?) = orgId(JsonField.ofNullable(orgId)) - /** Unique identifier for the organization */ + /** Alias for calling [Builder.orgId] with `orgId.orElse(null)`. */ fun orgId(orgId: Optional) = orgId(orgId.getOrNull()) - /** Unique identifier for the organization */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Unique identifier for the user */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Unique identifier for the user */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Unique identifier for the user */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyCreateParams.kt index a66bf130..2b0fe95a 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,23 +33,35 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the api key. Does not have to be unique */ + /** + * Name of the api key. Does not have to be unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * API key belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the api key. Does not have to be unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * API key belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -78,23 +91,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the api key. Does not have to be unique */ + /** + * Name of the api key. Does not have to be unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the API key belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the api key. Does not have to be unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the API key belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -146,7 +171,13 @@ private constructor( /** Name of the api key. Does not have to be unique */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the api key. Does not have to be unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -156,17 +187,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the API key belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the API key belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -244,7 +273,12 @@ private constructor( /** Name of the api key. Does not have to be unique */ fun name(name: String) = apply { body.name(name) } - /** Name of the api key. Does not have to be unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -254,17 +288,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the API key belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the API key belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyListParams.kt index 124f92d2..46f9e571 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ApiKeyListParams.kt @@ -127,7 +127,7 @@ private constructor( /** Name of the api_key to search for */ fun apiKeyName(apiKeyName: String?) = apply { this.apiKeyName = apiKeyName } - /** Name of the api_key to search for */ + /** Alias for calling [Builder.apiKeyName] with `apiKeyName.orElse(null)`. */ fun apiKeyName(apiKeyName: Optional) = apiKeyName(apiKeyName.getOrNull()) /** @@ -139,13 +139,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -154,37 +148,32 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** @@ -196,13 +185,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartImage.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartImage.kt index fcb0d184..0a47e4ef 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartImage.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartImage.kt @@ -30,12 +30,30 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun imageUrl(): ImageUrl = imageUrl.getRequired("image_url") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [imageUrl]. + * + * Unlike [imageUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("image_url") @ExcludeMissing fun _imageUrl(): JsonField = imageUrl + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -88,10 +106,23 @@ private constructor( fun imageUrl(imageUrl: ImageUrl) = imageUrl(JsonField.of(imageUrl)) + /** + * Sets [Builder.imageUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.imageUrl] with a well-typed [ImageUrl] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun imageUrl(imageUrl: JsonField) = apply { this.imageUrl = imageUrl } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -133,12 +164,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun detail(): Optional = Optional.ofNullable(detail.getNullable("detail")) + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + /** + * Returns the raw JSON value of [detail]. + * + * Unlike [detail], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("detail") @ExcludeMissing fun _detail(): JsonField = detail @JsonAnyGetter @@ -188,10 +237,24 @@ private constructor( fun url(url: String) = url(JsonField.of(url)) + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun url(url: JsonField) = apply { this.url = url } fun detail(detail: Detail) = detail(JsonField.of(detail)) + /** + * Sets [Builder.detail] to an arbitrary JSON value. + * + * You should usually call [Builder.detail] with a well-typed [Detail] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun detail(detail: JsonField) = apply { this.detail = detail } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartText.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartText.kt index c4b1ce91..6d1a633b 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartText.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionContentPartText.kt @@ -28,12 +28,30 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun text(): Optional = Optional.ofNullable(text.getNullable("text")) + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text @JsonAnyGetter @@ -84,10 +102,22 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun text(text: String) = text(JsonField.of(text)) + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun text(text: JsonField) = apply { this.text = text } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionMessageToolCall.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionMessageToolCall.kt index 3ae3ad83..2add01f0 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionMessageToolCall.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ChatCompletionMessageToolCall.kt @@ -30,16 +30,43 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun function(): Function = function.getRequired("function") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [function]. + * + * Unlike [function], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("function") @ExcludeMissing fun _function(): JsonField = function + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -95,14 +122,33 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun function(function: Function) = function(JsonField.of(function)) + /** + * Sets [Builder.function] to an arbitrary JSON value. + * + * You should usually call [Builder.function] with a well-typed [Function] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun function(function: JsonField) = apply { this.function = function } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -147,12 +193,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun arguments(): String = arguments.getRequired("arguments") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * Returns the raw JSON value of [arguments]. + * + * Unlike [arguments], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("arguments") @ExcludeMissing fun _arguments(): JsonField = arguments + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -203,10 +267,24 @@ private constructor( fun arguments(arguments: String) = arguments(JsonField.of(arguments)) + /** + * Sets [Builder.arguments] to an arbitrary JSON value. + * + * You should usually call [Builder.arguments] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun arguments(arguments: JsonField) = apply { this.arguments = arguments } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CodeBundle.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CodeBundle.kt index e5712817..f113a8c9 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CodeBundle.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CodeBundle.kt @@ -49,24 +49,60 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun bundleId(): String = bundleId.getRequired("bundle_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun location(): Location = location.getRequired("location") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun runtimeContext(): RuntimeContext = runtimeContext.getRequired("runtime_context") - /** A preview of the code */ + /** + * A preview of the code + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preview(): Optional = Optional.ofNullable(preview.getNullable("preview")) + /** + * Returns the raw JSON value of [bundleId]. + * + * Unlike [bundleId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("bundle_id") @ExcludeMissing fun _bundleId(): JsonField = bundleId + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext - /** A preview of the code */ + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview @JsonAnyGetter @@ -124,19 +160,41 @@ private constructor( fun bundleId(bundleId: String) = bundleId(JsonField.of(bundleId)) + /** + * Sets [Builder.bundleId] to an arbitrary JSON value. + * + * You should usually call [Builder.bundleId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun bundleId(bundleId: JsonField) = apply { this.bundleId = bundleId } fun location(location: Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun location(location: JsonField) = apply { this.location = location } + /** Alias for calling [location] with `Location.ofExperiment(experiment)`. */ fun location(experiment: Location.Experiment) = location(Location.ofExperiment(experiment)) + /** Alias for calling [location] with `Location.ofFunction(function)`. */ fun location(function: Location.Function) = location(Location.ofFunction(function)) fun runtimeContext(runtimeContext: RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed [RuntimeContext] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext } @@ -144,10 +202,15 @@ private constructor( /** A preview of the code */ fun preview(preview: String?) = preview(JsonField.ofNullable(preview)) - /** A preview of the code */ + /** Alias for calling [Builder.preview] with `preview.orElse(null)`. */ fun preview(preview: Optional) = preview(preview.getOrNull()) - /** A preview of the code */ + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun preview(preview: JsonField) = apply { this.preview = preview } fun additionalProperties(additionalProperties: Map) = apply { @@ -331,18 +394,50 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun evalName(): String = evalName.getRequired("eval_name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun position(): Position = position.getRequired("position") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [evalName]. + * + * Unlike [evalName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("eval_name") @ExcludeMissing fun _evalName(): JsonField = evalName + /** + * Returns the raw JSON value of [position]. + * + * Unlike [position], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("position") @ExcludeMissing fun _position(): JsonField = position + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -397,18 +492,41 @@ private constructor( fun evalName(evalName: String) = evalName(JsonField.of(evalName)) + /** + * Sets [Builder.evalName] to an arbitrary JSON value. + * + * You should usually call [Builder.evalName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun evalName(evalName: JsonField) = apply { this.evalName = evalName } fun position(position: Position) = position(JsonField.of(position)) + /** + * Sets [Builder.position] to an arbitrary JSON value. + * + * You should usually call [Builder.position] with a well-typed [Position] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun position(position: JsonField) = apply { this.position = position } + /** Alias for calling [position] with `Position.ofType(type)`. */ fun position(type: Position.Type) = position(Position.ofType(type)) + /** Alias for calling [position] with `Position.ofScorer(scorer)`. */ fun position(scorer: Position.Scorer) = position(Position.ofScorer(scorer)) fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -589,8 +707,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): InnerType = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -638,6 +767,13 @@ private constructor( fun type(type: InnerType) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [InnerType] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -803,12 +939,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun index(): Long = index.getRequired("index") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [index]. + * + * Unlike [index], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("index") @ExcludeMissing fun _index(): JsonField = index + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -860,10 +1018,24 @@ private constructor( fun index(index: Long) = index(JsonField.of(index)) + /** + * Sets [Builder.index] to an arbitrary JSON value. + * + * You should usually call [Builder.index] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun index(index: JsonField) = apply { this.index = index } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1145,12 +1317,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun index(): Long = index.getRequired("index") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [index]. + * + * Unlike [index], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("index") @ExcludeMissing fun _index(): JsonField = index + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1201,10 +1393,24 @@ private constructor( fun index(index: Long) = index(JsonField.of(index)) + /** + * Sets [Builder.index] to an arbitrary JSON value. + * + * You should usually call [Builder.index] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun index(index: JsonField) = apply { this.index = index } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1367,12 +1573,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -1423,10 +1647,24 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CreateApiKeyOutput.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CreateApiKeyOutput.kt index ba204bc6..b3162489 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CreateApiKeyOutput.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CreateApiKeyOutput.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -39,46 +40,109 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the api key */ + /** + * Unique identifier for the api key + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The raw API key. It will only be exposed this one time */ + /** + * The raw API key. It will only be exposed this one time + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun key(): String = key.getRequired("key") - /** Name of the api key */ + /** + * Name of the api key + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun previewName(): String = previewName.getRequired("preview_name") - /** Date of api key creation */ + /** + * Date of api key creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Unique identifier for the organization */ + /** + * Unique identifier for the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun orgId(): Optional = Optional.ofNullable(orgId.getNullable("org_id")) - /** Unique identifier for the user */ + /** + * Unique identifier for the user + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the api key */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The raw API key. It will only be exposed this one time */ + /** + * Returns the raw JSON value of [key]. + * + * Unlike [key], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("key") @ExcludeMissing fun _key(): JsonField = key - /** Name of the api key */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [previewName]. + * + * Unlike [previewName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("preview_name") @ExcludeMissing fun _previewName(): JsonField = previewName - /** Date of api key creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Unique identifier for the organization */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Unique identifier for the user */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -147,50 +211,88 @@ private constructor( /** Unique identifier for the api key */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the api key */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The raw API key. It will only be exposed this one time */ fun key(key: String) = key(JsonField.of(key)) - /** The raw API key. It will only be exposed this one time */ + /** + * Sets [Builder.key] to an arbitrary JSON value. + * + * You should usually call [Builder.key] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun key(key: JsonField) = apply { this.key = key } /** Name of the api key */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the api key */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun previewName(previewName: String) = previewName(JsonField.of(previewName)) + /** + * Sets [Builder.previewName] to an arbitrary JSON value. + * + * You should usually call [Builder.previewName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun previewName(previewName: JsonField) = apply { this.previewName = previewName } /** Date of api key creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of api key creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of api key creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Unique identifier for the organization */ fun orgId(orgId: String?) = orgId(JsonField.ofNullable(orgId)) - /** Unique identifier for the organization */ + /** Alias for calling [Builder.orgId] with `orgId.orElse(null)`. */ fun orgId(orgId: Optional) = orgId(orgId.getOrNull()) - /** Unique identifier for the organization */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Unique identifier for the user */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Unique identifier for the user */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Unique identifier for the user */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CrossObjectInsertResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CrossObjectInsertResponse.kt index b6a00359..b041b845 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CrossObjectInsertResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/CrossObjectInsertResponse.kt @@ -9,6 +9,7 @@ import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,26 +34,53 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A mapping from dataset id to row ids for inserted `events` */ + /** + * A mapping from dataset id to row ids for inserted `events` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dataset(): Optional = Optional.ofNullable(dataset.getNullable("dataset")) - /** A mapping from experiment id to row ids for inserted `events` */ + /** + * A mapping from experiment id to row ids for inserted `events` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun experiment(): Optional = Optional.ofNullable(experiment.getNullable("experiment")) - /** A mapping from project id to row ids for inserted `events` */ + /** + * A mapping from project id to row ids for inserted `events` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun projectLogs(): Optional = Optional.ofNullable(projectLogs.getNullable("project_logs")) - /** A mapping from dataset id to row ids for inserted `events` */ + /** + * Returns the raw JSON value of [dataset]. + * + * Unlike [dataset], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dataset") @ExcludeMissing fun _dataset(): JsonField = dataset - /** A mapping from experiment id to row ids for inserted `events` */ + /** + * Returns the raw JSON value of [experiment]. + * + * Unlike [experiment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("experiment") @ExcludeMissing fun _experiment(): JsonField = experiment - /** A mapping from project id to row ids for inserted `events` */ + /** + * Returns the raw JSON value of [projectLogs]. + * + * Unlike [projectLogs], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_logs") @ExcludeMissing fun _projectLogs(): JsonField = projectLogs @@ -103,28 +131,45 @@ private constructor( /** A mapping from dataset id to row ids for inserted `events` */ fun dataset(dataset: Dataset?) = dataset(JsonField.ofNullable(dataset)) - /** A mapping from dataset id to row ids for inserted `events` */ + /** Alias for calling [Builder.dataset] with `dataset.orElse(null)`. */ fun dataset(dataset: Optional) = dataset(dataset.getOrNull()) - /** A mapping from dataset id to row ids for inserted `events` */ + /** + * Sets [Builder.dataset] to an arbitrary JSON value. + * + * You should usually call [Builder.dataset] with a well-typed [Dataset] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun dataset(dataset: JsonField) = apply { this.dataset = dataset } /** A mapping from experiment id to row ids for inserted `events` */ fun experiment(experiment: Experiment?) = experiment(JsonField.ofNullable(experiment)) - /** A mapping from experiment id to row ids for inserted `events` */ + /** Alias for calling [Builder.experiment] with `experiment.orElse(null)`. */ fun experiment(experiment: Optional) = experiment(experiment.getOrNull()) - /** A mapping from experiment id to row ids for inserted `events` */ + /** + * Sets [Builder.experiment] to an arbitrary JSON value. + * + * You should usually call [Builder.experiment] with a well-typed [Experiment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun experiment(experiment: JsonField) = apply { this.experiment = experiment } /** A mapping from project id to row ids for inserted `events` */ fun projectLogs(projectLogs: ProjectLogs?) = projectLogs(JsonField.ofNullable(projectLogs)) - /** A mapping from project id to row ids for inserted `events` */ + /** Alias for calling [Builder.projectLogs] with `projectLogs.orElse(null)`. */ fun projectLogs(projectLogs: Optional) = projectLogs(projectLogs.getOrNull()) - /** A mapping from project id to row ids for inserted `events` */ + /** + * Sets [Builder.projectLogs] to an arbitrary JSON value. + * + * You should usually call [Builder.projectLogs] with a well-typed [ProjectLogs] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectLogs(projectLogs: JsonField) = apply { this.projectLogs = projectLogs } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DataSummary.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DataSummary.kt index 25297bb3..2b0bb6d7 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DataSummary.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DataSummary.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -27,10 +28,19 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Total number of records in the dataset */ + /** + * Total number of records in the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun totalRecords(): Long = totalRecords.getRequired("total_records") - /** Total number of records in the dataset */ + /** + * Returns the raw JSON value of [totalRecords]. + * + * Unlike [totalRecords], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("total_records") @ExcludeMissing fun _totalRecords(): JsonField = totalRecords @@ -80,7 +90,13 @@ private constructor( /** Total number of records in the dataset */ fun totalRecords(totalRecords: Long) = totalRecords(JsonField.of(totalRecords)) - /** Total number of records in the dataset */ + /** + * Sets [Builder.totalRecords] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRecords] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalRecords(totalRecords: JsonField) = apply { this.totalRecords = totalRecords } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Dataset.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Dataset.kt index 6a1818a9..f1d396e8 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Dataset.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Dataset.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -46,56 +47,128 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the dataset */ + /** + * Unique identifier for the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Name of the dataset. Within a project, dataset names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the dataset belongs under */ + /** + * Unique identifier for the project that the dataset belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Date of dataset creation */ + /** + * Date of dataset creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date of dataset deletion, or null if the dataset is still active */ + /** + * Date of dataset deletion, or null if the dataset is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Textual description of the dataset */ + /** + * Textual description of the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** User-controlled metadata about the dataset */ + /** + * User-controlled metadata about the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Identifies the user who created the dataset */ + /** + * Identifies the user who created the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the dataset */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the dataset belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Date of dataset creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date of dataset deletion, or null if the dataset is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Textual description of the dataset */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** User-controlled metadata about the dataset */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Identifies the user who created the dataset */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -166,64 +239,109 @@ private constructor( /** Unique identifier for the dataset */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the dataset */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the dataset. Within a project, dataset names are unique */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the dataset belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the dataset belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Date of dataset creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of dataset creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of dataset creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date of dataset deletion, or null if the dataset is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of dataset deletion, or null if the dataset is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of dataset deletion, or null if the dataset is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } /** Textual description of the dataset */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the dataset */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the dataset */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** User-controlled metadata about the dataset */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the dataset */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the dataset */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Identifies the user who created the dataset */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the dataset */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the dataset */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetCreateParams.kt index be5669c3..50a2261f 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,28 +33,64 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Name of the dataset. Within a project, dataset names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the dataset belongs under */ + /** + * Unique identifier for the project that the dataset belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Textual description of the dataset */ + /** + * Textual description of the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** User-controlled metadata about the dataset */ + /** + * User-controlled metadata about the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the dataset belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Textual description of the dataset */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** User-controlled metadata about the dataset */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -88,31 +125,67 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Name of the dataset. Within a project, dataset names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the dataset belongs under */ + /** + * Unique identifier for the project that the dataset belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Textual description of the dataset */ + /** + * Textual description of the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** User-controlled metadata about the dataset */ + /** + * User-controlled metadata about the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the dataset belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Textual description of the dataset */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** User-controlled metadata about the dataset */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @JsonAnyGetter @@ -170,22 +243,40 @@ private constructor( /** Name of the dataset. Within a project, dataset names are unique */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the dataset belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the dataset belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Textual description of the dataset */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the dataset */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the dataset */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -193,10 +284,16 @@ private constructor( /** User-controlled metadata about the dataset */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the dataset */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the dataset */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -280,31 +377,54 @@ private constructor( /** Name of the dataset. Within a project, dataset names are unique */ fun name(name: String) = apply { body.name(name) } - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the dataset belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the dataset belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Textual description of the dataset */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the dataset */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the dataset */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** User-controlled metadata about the dataset */ fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } - /** User-controlled metadata about the dataset */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the dataset */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetEvent.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetEvent.kt index b60821c8..116cce7b 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetEvent.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetEvent.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -63,6 +64,9 @@ private constructor( /** * A unique identifier for the dataset event. If you don't provide one, BrainTrust will generate * one for you + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun id(): String = id.getRequired("id") @@ -70,25 +74,51 @@ private constructor( * The transaction id of an event is unique to the network operation that processed the event * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve * a versioned snapshot of the dataset (see the `version` parameter) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun _xactId(): String = _xactId.getRequired("_xact_id") - /** The timestamp the dataset event was created */ + /** + * The timestamp the dataset event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun created(): OffsetDateTime = created.getRequired("created") - /** Unique identifier for the dataset */ + /** + * Unique identifier for the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun datasetId(): String = datasetId.getRequired("dataset_id") - /** Unique identifier for the project that the dataset belongs under */ + /** + * Unique identifier for the project that the dataset belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** A unique identifier for the trace this dataset event belongs to */ + /** + * A unique identifier for the trace this dataset event belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun rootSpanId(): String = rootSpanId.getRequired("root_span_id") /** * A unique identifier used to link different dataset events together as part of a full trace. * See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full details on * tracing + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun spanId(): String = spanId.getRequired("span_id") @@ -101,7 +131,12 @@ private constructor( /** The argument that uniquely define an input case (an arbitrary, JSON serializable object) */ @JsonProperty("input") @ExcludeMissing fun _input(): JsonValue = input - /** Whether this span is a root span */ + /** + * Whether this span is a root span + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isRoot(): Optional = Optional.ofNullable(isRoot.getNullable("is_root")) /** @@ -110,63 +145,103 @@ private constructor( * example, you could log the `prompt`, example's `id`, or anything else that would be useful to * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys * must be strings + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Indicates the event was copied from another object. */ + /** + * Indicates the event was copied from another object. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * A unique identifier for the dataset event. If you don't provide one, BrainTrust will generate - * one for you + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The transaction id of an event is unique to the network operation that processed the event - * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve - * a versioned snapshot of the dataset (see the `version` parameter) + * Returns the raw JSON value of [_xactId]. + * + * Unlike [_xactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_xact_id") @ExcludeMissing fun __xactId(): JsonField = _xactId - /** The timestamp the dataset event was created */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Unique identifier for the dataset */ + /** + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField = datasetId - /** Unique identifier for the project that the dataset belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** A unique identifier for the trace this dataset event belongs to */ + /** + * Returns the raw JSON value of [rootSpanId]. + * + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId /** - * A unique identifier used to link different dataset events together as part of a full trace. - * See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full details on - * tracing + * Returns the raw JSON value of [spanId]. + * + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId - /** Whether this span is a root span */ + /** + * Returns the raw JSON value of [isRoot]. + * + * Unlike [isRoot], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_root") @ExcludeMissing fun _isRoot(): JsonField = isRoot /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. For - * example, you could log the `prompt`, example's `id`, or anything else that would be useful to - * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys - * must be strings + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Indicates the event was copied from another object. */ + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -258,8 +333,10 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** - * A unique identifier for the dataset event. If you don't provide one, BrainTrust will - * generate one for you + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } @@ -271,34 +348,59 @@ private constructor( fun _xactId(_xactId: String) = _xactId(JsonField.of(_xactId)) /** - * The transaction id of an event is unique to the network operation that processed the - * event insertion. Transaction ids are monotonically increasing over time and can be used - * to retrieve a versioned snapshot of the dataset (see the `version` parameter) + * Sets [Builder._xactId] to an arbitrary JSON value. + * + * You should usually call [Builder._xactId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun _xactId(_xactId: JsonField) = apply { this._xactId = _xactId } /** The timestamp the dataset event was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) - /** The timestamp the dataset event was created */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Unique identifier for the dataset */ fun datasetId(datasetId: String) = datasetId(JsonField.of(datasetId)) - /** Unique identifier for the dataset */ + /** + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun datasetId(datasetId: JsonField) = apply { this.datasetId = datasetId } /** Unique identifier for the project that the dataset belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the dataset belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** A unique identifier for the trace this dataset event belongs to */ fun rootSpanId(rootSpanId: String) = rootSpanId(JsonField.of(rootSpanId)) - /** A unique identifier for the trace this dataset event belongs to */ + /** + * Sets [Builder.rootSpanId] to an arbitrary JSON value. + * + * You should usually call [Builder.rootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } /** @@ -309,9 +411,10 @@ private constructor( fun spanId(spanId: String) = spanId(JsonField.of(spanId)) /** - * A unique identifier used to link different dataset events together as part of a full - * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full - * details on tracing + * Sets [Builder.spanId] to an arbitrary JSON value. + * + * You should usually call [Builder.spanId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } @@ -329,13 +432,22 @@ private constructor( /** Whether this span is a root span */ fun isRoot(isRoot: Boolean?) = isRoot(JsonField.ofNullable(isRoot)) - /** Whether this span is a root span */ + /** + * Alias for [Builder.isRoot]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isRoot(isRoot: Boolean) = isRoot(isRoot as Boolean?) - /** Whether this span is a root span */ + /** Alias for calling [Builder.isRoot] with `isRoot.orElse(null)`. */ fun isRoot(isRoot: Optional) = isRoot(isRoot.getOrNull()) - /** Whether this span is a root span */ + /** + * Sets [Builder.isRoot] to an arbitrary JSON value. + * + * You should usually call [Builder.isRoot] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun isRoot(isRoot: JsonField) = apply { this.isRoot = isRoot } /** @@ -347,45 +459,55 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Indicates the event was copied from another object. */ fun origin(origin: ObjectReference?) = origin(JsonField.ofNullable(origin)) - /** Indicates the event was copied from another object. */ + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) - /** Indicates the event was copied from another object. */ + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [ObjectReference] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -446,10 +568,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The model used for this example */ + /** + * The model used for this example + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) - /** The model used for this example */ + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model @JsonAnyGetter @@ -490,10 +621,16 @@ private constructor( /** The model used for this example */ fun model(model: String?) = model(JsonField.ofNullable(model)) - /** The model used for this example */ + /** Alias for calling [Builder.model] with `model.orElse(null)`. */ fun model(model: Optional) = model(model.getOrNull()) - /** The model used for this example */ + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFeedbackParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFeedbackParams.kt index 1b7d0197..efa54e3d 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFeedbackParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFeedbackParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,10 +33,19 @@ private constructor( /** Dataset id */ fun datasetId(): String = datasetId - /** A list of dataset feedback items */ + /** + * A list of dataset feedback items + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun feedback(): List = body.feedback() - /** A list of dataset feedback items */ + /** + * Returns the raw JSON value of [feedback]. + * + * Unlike [feedback], this method doesn't throw if the JSON field has an unexpected type. + */ fun _feedback(): JsonField> = body._feedback() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,10 +78,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of dataset feedback items */ + /** + * A list of dataset feedback items + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun feedback(): List = feedback.getRequired("feedback") - /** A list of dataset feedback items */ + /** + * Returns the raw JSON value of [feedback]. + * + * Unlike [feedback], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("feedback") @ExcludeMissing fun _feedback(): JsonField> = feedback @@ -121,12 +140,22 @@ private constructor( /** A list of dataset feedback items */ fun feedback(feedback: List) = feedback(JsonField.of(feedback)) - /** A list of dataset feedback items */ + /** + * Sets [Builder.feedback] to an arbitrary JSON value. + * + * You should usually call [Builder.feedback] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun feedback(feedback: JsonField>) = apply { this.feedback = feedback.map { it.toMutableList() } } - /** A list of dataset feedback items */ + /** + * Adds a single [FeedbackDatasetItem] to [Builder.feedback]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeedback(feedback: FeedbackDatasetItem) = apply { this.feedback = (this.feedback ?: JsonField.of(mutableListOf())).also { @@ -217,12 +246,22 @@ private constructor( /** A list of dataset feedback items */ fun feedback(feedback: List) = apply { body.feedback(feedback) } - /** A list of dataset feedback items */ + /** + * Sets [Builder.feedback] to an arbitrary JSON value. + * + * You should usually call [Builder.feedback] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun feedback(feedback: JsonField>) = apply { body.feedback(feedback) } - /** A list of dataset feedback items */ + /** + * Adds a single [FeedbackDatasetItem] to [Builder.feedback]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeedback(feedback: FeedbackDatasetItem) = apply { body.addFeedback(feedback) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchParams.kt index e045595c..36fa92fa 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchParams.kt @@ -164,37 +164,13 @@ private constructor( fun limit(limit: Long?) = apply { this.limit = limit } /** - * limit the number of traces fetched + * Alias for [Builder.limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** @@ -211,18 +187,7 @@ private constructor( */ fun maxRootSpanId(maxRootSpanId: String?) = apply { this.maxRootSpanId = maxRootSpanId } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) @@ -240,18 +205,7 @@ private constructor( */ fun maxXactId(maxXactId: String?) = apply { this.maxXactId = maxXactId } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** @@ -262,12 +216,7 @@ private constructor( */ fun version(version: String?) = apply { this.version = version } - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchPostParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchPostParams.kt index 02ffad07..dda145f4 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchPostParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetFetchPostParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -42,6 +43,9 @@ private constructor( * earliest. * * The string can be obtained directly from the `cursor` property of the previous fetch query + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun cursor(): Optional = body.cursor() @@ -58,6 +62,9 @@ private constructor( * * The `limit` parameter controls the number of full traces to return. So you may end up with * more individual rows than the specified limit if you are fetching events containing traces. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun limit(): Optional = body.limit() @@ -72,6 +79,9 @@ private constructor( * for the next page can be found as the row with the minimum (earliest) value of the tuple * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating * fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxRootSpanId(): Optional = body.maxRootSpanId() @@ -86,6 +96,9 @@ private constructor( * for the next page can be found as the row with the minimum (earliest) value of the tuple * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating * fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxXactId(): Optional = body.maxXactId() @@ -94,66 +107,44 @@ private constructor( * * The version id is essentially a filter on the latest event transaction id. You can use the * `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun version(): Optional = body.version() /** - * An opaque string to be used as a cursor for the next page of results, in order from latest to - * earliest. + * Returns the raw JSON value of [cursor]. * - * The string can be obtained directly from the `cursor` property of the previous fetch query + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ fun _cursor(): JsonField = body._cursor() /** - * limit the number of traces fetched + * Returns the raw JSON value of [limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later - * pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. - * This happens because pagination occurs over the whole version history of the event log. You - * will most likely want to exclude any such duplicate, outdated rows (by `id`) from your - * combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up with - * more individual rows than the specified limit if you are fetching events containing traces. + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. */ fun _limit(): JsonField = body._limit() /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the - * explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument - * going forwards. + * Returns the raw JSON value of [maxRootSpanId]. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the cursor - * for the next page can be found as the row with the minimum (earliest) value of the tuple - * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating - * fetch queries. + * Unlike [maxRootSpanId], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxRootSpanId(): JsonField = body._maxRootSpanId() /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the - * explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument - * going forwards. + * Returns the raw JSON value of [maxXactId]. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the cursor - * for the next page can be found as the row with the minimum (earliest) value of the tuple - * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating - * fetch queries. + * Unlike [maxXactId], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxXactId(): JsonField = body._maxXactId() /** - * Retrieve a snapshot of events from a past time + * Returns the raw JSON value of [version]. * - * The version id is essentially a filter on the latest event transaction id. You can use the - * `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. */ fun _version(): JsonField = body._version() @@ -205,6 +196,9 @@ private constructor( * * The string can be obtained directly from the `cursor` property of the previous fetch * query + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun cursor(): Optional = Optional.ofNullable(cursor.getNullable("cursor")) @@ -222,6 +216,9 @@ private constructor( * The `limit` parameter controls the number of full traces to return. So you may end up * with more individual rows than the specified limit if you are fetching events containing * traces. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun limit(): Optional = Optional.ofNullable(limit.getNullable("limit")) @@ -236,6 +233,9 @@ private constructor( * cursor for the next page can be found as the row with the minimum (earliest) value of the * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of * paginating fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxRootSpanId(): Optional = Optional.ofNullable(maxRootSpanId.getNullable("max_root_span_id")) @@ -251,6 +251,9 @@ private constructor( * cursor for the next page can be found as the row with the minimum (earliest) value of the * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of * paginating fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxXactId(): Optional = Optional.ofNullable(maxXactId.getNullable("max_xact_id")) @@ -260,70 +263,47 @@ private constructor( * * The version id is essentially a filter on the latest event transaction id. You can use * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Returns the raw JSON value of [cursor]. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField = cursor /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. + * Returns the raw JSON value of [limit]. * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Returns the raw JSON value of [maxRootSpanId]. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * Unlike [maxRootSpanId], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("max_root_span_id") @ExcludeMissing fun _maxRootSpanId(): JsonField = maxRootSpanId /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Returns the raw JSON value of [maxXactId]. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * Unlike [maxXactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("max_xact_id") @ExcludeMissing fun _maxXactId(): JsonField = maxXactId /** - * Retrieve a snapshot of events from a past time + * Returns the raw JSON value of [version]. * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -383,21 +363,15 @@ private constructor( */ fun cursor(cursor: String?) = cursor(JsonField.ofNullable(cursor)) - /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. - * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Sets [Builder.cursor] to an arbitrary JSON value. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * You should usually call [Builder.cursor] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun cursor(cursor: JsonField) = apply { this.cursor = cursor } @@ -419,53 +393,21 @@ private constructor( fun limit(limit: Long?) = limit(JsonField.ofNullable(limit)) /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. + * Alias for [Builder.limit]. * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** - * limit the number of traces fetched + * Sets [Builder.limit] to an arbitrary JSON value. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun limit(limit: JsonField) = apply { this.limit = limit } @@ -484,32 +426,16 @@ private constructor( fun maxRootSpanId(maxRootSpanId: String?) = maxRootSpanId(JsonField.ofNullable(maxRootSpanId)) - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. + * Sets [Builder.maxRootSpanId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. + * You should usually call [Builder.maxRootSpanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxRootSpanId(maxRootSpanId: JsonField) = apply { this.maxRootSpanId = maxRootSpanId @@ -529,31 +455,15 @@ private constructor( */ fun maxXactId(maxXactId: String?) = maxXactId(JsonField.ofNullable(maxXactId)) - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Sets [Builder.maxXactId] to an arbitrary JSON value. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. + * You should usually call [Builder.maxXactId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxXactId(maxXactId: JsonField) = apply { this.maxXactId = maxXactId } @@ -566,21 +476,15 @@ private constructor( */ fun version(version: String?) = version(JsonField.ofNullable(version)) - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can - * use the `max_xact_id` returned by a past fetch as the version to reproduce that exact - * fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) /** - * Retrieve a snapshot of events from a past time + * Sets [Builder.version] to an arbitrary JSON value. * - * The version id is essentially a filter on the latest event transaction id. You can - * use the `max_xact_id` returned by a past fetch as the version to reproduce that exact - * fetch. + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun version(version: JsonField) = apply { this.version = version } @@ -676,21 +580,14 @@ private constructor( */ fun cursor(cursor: String?) = apply { body.cursor(cursor) } - /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. - * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Sets [Builder.cursor] to an arbitrary JSON value. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * You should usually call [Builder.cursor] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun cursor(cursor: JsonField) = apply { body.cursor(cursor) } @@ -712,53 +609,20 @@ private constructor( fun limit(limit: Long?) = apply { body.limit(limit) } /** - * limit the number of traces fetched + * Alias for [Builder.limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** - * limit the number of traces fetched + * Sets [Builder.limit] to an arbitrary JSON value. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun limit(limit: JsonField) = apply { body.limit(limit) } @@ -776,32 +640,16 @@ private constructor( */ fun maxRootSpanId(maxRootSpanId: String?) = apply { body.maxRootSpanId(maxRootSpanId) } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. + * Sets [Builder.maxRootSpanId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * You should usually call [Builder.maxRootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun maxRootSpanId(maxRootSpanId: JsonField) = apply { body.maxRootSpanId(maxRootSpanId) @@ -821,31 +669,15 @@ private constructor( */ fun maxXactId(maxXactId: String?) = apply { body.maxXactId(maxXactId) } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. + * Sets [Builder.maxXactId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * You should usually call [Builder.maxXactId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun maxXactId(maxXactId: JsonField) = apply { body.maxXactId(maxXactId) } @@ -857,19 +689,14 @@ private constructor( */ fun version(version: String?) = apply { body.version(version) } - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) /** - * Retrieve a snapshot of events from a past time + * Sets [Builder.version] to an arbitrary JSON value. * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun version(version: JsonField) = apply { body.version(version) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetInsertParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetInsertParams.kt index 043cce99..55c6c8ec 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetInsertParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetInsertParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,10 +33,19 @@ private constructor( /** Dataset id */ fun datasetId(): String = datasetId - /** A list of dataset events to insert */ + /** + * A list of dataset events to insert + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = body.events() - /** A list of dataset events to insert */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ fun _events(): JsonField> = body._events() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,10 +78,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of dataset events to insert */ + /** + * A list of dataset events to insert + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = events.getRequired("events") - /** A list of dataset events to insert */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events @@ -121,12 +140,22 @@ private constructor( /** A list of dataset events to insert */ fun events(events: List) = events(JsonField.of(events)) - /** A list of dataset events to insert */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun events(events: JsonField>) = apply { this.events = events.map { it.toMutableList() } } - /** A list of dataset events to insert */ + /** + * Adds a single [InsertDatasetEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: InsertDatasetEvent) = apply { events = (events ?: JsonField.of(mutableListOf())).also { @@ -216,10 +245,20 @@ private constructor( /** A list of dataset events to insert */ fun events(events: List) = apply { body.events(events) } - /** A list of dataset events to insert */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun events(events: JsonField>) = apply { body.events(events) } - /** A list of dataset events to insert */ + /** + * Adds a single [InsertDatasetEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: InsertDatasetEvent) = apply { body.addEvent(event) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetListParams.kt index 5ae454e3..b7818b13 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetListParams.kt @@ -141,7 +141,7 @@ private constructor( /** Name of the dataset to search for */ fun datasetName(datasetName: String?) = apply { this.datasetName = datasetName } - /** Name of the dataset to search for */ + /** Alias for calling [Builder.datasetName] with `datasetName.orElse(null)`. */ fun datasetName(datasetName: Optional) = datasetName(datasetName.getOrNull()) /** @@ -153,13 +153,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -168,49 +162,44 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Project id */ fun projectId(projectId: String?) = apply { this.projectId = projectId } - /** Project id */ + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** @@ -222,13 +211,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetSummarizeParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetSummarizeParams.kt index bea55242..8a27ca2d 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetSummarizeParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetSummarizeParams.kt @@ -87,13 +87,13 @@ private constructor( fun summarizeData(summarizeData: Boolean?) = apply { this.summarizeData = summarizeData } /** - * Whether to summarize the data. If false (or omitted), only the metadata will be returned. + * Alias for [Builder.summarizeData]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun summarizeData(summarizeData: Boolean) = summarizeData(summarizeData as Boolean?) - /** - * Whether to summarize the data. If false (or omitted), only the metadata will be returned. - */ + /** Alias for calling [Builder.summarizeData] with `summarizeData.orElse(null)`. */ fun summarizeData(summarizeData: Optional) = summarizeData(summarizeData.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetUpdateParams.kt index a125d34b..eb2b4cf2 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/DatasetUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,22 +38,49 @@ private constructor( /** Dataset id */ fun datasetId(): String = datasetId - /** Textual description of the dataset */ + /** + * Textual description of the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** User-controlled metadata about the dataset */ + /** + * User-controlled metadata about the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Name of the dataset. Within a project, dataset names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** Textual description of the dataset */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** User-controlled metadata about the dataset */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -91,25 +119,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Textual description of the dataset */ + /** + * Textual description of the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** User-controlled metadata about the dataset */ + /** + * User-controlled metadata about the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Name of the dataset. Within a project, dataset names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Textual description of the dataset */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** User-controlled metadata about the dataset */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -156,10 +211,16 @@ private constructor( /** Textual description of the dataset */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the dataset */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the dataset */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -167,19 +228,31 @@ private constructor( /** User-controlled metadata about the dataset */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the dataset */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the dataset */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Name of the dataset. Within a project, dataset names are unique */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the dataset. Within a project, dataset names are unique */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -261,28 +334,45 @@ private constructor( /** Textual description of the dataset */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the dataset */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the dataset */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** User-controlled metadata about the dataset */ fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } - /** User-controlled metadata about the dataset */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the dataset */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** Name of the dataset. Within a project, dataset names are unique */ fun name(name: String?) = apply { body.name(name) } - /** Name of the dataset. Within a project, dataset names are unique */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the dataset. Within a project, dataset names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVar.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVar.kt index 10a99c22..668c0861 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVar.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVar.kt @@ -42,42 +42,96 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the environment variable */ + /** + * Unique identifier for the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The id of the object the environment variable is scoped for */ + /** + * The id of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The type of the object the environment variable is scoped for */ + /** + * The type of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): ObjectType = objectType.getRequired("object_type") - /** Date of environment variable creation */ + /** + * Date of environment variable creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date the environment variable was last used */ + /** + * Date the environment variable was last used + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun used(): Optional = Optional.ofNullable(used.getNullable("used")) - /** Unique identifier for the environment variable */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The id of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The type of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Date of environment variable creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date the environment variable was last used */ + /** + * Returns the raw JSON value of [used]. + * + * Unlike [used], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("used") @ExcludeMissing fun _used(): JsonField = used @JsonAnyGetter @@ -143,43 +197,76 @@ private constructor( /** Unique identifier for the environment variable */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the environment variable */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The name of the environment variable */ fun name(name: String) = name(JsonField.of(name)) - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The id of the object the environment variable is scoped for */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The type of the object the environment variable is scoped for */ fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) - /** The type of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } /** Date of environment variable creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of environment variable creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of environment variable creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date the environment variable was last used */ fun used(used: OffsetDateTime?) = used(JsonField.ofNullable(used)) - /** Date the environment variable was last used */ + /** Alias for calling [Builder.used] with `used.orElse(null)`. */ fun used(used: Optional) = used(used.getOrNull()) - /** Date the environment variable was last used */ + /** + * Sets [Builder.used] to an arbitrary JSON value. + * + * You should usually call [Builder.used] with a well-typed [OffsetDateTime] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun used(used: JsonField) = apply { this.used = used } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarCreateParams.kt index b088aebe..201e9993 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarCreateParams.kt @@ -34,28 +34,64 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The id of the object the environment variable is scoped for */ + /** + * The id of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The type of the object the environment variable is scoped for */ + /** + * The type of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): ObjectType = body.objectType() - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * The value of the environment variable. Will be encrypted at rest. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun value(): Optional = body.value() - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The id of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The type of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ fun _value(): JsonField = body._value() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -90,30 +126,66 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The id of the object the environment variable is scoped for */ + /** + * The id of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The type of the object the environment variable is scoped for */ + /** + * The type of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): ObjectType = objectType.getRequired("object_type") - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * The value of the environment variable. Will be encrypted at rest. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The id of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The type of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @@ -172,19 +244,37 @@ private constructor( /** The name of the environment variable */ fun name(name: String) = name(JsonField.of(name)) - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The id of the object the environment variable is scoped for */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The type of the object the environment variable is scoped for */ fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) - /** The type of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -192,10 +282,16 @@ private constructor( /** The value of the environment variable. Will be encrypted at rest. */ fun value(value: String?) = value(JsonField.ofNullable(value)) - /** The value of the environment variable. Will be encrypted at rest. */ + /** Alias for calling [Builder.value] with `value.orElse(null)`. */ fun value(value: Optional) = value(value.getOrNull()) - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { @@ -280,28 +376,49 @@ private constructor( /** The name of the environment variable */ fun name(name: String) = apply { body.name(name) } - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The id of the object the environment variable is scoped for */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The type of the object the environment variable is scoped for */ fun objectType(objectType: ObjectType) = apply { body.objectType(objectType) } - /** The type of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** The value of the environment variable. Will be encrypted at rest. */ fun value(value: String?) = apply { body.value(value) } - /** The value of the environment variable. Will be encrypted at rest. */ + /** Alias for calling [Builder.value] with `value.orElse(null)`. */ fun value(value: Optional) = value(value.getOrNull()) - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun value(value: JsonField) = apply { body.value(value) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListParams.kt index 86d2b48e..1afc6fa8 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListParams.kt @@ -108,7 +108,7 @@ private constructor( /** Name of the env_var to search for */ fun envVarName(envVarName: String?) = apply { this.envVarName = envVarName } - /** Name of the env_var to search for */ + /** Alias for calling [Builder.envVarName] with `envVarName.orElse(null)`. */ fun envVarName(envVarName: Optional) = envVarName(envVarName.getOrNull()) /** @@ -117,43 +117,38 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** The id of the object the environment variable is scoped for */ fun objectId(objectId: String?) = apply { this.objectId = objectId } - /** The id of the object the environment variable is scoped for */ + /** Alias for calling [Builder.objectId] with `objectId.orElse(null)`. */ fun objectId(objectId: Optional) = objectId(objectId.getOrNull()) /** The type of the object the environment variable is scoped for */ fun objectType(objectType: EnvVarObjectType?) = apply { this.objectType = objectType } - /** The type of the object the environment variable is scoped for */ + /** Alias for calling [Builder.objectType] with `objectType.orElse(null)`. */ fun objectType(objectType: Optional) = objectType(objectType.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListResponse.kt index 014c0040..52b019c9 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarListResponse.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -27,10 +28,19 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of env_var objects */ + /** + * A list of env_var objects + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objects(): List = objects.getRequired("objects") - /** A list of env_var objects */ + /** + * Returns the raw JSON value of [objects]. + * + * Unlike [objects], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("objects") @ExcludeMissing fun _objects(): JsonField> = objects @JsonAnyGetter @@ -78,12 +88,22 @@ private constructor( /** A list of env_var objects */ fun objects(objects: List) = objects(JsonField.of(objects)) - /** A list of env_var objects */ + /** + * Sets [Builder.objects] to an arbitrary JSON value. + * + * You should usually call [Builder.objects] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun objects(objects: JsonField>) = apply { this.objects = objects.map { it.toMutableList() } } - /** A list of env_var objects */ + /** + * Adds a single [EnvVar] to [objects]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addObject(object_: EnvVar) = apply { objects = (objects ?: JsonField.of(mutableListOf())).also { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarReplaceParams.kt index da9d9b85..20e9ac8c 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarReplaceParams.kt @@ -34,28 +34,64 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The id of the object the environment variable is scoped for */ + /** + * The id of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The type of the object the environment variable is scoped for */ + /** + * The type of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): ObjectType = body.objectType() - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * The value of the environment variable. Will be encrypted at rest. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun value(): Optional = body.value() - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The id of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The type of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ fun _value(): JsonField = body._value() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -90,30 +126,66 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The id of the object the environment variable is scoped for */ + /** + * The id of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The type of the object the environment variable is scoped for */ + /** + * The type of the object the environment variable is scoped for + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): ObjectType = objectType.getRequired("object_type") - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * The value of the environment variable. Will be encrypted at rest. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The id of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The type of the object the environment variable is scoped for */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @@ -172,19 +244,37 @@ private constructor( /** The name of the environment variable */ fun name(name: String) = name(JsonField.of(name)) - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The id of the object the environment variable is scoped for */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The type of the object the environment variable is scoped for */ fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) - /** The type of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -192,10 +282,16 @@ private constructor( /** The value of the environment variable. Will be encrypted at rest. */ fun value(value: String?) = value(JsonField.ofNullable(value)) - /** The value of the environment variable. Will be encrypted at rest. */ + /** Alias for calling [Builder.value] with `value.orElse(null)`. */ fun value(value: Optional) = value(value.getOrNull()) - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { @@ -280,28 +376,49 @@ private constructor( /** The name of the environment variable */ fun name(name: String) = apply { body.name(name) } - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The id of the object the environment variable is scoped for */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The type of the object the environment variable is scoped for */ fun objectType(objectType: ObjectType) = apply { body.objectType(objectType) } - /** The type of the object the environment variable is scoped for */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** The value of the environment variable. Will be encrypted at rest. */ fun value(value: String?) = apply { body.value(value) } - /** The value of the environment variable. Will be encrypted at rest. */ + /** Alias for calling [Builder.value] with `value.orElse(null)`. */ fun value(value: Optional) = value(value.getOrNull()) - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun value(value: JsonField) = apply { body.value(value) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarUpdateParams.kt index 11d4bded..e5e94255 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EnvVarUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,16 +38,34 @@ private constructor( /** EnvVar id */ fun envVarId(): String = envVarId - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * The value of the environment variable. Will be encrypted at rest. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun value(): Optional = body.value() - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ fun _value(): JsonField = body._value() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -82,16 +101,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the environment variable */ + /** + * The name of the environment variable + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * The value of the environment variable. Will be encrypted at rest. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun value(): Optional = Optional.ofNullable(value.getNullable("value")) - /** The name of the environment variable */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @@ -142,16 +179,28 @@ private constructor( /** The name of the environment variable */ fun name(name: String) = name(JsonField.of(name)) - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The value of the environment variable. Will be encrypted at rest. */ fun value(value: String?) = value(JsonField.ofNullable(value)) - /** The value of the environment variable. Will be encrypted at rest. */ + /** Alias for calling [Builder.value] with `value.orElse(null)`. */ fun value(value: Optional) = value(value.getOrNull()) - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { @@ -234,16 +283,26 @@ private constructor( /** The name of the environment variable */ fun name(name: String) = apply { body.name(name) } - /** The name of the environment variable */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The value of the environment variable. Will be encrypted at rest. */ fun value(value: String?) = apply { body.value(value) } - /** The value of the environment variable. Will be encrypted at rest. */ + /** Alias for calling [Builder.value] with `value.orElse(null)`. */ fun value(value: Optional) = value(value.getOrNull()) - /** The value of the environment variable. Will be encrypted at rest. */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun value(value: JsonField) = apply { body.value(value) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EvalCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EvalCreateParams.kt index 13823ba0..abc2abdf 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EvalCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/EvalCreateParams.kt @@ -48,73 +48,132 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The dataset to use */ + /** + * The dataset to use + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun data(): Data = body.data() - /** Unique identifier for the project to run the eval in */ + /** + * Unique identifier for the project to run the eval in + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** The functions to score the eval on */ + /** + * The functions to score the eval on + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scores(): List = body.scores() - /** The function to evaluate */ + /** + * The function to evaluate + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun task(): Task = body.task() /** * An optional experiment id to use as a base. If specified, the new experiment will be * summarized and compared to this experiment. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun baseExperimentId(): Optional = body.baseExperimentId() /** * An optional experiment name to use as a base. If specified, the new experiment will be * summarized and compared to this experiment. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun baseExperimentName(): Optional = body.baseExperimentName() /** * An optional name for the experiment created by this eval. If it conflicts with an existing * experiment, it will be suffixed with a unique identifier. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun experimentName(): Optional = body.experimentName() /** * Optional settings for collecting git metadata. By default, will collect all git metadata * fields allowed in org-level settings. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun gitMetadataSettings(): Optional = body.gitMetadataSettings() - /** Whether the experiment should be public. Defaults to false. */ + /** + * Whether the experiment should be public. Defaults to false. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isPublic(): Optional = body.isPublic() /** * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, in * which case there is no max concurrency. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxConcurrency(): Optional = body.maxConcurrency() /** * Optional experiment-level metadata to store about the evaluation. You can later use this to * slice & dice across experiments. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = body.metadata() - /** Options for tracing the evaluation */ + /** + * Options for tracing the evaluation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun parent(): Optional = body.parent() - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun repoInfo(): Optional = body.repoInfo() /** * Whether to stream the results of the eval. If true, the request will return two events: one * to indicate the experiment has started, and another upon completion. If false, the request * will return the evaluation's summary upon completion. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun stream(): Optional = body.stream() /** * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which * case there is no timeout. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun timeout(): Optional = body.timeout() @@ -122,83 +181,124 @@ private constructor( * The number of times to run the evaluator per input. This is useful for evaluating * applications that have non-deterministic behavior and gives you both a stronger aggregate * measure and a sense of the variance in the results. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun trialCount(): Optional = body.trialCount() - /** The dataset to use */ + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ fun _data(): JsonField = body._data() - /** Unique identifier for the project to run the eval in */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** The functions to score the eval on */ + /** + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. + */ fun _scores(): JsonField> = body._scores() - /** The function to evaluate */ + /** + * Returns the raw JSON value of [task]. + * + * Unlike [task], this method doesn't throw if the JSON field has an unexpected type. + */ fun _task(): JsonField = body._task() /** - * An optional experiment id to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Returns the raw JSON value of [baseExperimentId]. + * + * Unlike [baseExperimentId], this method doesn't throw if the JSON field has an unexpected + * type. */ fun _baseExperimentId(): JsonField = body._baseExperimentId() /** - * An optional experiment name to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Returns the raw JSON value of [baseExperimentName]. + * + * Unlike [baseExperimentName], this method doesn't throw if the JSON field has an unexpected + * type. */ fun _baseExperimentName(): JsonField = body._baseExperimentName() /** - * An optional name for the experiment created by this eval. If it conflicts with an existing - * experiment, it will be suffixed with a unique identifier. + * Returns the raw JSON value of [experimentName]. + * + * Unlike [experimentName], this method doesn't throw if the JSON field has an unexpected type. */ fun _experimentName(): JsonField = body._experimentName() /** - * Optional settings for collecting git metadata. By default, will collect all git metadata - * fields allowed in org-level settings. + * Returns the raw JSON value of [gitMetadataSettings]. + * + * Unlike [gitMetadataSettings], this method doesn't throw if the JSON field has an unexpected + * type. */ fun _gitMetadataSettings(): JsonField = body._gitMetadataSettings() - /** Whether the experiment should be public. Defaults to false. */ + /** + * Returns the raw JSON value of [isPublic]. + * + * Unlike [isPublic], this method doesn't throw if the JSON field has an unexpected type. + */ fun _isPublic(): JsonField = body._isPublic() /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, in - * which case there is no max concurrency. + * Returns the raw JSON value of [maxConcurrency]. + * + * Unlike [maxConcurrency], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxConcurrency(): JsonField = body._maxConcurrency() /** - * Optional experiment-level metadata to store about the evaluation. You can later use this to - * slice & dice across experiments. + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ fun _metadata(): JsonField = body._metadata() - /** Options for tracing the evaluation */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ fun _parent(): JsonField = body._parent() - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ fun _repoInfo(): JsonField = body._repoInfo() /** - * Whether to stream the results of the eval. If true, the request will return two events: one - * to indicate the experiment has started, and another upon completion. If false, the request - * will return the evaluation's summary upon completion. + * Returns the raw JSON value of [stream]. + * + * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type. */ fun _stream(): JsonField = body._stream() /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which - * case there is no timeout. + * Returns the raw JSON value of [timeout]. + * + * Unlike [timeout], this method doesn't throw if the JSON field has an unexpected type. */ fun _timeout(): JsonField = body._timeout() /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger aggregate - * measure and a sense of the variance in the results. + * Returns the raw JSON value of [trialCount]. + * + * Unlike [trialCount], this method doesn't throw if the JSON field has an unexpected type. */ fun _trialCount(): JsonField = body._trialCount() @@ -266,21 +366,44 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The dataset to use */ + /** + * The dataset to use + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun data(): Data = data.getRequired("data") - /** Unique identifier for the project to run the eval in */ + /** + * Unique identifier for the project to run the eval in + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** The functions to score the eval on */ + /** + * The functions to score the eval on + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scores(): List = scores.getRequired("scores") - /** The function to evaluate */ + /** + * The function to evaluate + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun task(): Task = task.getRequired("task") /** * An optional experiment id to use as a base. If specified, the new experiment will be * summarized and compared to this experiment. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun baseExperimentId(): Optional = Optional.ofNullable(baseExperimentId.getNullable("base_experiment_id")) @@ -288,6 +411,9 @@ private constructor( /** * An optional experiment name to use as a base. If specified, the new experiment will be * summarized and compared to this experiment. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun baseExperimentName(): Optional = Optional.ofNullable(baseExperimentName.getNullable("base_experiment_name")) @@ -295,6 +421,9 @@ private constructor( /** * An optional name for the experiment created by this eval. If it conflicts with an * existing experiment, it will be suffixed with a unique identifier. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun experimentName(): Optional = Optional.ofNullable(experimentName.getNullable("experiment_name")) @@ -302,16 +431,27 @@ private constructor( /** * Optional settings for collecting git metadata. By default, will collect all git metadata * fields allowed in org-level settings. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun gitMetadataSettings(): Optional = Optional.ofNullable(gitMetadataSettings.getNullable("git_metadata_settings")) - /** Whether the experiment should be public. Defaults to false. */ + /** + * Whether the experiment should be public. Defaults to false. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun isPublic(): Optional = Optional.ofNullable(isPublic.getNullable("is_public")) /** * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, * in which case there is no max concurrency. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxConcurrency(): Optional = Optional.ofNullable(maxConcurrency.getNullable("max_concurrency")) @@ -319,25 +459,44 @@ private constructor( /** * Optional experiment-level metadata to store about the evaluation. You can later use this * to slice & dice across experiments. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Options for tracing the evaluation */ + /** + * Options for tracing the evaluation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun repoInfo(): Optional = Optional.ofNullable(repoInfo.getNullable("repo_info")) /** * Whether to stream the results of the eval. If true, the request will return two events: * one to indicate the experiment has started, and another upon completion. If false, the * request will return the evaluation's summary upon completion. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun stream(): Optional = Optional.ofNullable(stream.getNullable("stream")) /** * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in * which case there is no timeout. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun timeout(): Optional = Optional.ofNullable(timeout.getNullable("timeout")) @@ -345,94 +504,137 @@ private constructor( * The number of times to run the evaluator per input. This is useful for evaluating * applications that have non-deterministic behavior and gives you both a stronger aggregate * measure and a sense of the variance in the results. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun trialCount(): Optional = Optional.ofNullable(trialCount.getNullable("trial_count")) - /** The dataset to use */ + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data - /** Unique identifier for the project to run the eval in */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The functions to score the eval on */ + /** + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField> = scores - /** The function to evaluate */ + /** + * Returns the raw JSON value of [task]. + * + * Unlike [task], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("task") @ExcludeMissing fun _task(): JsonField = task /** - * An optional experiment id to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Returns the raw JSON value of [baseExperimentId]. + * + * Unlike [baseExperimentId], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("base_experiment_id") @ExcludeMissing fun _baseExperimentId(): JsonField = baseExperimentId /** - * An optional experiment name to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Returns the raw JSON value of [baseExperimentName]. + * + * Unlike [baseExperimentName], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("base_experiment_name") @ExcludeMissing fun _baseExperimentName(): JsonField = baseExperimentName /** - * An optional name for the experiment created by this eval. If it conflicts with an - * existing experiment, it will be suffixed with a unique identifier. + * Returns the raw JSON value of [experimentName]. + * + * Unlike [experimentName], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("experiment_name") @ExcludeMissing fun _experimentName(): JsonField = experimentName /** - * Optional settings for collecting git metadata. By default, will collect all git metadata - * fields allowed in org-level settings. + * Returns the raw JSON value of [gitMetadataSettings]. + * + * Unlike [gitMetadataSettings], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("git_metadata_settings") @ExcludeMissing fun _gitMetadataSettings(): JsonField = gitMetadataSettings - /** Whether the experiment should be public. Defaults to false. */ + /** + * Returns the raw JSON value of [isPublic]. + * + * Unlike [isPublic], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_public") @ExcludeMissing fun _isPublic(): JsonField = isPublic /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, - * in which case there is no max concurrency. + * Returns the raw JSON value of [maxConcurrency]. + * + * Unlike [maxConcurrency], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("max_concurrency") @ExcludeMissing fun _maxConcurrency(): JsonField = maxConcurrency /** - * Optional experiment-level metadata to store about the evaluation. You can later use this - * to slice & dice across experiments. + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Options for tracing the evaluation */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("repo_info") @ExcludeMissing fun _repoInfo(): JsonField = repoInfo /** - * Whether to stream the results of the eval. If true, the request will return two events: - * one to indicate the experiment has started, and another upon completion. If false, the - * request will return the evaluation's summary upon completion. + * Returns the raw JSON value of [stream]. + * + * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("stream") @ExcludeMissing fun _stream(): JsonField = stream /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in - * which case there is no timeout. + * Returns the raw JSON value of [timeout]. + * + * Unlike [timeout], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("timeout") @ExcludeMissing fun _timeout(): JsonField = timeout /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger aggregate - * measure and a sense of the variance in the results. + * Returns the raw JSON value of [trialCount]. + * + * Unlike [trialCount], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("trial_count") @ExcludeMissing @@ -531,34 +733,56 @@ private constructor( /** The dataset to use */ fun data(data: Data) = data(JsonField.of(data)) - /** The dataset to use */ + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } - /** Dataset id */ + /** Alias for calling [data] with `Data.ofDatasetId(datasetId)`. */ fun data(datasetId: Data.DatasetId) = data(Data.ofDatasetId(datasetId)) - /** Project and dataset name */ + /** Alias for calling [data] with `Data.ofProjectDatasetName(projectDatasetName)`. */ fun data(projectDatasetName: Data.ProjectDatasetName) = data(Data.ofProjectDatasetName(projectDatasetName)) - /** Dataset rows */ + /** Alias for calling [data] with `Data.ofDatasetRows(datasetRows)`. */ fun data(datasetRows: Data.DatasetRows) = data(Data.ofDatasetRows(datasetRows)) /** Unique identifier for the project to run the eval in */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project to run the eval in */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The functions to score the eval on */ fun scores(scores: List) = scores(JsonField.of(scores)) - /** The functions to score the eval on */ + /** + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun scores(scores: JsonField>) = apply { this.scores = scores.map { it.toMutableList() } } - /** The functions to score the eval on */ + /** + * Adds a single [Score] to [scores]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addScore(score: Score) = apply { scores = (scores ?: JsonField.of(mutableListOf())).also { @@ -566,52 +790,58 @@ private constructor( } } - /** Function id */ + /** Alias for calling [addScore] with `Score.ofFunctionId(functionId)`. */ fun addScore(functionId: Score.FunctionId) = addScore(Score.ofFunctionId(functionId)) - /** Project name and slug */ + /** Alias for calling [addScore] with `Score.ofProjectSlug(projectSlug)`. */ fun addScore(projectSlug: Score.ProjectSlug) = addScore(Score.ofProjectSlug(projectSlug)) - /** Global function name */ + /** Alias for calling [addScore] with `Score.ofGlobalFunction(globalFunction)`. */ fun addScore(globalFunction: Score.GlobalFunction) = addScore(Score.ofGlobalFunction(globalFunction)) - /** Prompt session id */ + /** Alias for calling [addScore] with `Score.ofPromptSessionId(promptSessionId)`. */ fun addScore(promptSessionId: Score.PromptSessionId) = addScore(Score.ofPromptSessionId(promptSessionId)) - /** Inline code function */ + /** Alias for calling [addScore] with `Score.ofInlineCode(inlineCode)`. */ fun addScore(inlineCode: Score.InlineCode) = addScore(Score.ofInlineCode(inlineCode)) - /** Inline prompt definition */ + /** Alias for calling [addScore] with `Score.ofInlinePrompt(inlinePrompt)`. */ fun addScore(inlinePrompt: Score.InlinePrompt) = addScore(Score.ofInlinePrompt(inlinePrompt)) /** The function to evaluate */ fun task(task: Task) = task(JsonField.of(task)) - /** The function to evaluate */ + /** + * Sets [Builder.task] to an arbitrary JSON value. + * + * You should usually call [Builder.task] with a well-typed [Task] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun task(task: JsonField) = apply { this.task = task } - /** Function id */ + /** Alias for calling [task] with `Task.ofFunctionId(functionId)`. */ fun task(functionId: Task.FunctionId) = task(Task.ofFunctionId(functionId)) - /** Project name and slug */ + /** Alias for calling [task] with `Task.ofProjectSlug(projectSlug)`. */ fun task(projectSlug: Task.ProjectSlug) = task(Task.ofProjectSlug(projectSlug)) - /** Global function name */ + /** Alias for calling [task] with `Task.ofGlobalFunction(globalFunction)`. */ fun task(globalFunction: Task.GlobalFunction) = task(Task.ofGlobalFunction(globalFunction)) - /** Prompt session id */ + /** Alias for calling [task] with `Task.ofPromptSessionId(promptSessionId)`. */ fun task(promptSessionId: Task.PromptSessionId) = task(Task.ofPromptSessionId(promptSessionId)) - /** Inline code function */ + /** Alias for calling [task] with `Task.ofInlineCode(inlineCode)`. */ fun task(inlineCode: Task.InlineCode) = task(Task.ofInlineCode(inlineCode)) - /** Inline prompt definition */ + /** Alias for calling [task] with `Task.ofInlinePrompt(inlinePrompt)`. */ fun task(inlinePrompt: Task.InlinePrompt) = task(Task.ofInlinePrompt(inlinePrompt)) /** @@ -622,15 +852,17 @@ private constructor( baseExperimentId(JsonField.ofNullable(baseExperimentId)) /** - * An optional experiment id to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Alias for calling [Builder.baseExperimentId] with `baseExperimentId.orElse(null)`. */ fun baseExperimentId(baseExperimentId: Optional) = baseExperimentId(baseExperimentId.getOrNull()) /** - * An optional experiment id to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Sets [Builder.baseExperimentId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExperimentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun baseExperimentId(baseExperimentId: JsonField) = apply { this.baseExperimentId = baseExperimentId @@ -644,15 +876,18 @@ private constructor( baseExperimentName(JsonField.ofNullable(baseExperimentName)) /** - * An optional experiment name to use as a base. If specified, the new experiment will - * be summarized and compared to this experiment. + * Alias for calling [Builder.baseExperimentName] with + * `baseExperimentName.orElse(null)`. */ fun baseExperimentName(baseExperimentName: Optional) = baseExperimentName(baseExperimentName.getOrNull()) /** - * An optional experiment name to use as a base. If specified, the new experiment will - * be summarized and compared to this experiment. + * Sets [Builder.baseExperimentName] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExperimentName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun baseExperimentName(baseExperimentName: JsonField) = apply { this.baseExperimentName = baseExperimentName @@ -666,8 +901,11 @@ private constructor( experimentName(JsonField.of(experimentName)) /** - * An optional name for the experiment created by this eval. If it conflicts with an - * existing experiment, it will be suffixed with a unique identifier. + * Sets [Builder.experimentName] to an arbitrary JSON value. + * + * You should usually call [Builder.experimentName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun experimentName(experimentName: JsonField) = apply { this.experimentName = experimentName @@ -681,15 +919,18 @@ private constructor( gitMetadataSettings(JsonField.ofNullable(gitMetadataSettings)) /** - * Optional settings for collecting git metadata. By default, will collect all git - * metadata fields allowed in org-level settings. + * Alias for calling [Builder.gitMetadataSettings] with + * `gitMetadataSettings.orElse(null)`. */ fun gitMetadataSettings(gitMetadataSettings: Optional) = gitMetadataSettings(gitMetadataSettings.getOrNull()) /** - * Optional settings for collecting git metadata. By default, will collect all git - * metadata fields allowed in org-level settings. + * Sets [Builder.gitMetadataSettings] to an arbitrary JSON value. + * + * You should usually call [Builder.gitMetadataSettings] with a well-typed + * [GitMetadataSettings] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ fun gitMetadataSettings(gitMetadataSettings: JsonField) = apply { this.gitMetadataSettings = gitMetadataSettings @@ -698,13 +939,23 @@ private constructor( /** Whether the experiment should be public. Defaults to false. */ fun isPublic(isPublic: Boolean?) = isPublic(JsonField.ofNullable(isPublic)) - /** Whether the experiment should be public. Defaults to false. */ + /** + * Alias for [Builder.isPublic]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isPublic(isPublic: Boolean) = isPublic(isPublic as Boolean?) - /** Whether the experiment should be public. Defaults to false. */ + /** Alias for calling [Builder.isPublic] with `isPublic.orElse(null)`. */ fun isPublic(isPublic: Optional) = isPublic(isPublic.getOrNull()) - /** Whether the experiment should be public. Defaults to false. */ + /** + * Sets [Builder.isPublic] to an arbitrary JSON value. + * + * You should usually call [Builder.isPublic] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun isPublic(isPublic: JsonField) = apply { this.isPublic = isPublic } /** @@ -715,21 +966,22 @@ private constructor( maxConcurrency(JsonField.ofNullable(maxConcurrency)) /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to - * undefined, in which case there is no max concurrency. + * Alias for [Builder.maxConcurrency]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun maxConcurrency(maxConcurrency: Double) = maxConcurrency(maxConcurrency as Double?) - /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to - * undefined, in which case there is no max concurrency. - */ + /** Alias for calling [Builder.maxConcurrency] with `maxConcurrency.orElse(null)`. */ fun maxConcurrency(maxConcurrency: Optional) = maxConcurrency(maxConcurrency.getOrNull()) /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to - * undefined, in which case there is no max concurrency. + * Sets [Builder.maxConcurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.maxConcurrency] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxConcurrency(maxConcurrency: JsonField) = apply { this.maxConcurrency = maxConcurrency @@ -742,31 +994,46 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Optional experiment-level metadata to store about the evaluation. You can later use - * this to slice & dice across experiments. + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Options for tracing the evaluation */ fun parent(parent: Parent) = parent(JsonField.of(parent)) - /** Options for tracing the evaluation */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } - /** Span parent properties */ + /** Alias for calling [parent] with `Parent.ofSpanParentStruct(spanParentStruct)`. */ fun parent(spanParentStruct: Parent.SpanParentStruct) = parent(Parent.ofSpanParentStruct(spanParentStruct)) - /** The parent's span identifier, created by calling `.export()` on a span */ + /** Alias for calling [parent] with `Parent.ofString(string)`. */ fun parent(string: String) = parent(Parent.ofString(string)) /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = repoInfo(JsonField.ofNullable(repoInfo)) - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun repoInfo(repoInfo: JsonField) = apply { this.repoInfo = repoInfo } /** @@ -777,9 +1044,11 @@ private constructor( fun stream(stream: Boolean) = stream(JsonField.of(stream)) /** - * Whether to stream the results of the eval. If true, the request will return two - * events: one to indicate the experiment has started, and another upon completion. If - * false, the request will return the evaluation's summary upon completion. + * Sets [Builder.stream] to an arbitrary JSON value. + * + * You should usually call [Builder.stream] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun stream(stream: JsonField) = apply { this.stream = stream } @@ -790,20 +1059,21 @@ private constructor( fun timeout(timeout: Double?) = timeout(JsonField.ofNullable(timeout)) /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, - * in which case there is no timeout. + * Alias for [Builder.timeout]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun timeout(timeout: Double) = timeout(timeout as Double?) - /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, - * in which case there is no timeout. - */ + /** Alias for calling [Builder.timeout] with `timeout.orElse(null)`. */ fun timeout(timeout: Optional) = timeout(timeout.getOrNull()) /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, - * in which case there is no timeout. + * Sets [Builder.timeout] to an arbitrary JSON value. + * + * You should usually call [Builder.timeout] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun timeout(timeout: JsonField) = apply { this.timeout = timeout } @@ -815,23 +1085,21 @@ private constructor( fun trialCount(trialCount: Double?) = trialCount(JsonField.ofNullable(trialCount)) /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger - * aggregate measure and a sense of the variance in the results. + * Alias for [Builder.trialCount]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun trialCount(trialCount: Double) = trialCount(trialCount as Double?) - /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger - * aggregate measure and a sense of the variance in the results. - */ + /** Alias for calling [Builder.trialCount] with `trialCount.orElse(null)`. */ fun trialCount(trialCount: Optional) = trialCount(trialCount.getOrNull()) /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger - * aggregate measure and a sense of the variance in the results. + * Sets [Builder.trialCount] to an arbitrary JSON value. + * + * You should usually call [Builder.trialCount] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun trialCount(trialCount: JsonField) = apply { this.trialCount = trialCount } @@ -930,77 +1198,103 @@ private constructor( /** The dataset to use */ fun data(data: Data) = apply { body.data(data) } - /** The dataset to use */ + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { body.data(data) } - /** Dataset id */ + /** Alias for calling [data] with `Data.ofDatasetId(datasetId)`. */ fun data(datasetId: Data.DatasetId) = apply { body.data(datasetId) } - /** Project and dataset name */ + /** Alias for calling [data] with `Data.ofProjectDatasetName(projectDatasetName)`. */ fun data(projectDatasetName: Data.ProjectDatasetName) = apply { body.data(projectDatasetName) } - /** Dataset rows */ + /** Alias for calling [data] with `Data.ofDatasetRows(datasetRows)`. */ fun data(datasetRows: Data.DatasetRows) = apply { body.data(datasetRows) } /** Unique identifier for the project to run the eval in */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project to run the eval in */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** The functions to score the eval on */ fun scores(scores: List) = apply { body.scores(scores) } - /** The functions to score the eval on */ + /** + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun scores(scores: JsonField>) = apply { body.scores(scores) } - /** The functions to score the eval on */ + /** + * Adds a single [Score] to [scores]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addScore(score: Score) = apply { body.addScore(score) } - /** Function id */ + /** Alias for calling [addScore] with `Score.ofFunctionId(functionId)`. */ fun addScore(functionId: Score.FunctionId) = apply { body.addScore(functionId) } - /** Project name and slug */ + /** Alias for calling [addScore] with `Score.ofProjectSlug(projectSlug)`. */ fun addScore(projectSlug: Score.ProjectSlug) = apply { body.addScore(projectSlug) } - /** Global function name */ + /** Alias for calling [addScore] with `Score.ofGlobalFunction(globalFunction)`. */ fun addScore(globalFunction: Score.GlobalFunction) = apply { body.addScore(globalFunction) } - /** Prompt session id */ + /** Alias for calling [addScore] with `Score.ofPromptSessionId(promptSessionId)`. */ fun addScore(promptSessionId: Score.PromptSessionId) = apply { body.addScore(promptSessionId) } - /** Inline code function */ + /** Alias for calling [addScore] with `Score.ofInlineCode(inlineCode)`. */ fun addScore(inlineCode: Score.InlineCode) = apply { body.addScore(inlineCode) } - /** Inline prompt definition */ + /** Alias for calling [addScore] with `Score.ofInlinePrompt(inlinePrompt)`. */ fun addScore(inlinePrompt: Score.InlinePrompt) = apply { body.addScore(inlinePrompt) } /** The function to evaluate */ fun task(task: Task) = apply { body.task(task) } - /** The function to evaluate */ + /** + * Sets [Builder.task] to an arbitrary JSON value. + * + * You should usually call [Builder.task] with a well-typed [Task] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun task(task: JsonField) = apply { body.task(task) } - /** Function id */ + /** Alias for calling [task] with `Task.ofFunctionId(functionId)`. */ fun task(functionId: Task.FunctionId) = apply { body.task(functionId) } - /** Project name and slug */ + /** Alias for calling [task] with `Task.ofProjectSlug(projectSlug)`. */ fun task(projectSlug: Task.ProjectSlug) = apply { body.task(projectSlug) } - /** Global function name */ + /** Alias for calling [task] with `Task.ofGlobalFunction(globalFunction)`. */ fun task(globalFunction: Task.GlobalFunction) = apply { body.task(globalFunction) } - /** Prompt session id */ + /** Alias for calling [task] with `Task.ofPromptSessionId(promptSessionId)`. */ fun task(promptSessionId: Task.PromptSessionId) = apply { body.task(promptSessionId) } - /** Inline code function */ + /** Alias for calling [task] with `Task.ofInlineCode(inlineCode)`. */ fun task(inlineCode: Task.InlineCode) = apply { body.task(inlineCode) } - /** Inline prompt definition */ + /** Alias for calling [task] with `Task.ofInlinePrompt(inlinePrompt)`. */ fun task(inlinePrompt: Task.InlinePrompt) = apply { body.task(inlinePrompt) } /** @@ -1011,16 +1305,16 @@ private constructor( body.baseExperimentId(baseExperimentId) } - /** - * An optional experiment id to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. - */ + /** Alias for calling [Builder.baseExperimentId] with `baseExperimentId.orElse(null)`. */ fun baseExperimentId(baseExperimentId: Optional) = baseExperimentId(baseExperimentId.getOrNull()) /** - * An optional experiment id to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Sets [Builder.baseExperimentId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExperimentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun baseExperimentId(baseExperimentId: JsonField) = apply { body.baseExperimentId(baseExperimentId) @@ -1035,15 +1329,17 @@ private constructor( } /** - * An optional experiment name to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Alias for calling [Builder.baseExperimentName] with `baseExperimentName.orElse(null)`. */ fun baseExperimentName(baseExperimentName: Optional) = baseExperimentName(baseExperimentName.getOrNull()) /** - * An optional experiment name to use as a base. If specified, the new experiment will be - * summarized and compared to this experiment. + * Sets [Builder.baseExperimentName] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExperimentName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun baseExperimentName(baseExperimentName: JsonField) = apply { body.baseExperimentName(baseExperimentName) @@ -1056,8 +1352,11 @@ private constructor( fun experimentName(experimentName: String) = apply { body.experimentName(experimentName) } /** - * An optional name for the experiment created by this eval. If it conflicts with an - * existing experiment, it will be suffixed with a unique identifier. + * Sets [Builder.experimentName] to an arbitrary JSON value. + * + * You should usually call [Builder.experimentName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun experimentName(experimentName: JsonField) = apply { body.experimentName(experimentName) @@ -1072,15 +1371,17 @@ private constructor( } /** - * Optional settings for collecting git metadata. By default, will collect all git metadata - * fields allowed in org-level settings. + * Alias for calling [Builder.gitMetadataSettings] with `gitMetadataSettings.orElse(null)`. */ fun gitMetadataSettings(gitMetadataSettings: Optional) = gitMetadataSettings(gitMetadataSettings.getOrNull()) /** - * Optional settings for collecting git metadata. By default, will collect all git metadata - * fields allowed in org-level settings. + * Sets [Builder.gitMetadataSettings] to an arbitrary JSON value. + * + * You should usually call [Builder.gitMetadataSettings] with a well-typed + * [GitMetadataSettings] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun gitMetadataSettings(gitMetadataSettings: JsonField) = apply { body.gitMetadataSettings(gitMetadataSettings) @@ -1089,13 +1390,23 @@ private constructor( /** Whether the experiment should be public. Defaults to false. */ fun isPublic(isPublic: Boolean?) = apply { body.isPublic(isPublic) } - /** Whether the experiment should be public. Defaults to false. */ + /** + * Alias for [Builder.isPublic]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isPublic(isPublic: Boolean) = isPublic(isPublic as Boolean?) - /** Whether the experiment should be public. Defaults to false. */ + /** Alias for calling [Builder.isPublic] with `isPublic.orElse(null)`. */ fun isPublic(isPublic: Optional) = isPublic(isPublic.getOrNull()) - /** Whether the experiment should be public. Defaults to false. */ + /** + * Sets [Builder.isPublic] to an arbitrary JSON value. + * + * You should usually call [Builder.isPublic] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun isPublic(isPublic: JsonField) = apply { body.isPublic(isPublic) } /** @@ -1105,21 +1416,22 @@ private constructor( fun maxConcurrency(maxConcurrency: Double?) = apply { body.maxConcurrency(maxConcurrency) } /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, - * in which case there is no max concurrency. + * Alias for [Builder.maxConcurrency]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun maxConcurrency(maxConcurrency: Double) = maxConcurrency(maxConcurrency as Double?) - /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, - * in which case there is no max concurrency. - */ + /** Alias for calling [Builder.maxConcurrency] with `maxConcurrency.orElse(null)`. */ fun maxConcurrency(maxConcurrency: Optional) = maxConcurrency(maxConcurrency.getOrNull()) /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to undefined, - * in which case there is no max concurrency. + * Sets [Builder.maxConcurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.maxConcurrency] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxConcurrency(maxConcurrency: JsonField) = apply { body.maxConcurrency(maxConcurrency) @@ -1132,32 +1444,46 @@ private constructor( fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** - * Optional experiment-level metadata to store about the evaluation. You can later use this - * to slice & dice across experiments. + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** Options for tracing the evaluation */ fun parent(parent: Parent) = apply { body.parent(parent) } - /** Options for tracing the evaluation */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun parent(parent: JsonField) = apply { body.parent(parent) } - /** Span parent properties */ + /** Alias for calling [parent] with `Parent.ofSpanParentStruct(spanParentStruct)`. */ fun parent(spanParentStruct: Parent.SpanParentStruct) = apply { body.parent(spanParentStruct) } - /** The parent's span identifier, created by calling `.export()` on a span */ + /** Alias for calling [parent] with `Parent.ofString(string)`. */ fun parent(string: String) = apply { body.parent(string) } /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = apply { body.repoInfo(repoInfo) } - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun repoInfo(repoInfo: JsonField) = apply { body.repoInfo(repoInfo) } /** @@ -1168,9 +1494,10 @@ private constructor( fun stream(stream: Boolean) = apply { body.stream(stream) } /** - * Whether to stream the results of the eval. If true, the request will return two events: - * one to indicate the experiment has started, and another upon completion. If false, the - * request will return the evaluation's summary upon completion. + * Sets [Builder.stream] to an arbitrary JSON value. + * + * You should usually call [Builder.stream] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun stream(stream: JsonField) = apply { body.stream(stream) } @@ -1181,20 +1508,20 @@ private constructor( fun timeout(timeout: Double?) = apply { body.timeout(timeout) } /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in - * which case there is no timeout. + * Alias for [Builder.timeout]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun timeout(timeout: Double) = timeout(timeout as Double?) - /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in - * which case there is no timeout. - */ + /** Alias for calling [Builder.timeout] with `timeout.orElse(null)`. */ fun timeout(timeout: Optional) = timeout(timeout.getOrNull()) /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in - * which case there is no timeout. + * Sets [Builder.timeout] to an arbitrary JSON value. + * + * You should usually call [Builder.timeout] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun timeout(timeout: JsonField) = apply { body.timeout(timeout) } @@ -1206,23 +1533,21 @@ private constructor( fun trialCount(trialCount: Double?) = apply { body.trialCount(trialCount) } /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger aggregate - * measure and a sense of the variance in the results. + * Alias for [Builder.trialCount]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun trialCount(trialCount: Double) = trialCount(trialCount as Double?) - /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger aggregate - * measure and a sense of the variance in the results. - */ + /** Alias for calling [Builder.trialCount] with `trialCount.orElse(null)`. */ fun trialCount(trialCount: Optional) = trialCount(trialCount.getOrNull()) /** - * The number of times to run the evaluator per input. This is useful for evaluating - * applications that have non-deterministic behavior and gives you both a stronger aggregate - * measure and a sense of the variance in the results. + * Sets [Builder.trialCount] to an arbitrary JSON value. + * + * You should usually call [Builder.trialCount] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun trialCount(trialCount: JsonField) = apply { body.trialCount(trialCount) } @@ -1534,15 +1859,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun datasetId(): String = datasetId.getRequired("dataset_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun _internalBtql(): Optional<_InternalBtql> = Optional.ofNullable(_internalBtql.getNullable("_internal_btql")) + /** + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField = datasetId + /** + * Returns the raw JSON value of [_internalBtql]. + * + * Unlike [_internalBtql], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("_internal_btql") @ExcludeMissing fun __internalBtql(): JsonField<_InternalBtql> = _internalBtql @@ -1594,14 +1940,29 @@ private constructor( fun datasetId(datasetId: String) = datasetId(JsonField.of(datasetId)) + /** + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun datasetId(datasetId: JsonField) = apply { this.datasetId = datasetId } fun _internalBtql(_internalBtql: _InternalBtql?) = _internalBtql(JsonField.ofNullable(_internalBtql)) + /** Alias for calling [Builder._internalBtql] with `_internalBtql.orElse(null)`. */ fun _internalBtql(_internalBtql: Optional<_InternalBtql>) = _internalBtql(_internalBtql.getOrNull()) + /** + * Sets [Builder._internalBtql] to an arbitrary JSON value. + * + * You should usually call [Builder._internalBtql] with a well-typed [_InternalBtql] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun _internalBtql(_internalBtql: JsonField<_InternalBtql>) = apply { this._internalBtql = _internalBtql } @@ -1757,21 +2118,53 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun datasetName(): String = datasetName.getRequired("dataset_name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectName(): String = projectName.getRequired("project_name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun _internalBtql(): Optional<_InternalBtql> = Optional.ofNullable(_internalBtql.getNullable("_internal_btql")) + /** + * Returns the raw JSON value of [datasetName]. + * + * Unlike [datasetName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dataset_name") @ExcludeMissing fun _datasetName(): JsonField = datasetName + /** + * Returns the raw JSON value of [projectName]. + * + * Unlike [projectName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("project_name") @ExcludeMissing fun _projectName(): JsonField = projectName + /** + * Returns the raw JSON value of [_internalBtql]. + * + * Unlike [_internalBtql], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("_internal_btql") @ExcludeMissing fun __internalBtql(): JsonField<_InternalBtql> = _internalBtql @@ -1827,12 +2220,26 @@ private constructor( fun datasetName(datasetName: String) = datasetName(JsonField.of(datasetName)) + /** + * Sets [Builder.datasetName] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun datasetName(datasetName: JsonField) = apply { this.datasetName = datasetName } fun projectName(projectName: String) = projectName(JsonField.of(projectName)) + /** + * Sets [Builder.projectName] to an arbitrary JSON value. + * + * You should usually call [Builder.projectName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectName(projectName: JsonField) = apply { this.projectName = projectName } @@ -1840,9 +2247,17 @@ private constructor( fun _internalBtql(_internalBtql: _InternalBtql?) = _internalBtql(JsonField.ofNullable(_internalBtql)) + /** Alias for calling [Builder._internalBtql] with `_internalBtql.orElse(null)`. */ fun _internalBtql(_internalBtql: Optional<_InternalBtql>) = _internalBtql(_internalBtql.getOrNull()) + /** + * Sets [Builder._internalBtql] to an arbitrary JSON value. + * + * You should usually call [Builder._internalBtql] with a well-typed [_InternalBtql] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun _internalBtql(_internalBtql: JsonField<_InternalBtql>) = apply { this._internalBtql = _internalBtql } @@ -1993,8 +2408,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun data(): List = data.getRequired("data") + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data @JsonAnyGetter @@ -2041,10 +2466,22 @@ private constructor( fun data(data: List) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun data(data: JsonField>) = apply { this.data = data.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addData(data: JsonValue) = apply { this.data = (this.data ?: JsonField.of(mutableListOf())).also { @@ -2367,18 +2804,38 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the function */ + /** + * The ID of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun functionId(): String = functionId.getRequired("function_id") - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** The ID of the function */ + /** + * Returns the raw JSON value of [functionId]. + * + * Unlike [functionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_id") @ExcludeMissing fun _functionId(): JsonField = functionId - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -2429,7 +2886,13 @@ private constructor( /** The ID of the function */ fun functionId(functionId: String) = functionId(JsonField.of(functionId)) - /** The ID of the function */ + /** + * Sets [Builder.functionId] to an arbitrary JSON value. + * + * You should usually call [Builder.functionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun functionId(functionId: JsonField) = apply { this.functionId = functionId } @@ -2437,7 +2900,13 @@ private constructor( /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -2506,24 +2975,54 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the project containing the function */ + /** + * The name of the project containing the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectName(): String = projectName.getRequired("project_name") - /** The slug of the function */ + /** + * The slug of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** The name of the project containing the function */ + /** + * Returns the raw JSON value of [projectName]. + * + * Unlike [projectName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("project_name") @ExcludeMissing fun _projectName(): JsonField = projectName - /** The slug of the function */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -2578,7 +3077,13 @@ private constructor( /** The name of the project containing the function */ fun projectName(projectName: String) = projectName(JsonField.of(projectName)) - /** The name of the project containing the function */ + /** + * Sets [Builder.projectName] to an arbitrary JSON value. + * + * You should usually call [Builder.projectName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectName(projectName: JsonField) = apply { this.projectName = projectName } @@ -2586,13 +3091,25 @@ private constructor( /** The slug of the function */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The slug of the function */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -2659,12 +3176,18 @@ private constructor( /** * The name of the global function. Currently, the global namespace includes the * functions in autoevals + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ fun globalFunction(): String = globalFunction.getRequired("global_function") /** - * The name of the global function. Currently, the global namespace includes the - * functions in autoevals + * Returns the raw JSON value of [globalFunction]. + * + * Unlike [globalFunction], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("global_function") @ExcludeMissing @@ -2720,8 +3243,11 @@ private constructor( globalFunction(JsonField.of(globalFunction)) /** - * The name of the global function. Currently, the global namespace includes the - * functions in autoevals + * Sets [Builder.globalFunction] to an arbitrary JSON value. + * + * You should usually call [Builder.globalFunction] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun globalFunction(globalFunction: JsonField) = apply { this.globalFunction = globalFunction @@ -2792,27 +3318,58 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the function in the prompt session */ + /** + * The ID of the function in the prompt session + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun promptSessionFunctionId(): String = promptSessionFunctionId.getRequired("prompt_session_function_id") - /** The ID of the prompt session */ + /** + * The ID of the prompt session + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun promptSessionId(): String = promptSessionId.getRequired("prompt_session_id") - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** The ID of the function in the prompt session */ + /** + * Returns the raw JSON value of [promptSessionFunctionId]. + * + * Unlike [promptSessionFunctionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("prompt_session_function_id") @ExcludeMissing fun _promptSessionFunctionId(): JsonField = promptSessionFunctionId - /** The ID of the prompt session */ + /** + * Returns the raw JSON value of [promptSessionId]. + * + * Unlike [promptSessionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("prompt_session_id") @ExcludeMissing fun _promptSessionId(): JsonField = promptSessionId - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -2868,7 +3425,13 @@ private constructor( fun promptSessionFunctionId(promptSessionFunctionId: String) = promptSessionFunctionId(JsonField.of(promptSessionFunctionId)) - /** The ID of the function in the prompt session */ + /** + * Sets [Builder.promptSessionFunctionId] to an arbitrary JSON value. + * + * You should usually call [Builder.promptSessionFunctionId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun promptSessionFunctionId(promptSessionFunctionId: JsonField) = apply { this.promptSessionFunctionId = promptSessionFunctionId } @@ -2877,7 +3440,13 @@ private constructor( fun promptSessionId(promptSessionId: String) = promptSessionId(JsonField.of(promptSessionId)) - /** The ID of the prompt session */ + /** + * Sets [Builder.promptSessionId] to an arbitrary JSON value. + * + * You should usually call [Builder.promptSessionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun promptSessionId(promptSessionId: JsonField) = apply { this.promptSessionId = promptSessionId } @@ -2885,7 +3454,13 @@ private constructor( /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -2955,22 +3530,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inline code to execute */ + /** + * The inline code to execute + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun code(): String = code.getRequired("code") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun inlineContext(): InlineContext = inlineContext.getRequired("inline_context") - /** The name of the inline code function */ + /** + * The name of the inline code function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The inline code to execute */ + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Returns the raw JSON value of [inlineContext]. + * + * Unlike [inlineContext], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("inline_context") @ExcludeMissing fun _inlineContext(): JsonField = inlineContext - /** The name of the inline code function */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -3025,12 +3630,25 @@ private constructor( /** The inline code to execute */ fun code(code: String) = code(JsonField.of(code)) - /** The inline code to execute */ + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun code(code: JsonField) = apply { this.code = code } fun inlineContext(inlineContext: InlineContext) = inlineContext(JsonField.of(inlineContext)) + /** + * Sets [Builder.inlineContext] to an arbitrary JSON value. + * + * You should usually call [Builder.inlineContext] with a well-typed [InlineContext] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun inlineContext(inlineContext: JsonField) = apply { this.inlineContext = inlineContext } @@ -3038,10 +3656,16 @@ private constructor( /** The name of the inline code function */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the inline code function */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the inline code function */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -3089,14 +3713,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -3147,10 +3793,24 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -3340,19 +4000,38 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun inlinePrompt(): Optional = Optional.ofNullable(inlinePrompt.getNullable("inline_prompt")) - /** The name of the inline prompt */ + /** + * The name of the inline prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [inlinePrompt]. + * + * Unlike [inlinePrompt], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("inline_prompt") @ExcludeMissing fun _inlinePrompt(): JsonField = inlinePrompt - /** The name of the inline prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -3404,11 +4083,17 @@ private constructor( fun inlinePrompt(inlinePrompt: PromptData?) = inlinePrompt(JsonField.ofNullable(inlinePrompt)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.inlinePrompt] with `inlinePrompt.orElse(null)`. */ fun inlinePrompt(inlinePrompt: Optional) = inlinePrompt(inlinePrompt.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.inlinePrompt] to an arbitrary JSON value. + * + * You should usually call [Builder.inlinePrompt] with a well-typed [PromptData] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun inlinePrompt(inlinePrompt: JsonField) = apply { this.inlinePrompt = inlinePrompt } @@ -3416,10 +4101,16 @@ private constructor( /** The name of the inline prompt */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the inline prompt */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the inline prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -3736,18 +4427,38 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the function */ + /** + * The ID of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun functionId(): String = functionId.getRequired("function_id") - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** The ID of the function */ + /** + * Returns the raw JSON value of [functionId]. + * + * Unlike [functionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_id") @ExcludeMissing fun _functionId(): JsonField = functionId - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -3798,7 +4509,13 @@ private constructor( /** The ID of the function */ fun functionId(functionId: String) = functionId(JsonField.of(functionId)) - /** The ID of the function */ + /** + * Sets [Builder.functionId] to an arbitrary JSON value. + * + * You should usually call [Builder.functionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun functionId(functionId: JsonField) = apply { this.functionId = functionId } @@ -3806,7 +4523,13 @@ private constructor( /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -3875,24 +4598,54 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the project containing the function */ + /** + * The name of the project containing the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun projectName(): String = projectName.getRequired("project_name") - /** The slug of the function */ + /** + * The slug of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun slug(): String = slug.getRequired("slug") - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** The name of the project containing the function */ + /** + * Returns the raw JSON value of [projectName]. + * + * Unlike [projectName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("project_name") @ExcludeMissing fun _projectName(): JsonField = projectName - /** The slug of the function */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -3947,7 +4700,13 @@ private constructor( /** The name of the project containing the function */ fun projectName(projectName: String) = projectName(JsonField.of(projectName)) - /** The name of the project containing the function */ + /** + * Sets [Builder.projectName] to an arbitrary JSON value. + * + * You should usually call [Builder.projectName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun projectName(projectName: JsonField) = apply { this.projectName = projectName } @@ -3955,13 +4714,25 @@ private constructor( /** The slug of the function */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** The slug of the function */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -4028,12 +4799,18 @@ private constructor( /** * The name of the global function. Currently, the global namespace includes the * functions in autoevals + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ fun globalFunction(): String = globalFunction.getRequired("global_function") /** - * The name of the global function. Currently, the global namespace includes the - * functions in autoevals + * Returns the raw JSON value of [globalFunction]. + * + * Unlike [globalFunction], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("global_function") @ExcludeMissing @@ -4089,8 +4866,11 @@ private constructor( globalFunction(JsonField.of(globalFunction)) /** - * The name of the global function. Currently, the global namespace includes the - * functions in autoevals + * Sets [Builder.globalFunction] to an arbitrary JSON value. + * + * You should usually call [Builder.globalFunction] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun globalFunction(globalFunction: JsonField) = apply { this.globalFunction = globalFunction @@ -4161,27 +4941,58 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the function in the prompt session */ + /** + * The ID of the function in the prompt session + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun promptSessionFunctionId(): String = promptSessionFunctionId.getRequired("prompt_session_function_id") - /** The ID of the prompt session */ + /** + * The ID of the prompt session + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun promptSessionId(): String = promptSessionId.getRequired("prompt_session_id") - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** The ID of the function in the prompt session */ + /** + * Returns the raw JSON value of [promptSessionFunctionId]. + * + * Unlike [promptSessionFunctionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("prompt_session_function_id") @ExcludeMissing fun _promptSessionFunctionId(): JsonField = promptSessionFunctionId - /** The ID of the prompt session */ + /** + * Returns the raw JSON value of [promptSessionId]. + * + * Unlike [promptSessionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("prompt_session_id") @ExcludeMissing fun _promptSessionId(): JsonField = promptSessionId - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -4237,7 +5048,13 @@ private constructor( fun promptSessionFunctionId(promptSessionFunctionId: String) = promptSessionFunctionId(JsonField.of(promptSessionFunctionId)) - /** The ID of the function in the prompt session */ + /** + * Sets [Builder.promptSessionFunctionId] to an arbitrary JSON value. + * + * You should usually call [Builder.promptSessionFunctionId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun promptSessionFunctionId(promptSessionFunctionId: JsonField) = apply { this.promptSessionFunctionId = promptSessionFunctionId } @@ -4246,7 +5063,13 @@ private constructor( fun promptSessionId(promptSessionId: String) = promptSessionId(JsonField.of(promptSessionId)) - /** The ID of the prompt session */ + /** + * Sets [Builder.promptSessionId] to an arbitrary JSON value. + * + * You should usually call [Builder.promptSessionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun promptSessionId(promptSessionId: JsonField) = apply { this.promptSessionId = promptSessionId } @@ -4254,7 +5077,13 @@ private constructor( /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -4324,22 +5153,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The inline code to execute */ + /** + * The inline code to execute + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun code(): String = code.getRequired("code") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun inlineContext(): InlineContext = inlineContext.getRequired("inline_context") - /** The name of the inline code function */ + /** + * The name of the inline code function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The inline code to execute */ + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Returns the raw JSON value of [inlineContext]. + * + * Unlike [inlineContext], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("inline_context") @ExcludeMissing fun _inlineContext(): JsonField = inlineContext - /** The name of the inline code function */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -4394,12 +5253,25 @@ private constructor( /** The inline code to execute */ fun code(code: String) = code(JsonField.of(code)) - /** The inline code to execute */ + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun code(code: JsonField) = apply { this.code = code } fun inlineContext(inlineContext: InlineContext) = inlineContext(JsonField.of(inlineContext)) + /** + * Sets [Builder.inlineContext] to an arbitrary JSON value. + * + * You should usually call [Builder.inlineContext] with a well-typed [InlineContext] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun inlineContext(inlineContext: JsonField) = apply { this.inlineContext = inlineContext } @@ -4407,10 +5279,16 @@ private constructor( /** The name of the inline code function */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the inline code function */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the inline code function */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -4458,14 +5336,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -4516,10 +5416,24 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -4709,19 +5623,38 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun inlinePrompt(): Optional = Optional.ofNullable(inlinePrompt.getNullable("inline_prompt")) - /** The name of the inline prompt */ + /** + * The name of the inline prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [inlinePrompt]. + * + * Unlike [inlinePrompt], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("inline_prompt") @ExcludeMissing fun _inlinePrompt(): JsonField = inlinePrompt - /** The name of the inline prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -4773,11 +5706,17 @@ private constructor( fun inlinePrompt(inlinePrompt: PromptData?) = inlinePrompt(JsonField.ofNullable(inlinePrompt)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.inlinePrompt] with `inlinePrompt.orElse(null)`. */ fun inlinePrompt(inlinePrompt: Optional) = inlinePrompt(inlinePrompt.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.inlinePrompt] to an arbitrary JSON value. + * + * You should usually call [Builder.inlinePrompt] with a well-typed [PromptData] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun inlinePrompt(inlinePrompt: JsonField) = apply { this.inlinePrompt = inlinePrompt } @@ -4785,10 +5724,16 @@ private constructor( /** The name of the inline prompt */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the inline prompt */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the inline prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -4858,12 +5803,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun collect(): Collect = collect.getRequired("collect") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun fields(): Optional> = Optional.ofNullable(fields.getNullable("fields")) + /** + * Returns the raw JSON value of [collect]. + * + * Unlike [collect], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("collect") @ExcludeMissing fun _collect(): JsonField = collect + /** + * Returns the raw JSON value of [fields]. + * + * Unlike [fields], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("fields") @ExcludeMissing fun _fields(): JsonField> = fields @JsonAnyGetter @@ -4913,14 +5876,33 @@ private constructor( fun collect(collect: Collect) = collect(JsonField.of(collect)) + /** + * Sets [Builder.collect] to an arbitrary JSON value. + * + * You should usually call [Builder.collect] with a well-typed [Collect] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun collect(collect: JsonField) = apply { this.collect = collect } fun fields(fields: List) = fields(JsonField.of(fields)) + /** + * Sets [Builder.fields] to an arbitrary JSON value. + * + * You should usually call [Builder.fields] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun fields(fields: JsonField>) = apply { this.fields = fields.map { it.toMutableList() } } + /** + * Adds a single [Field] to [fields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addField(field: Field) = apply { fields = (fields ?: JsonField.of(mutableListOf())).also { @@ -5471,31 +6453,72 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the container object you are logging to */ + /** + * The id of the container object you are logging to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun objectId(): String = objectId.getRequired("object_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun objectType(): ObjectType = objectType.getRequired("object_type") - /** Include these properties in every span created under this parent */ + /** + * Include these properties in every span created under this parent + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun propagatedEvent(): Optional = Optional.ofNullable(propagatedEvent.getNullable("propagated_event")) - /** Identifiers for the row to to log a subspan under */ + /** + * Identifiers for the row to to log a subspan under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rowIds(): Optional = Optional.ofNullable(rowIds.getNullable("row_ids")) - /** The id of the container object you are logging to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Include these properties in every span created under this parent */ + /** + * Returns the raw JSON value of [propagatedEvent]. + * + * Unlike [propagatedEvent], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("propagated_event") @ExcludeMissing fun _propagatedEvent(): JsonField = propagatedEvent - /** Identifiers for the row to to log a subspan under */ + /** + * Returns the raw JSON value of [rowIds]. + * + * Unlike [rowIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("row_ids") @ExcludeMissing fun _rowIds(): JsonField = rowIds @JsonAnyGetter @@ -5553,11 +6576,24 @@ private constructor( /** The id of the container object you are logging to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the container object you are logging to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -5566,11 +6602,19 @@ private constructor( fun propagatedEvent(propagatedEvent: PropagatedEvent?) = propagatedEvent(JsonField.ofNullable(propagatedEvent)) - /** Include these properties in every span created under this parent */ + /** + * Alias for calling [Builder.propagatedEvent] with `propagatedEvent.orElse(null)`. + */ fun propagatedEvent(propagatedEvent: Optional) = propagatedEvent(propagatedEvent.getOrNull()) - /** Include these properties in every span created under this parent */ + /** + * Sets [Builder.propagatedEvent] to an arbitrary JSON value. + * + * You should usually call [Builder.propagatedEvent] with a well-typed + * [PropagatedEvent] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun propagatedEvent(propagatedEvent: JsonField) = apply { this.propagatedEvent = propagatedEvent } @@ -5578,10 +6622,16 @@ private constructor( /** Identifiers for the row to to log a subspan under */ fun rowIds(rowIds: RowIds?) = rowIds(JsonField.ofNullable(rowIds)) - /** Identifiers for the row to to log a subspan under */ + /** Alias for calling [Builder.rowIds] with `rowIds.orElse(null)`. */ fun rowIds(rowIds: Optional) = rowIds(rowIds.getOrNull()) - /** Identifiers for the row to to log a subspan under */ + /** + * Sets [Builder.rowIds] to an arbitrary JSON value. + * + * You should usually call [Builder.rowIds] with a well-typed [RowIds] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rowIds(rowIds: JsonField) = apply { this.rowIds = rowIds } fun additionalProperties(additionalProperties: Map) = apply { @@ -5832,24 +6882,56 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the row */ + /** + * The id of the row + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun id(): String = id.getRequired("id") - /** The root_span_id of the row */ + /** + * The root_span_id of the row + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun rootSpanId(): String = rootSpanId.getRequired("root_span_id") - /** The span_id of the row */ + /** + * The span_id of the row + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun spanId(): String = spanId.getRequired("span_id") - /** The id of the row */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The root_span_id of the row */ + /** + * Returns the raw JSON value of [rootSpanId]. + * + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId - /** The span_id of the row */ + /** + * Returns the raw JSON value of [spanId]. + * + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId @JsonAnyGetter @@ -5905,13 +6987,25 @@ private constructor( /** The id of the row */ fun id(id: String) = id(JsonField.of(id)) - /** The id of the row */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The root_span_id of the row */ fun rootSpanId(rootSpanId: String) = rootSpanId(JsonField.of(rootSpanId)) - /** The root_span_id of the row */ + /** + * Sets [Builder.rootSpanId] to an arbitrary JSON value. + * + * You should usually call [Builder.rootSpanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } @@ -5919,7 +7013,13 @@ private constructor( /** The span_id of the row */ fun spanId(spanId: String) = spanId(JsonField.of(spanId)) - /** The span_id of the row */ + /** + * Sets [Builder.spanId] to an arbitrary JSON value. + * + * You should usually call [Builder.spanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Experiment.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Experiment.kt index 15cc8fb6..6aac3eb1 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Experiment.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Experiment.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -64,107 +65,223 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the experiment */ + /** + * Unique identifier for the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Name of the experiment. Within a project, experiment names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the experiment belongs under */ + /** + * Unique identifier for the project that the experiment belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") /** * Whether or not the experiment is public. Public experiments can be viewed by anybody inside * or outside the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun public_(): Boolean = public_.getRequired("public") - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Id of default base experiment to compare against when viewing this experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun baseExpId(): Optional = Optional.ofNullable(baseExpId.getNullable("base_exp_id")) - /** Commit, taken directly from `repo_info.commit` */ + /** + * Commit, taken directly from `repo_info.commit` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun commit(): Optional = Optional.ofNullable(commit.getNullable("commit")) - /** Date of experiment creation */ + /** + * Date of experiment creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Identifier of the linked dataset, or null if the experiment is not linked to a dataset */ + /** + * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun datasetId(): Optional = Optional.ofNullable(datasetId.getNullable("dataset_id")) /** * Version number of the linked dataset the experiment was run against. This can be used to * reproduce the experiment after the dataset has been modified. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun datasetVersion(): Optional = Optional.ofNullable(datasetVersion.getNullable("dataset_version")) - /** Date of experiment deletion, or null if the experiment is still active */ + /** + * Date of experiment deletion, or null if the experiment is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Textual description of the experiment */ + /** + * Textual description of the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** User-controlled metadata about the experiment */ + /** + * User-controlled metadata about the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun repoInfo(): Optional = Optional.ofNullable(repoInfo.getNullable("repo_info")) - /** Identifies the user who created the experiment */ + /** + * Identifies the user who created the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the experiment */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the experiment belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody inside - * or outside the organization + * Returns the raw JSON value of [public_]. + * + * Unlike [public_], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("public") @ExcludeMissing fun _public_(): JsonField = public_ - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Returns the raw JSON value of [baseExpId]. + * + * Unlike [baseExpId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("base_exp_id") @ExcludeMissing fun _baseExpId(): JsonField = baseExpId - /** Commit, taken directly from `repo_info.commit` */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit - /** Date of experiment creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Identifier of the linked dataset, or null if the experiment is not linked to a dataset */ + /** + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField = datasetId /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Returns the raw JSON value of [datasetVersion]. + * + * Unlike [datasetVersion], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("dataset_version") @ExcludeMissing fun _datasetVersion(): JsonField = datasetVersion - /** Date of experiment deletion, or null if the experiment is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Textual description of the experiment */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** User-controlled metadata about the experiment */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("repo_info") @ExcludeMissing fun _repoInfo(): JsonField = repoInfo - /** Identifies the user who created the experiment */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -254,19 +371,35 @@ private constructor( /** Unique identifier for the experiment */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the experiment */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the experiment. Within a project, experiment names are unique */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the experiment belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the experiment belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** @@ -276,36 +409,55 @@ private constructor( fun public_(public_: Boolean) = public_(JsonField.of(public_)) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Sets [Builder.public_] to an arbitrary JSON value. + * + * You should usually call [Builder.public_] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun public_(public_: JsonField) = apply { this.public_ = public_ } /** Id of default base experiment to compare against when viewing this experiment */ fun baseExpId(baseExpId: String?) = baseExpId(JsonField.ofNullable(baseExpId)) - /** Id of default base experiment to compare against when viewing this experiment */ + /** Alias for calling [Builder.baseExpId] with `baseExpId.orElse(null)`. */ fun baseExpId(baseExpId: Optional) = baseExpId(baseExpId.getOrNull()) - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Sets [Builder.baseExpId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExpId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun baseExpId(baseExpId: JsonField) = apply { this.baseExpId = baseExpId } /** Commit, taken directly from `repo_info.commit` */ fun commit(commit: String?) = commit(JsonField.ofNullable(commit)) - /** Commit, taken directly from `repo_info.commit` */ + /** Alias for calling [Builder.commit] with `commit.orElse(null)`. */ fun commit(commit: Optional) = commit(commit.getOrNull()) - /** Commit, taken directly from `repo_info.commit` */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun commit(commit: JsonField) = apply { this.commit = commit } /** Date of experiment creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of experiment creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of experiment creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** @@ -313,13 +465,15 @@ private constructor( */ fun datasetId(datasetId: String?) = datasetId(JsonField.ofNullable(datasetId)) - /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset - */ + /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */ fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull()) /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun datasetId(datasetId: JsonField) = apply { this.datasetId = datasetId } @@ -330,16 +484,16 @@ private constructor( fun datasetVersion(datasetVersion: String?) = datasetVersion(JsonField.ofNullable(datasetVersion)) - /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. - */ + /** Alias for calling [Builder.datasetVersion] with `datasetVersion.orElse(null)`. */ fun datasetVersion(datasetVersion: Optional) = datasetVersion(datasetVersion.getOrNull()) /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Sets [Builder.datasetVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetVersion(datasetVersion: JsonField) = apply { this.datasetVersion = datasetVersion @@ -348,46 +502,75 @@ private constructor( /** Date of experiment deletion, or null if the experiment is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of experiment deletion, or null if the experiment is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of experiment deletion, or null if the experiment is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } /** Textual description of the experiment */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the experiment */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the experiment */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** User-controlled metadata about the experiment */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the experiment */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the experiment */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = repoInfo(JsonField.ofNullable(repoInfo)) - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun repoInfo(repoInfo: JsonField) = apply { this.repoInfo = repoInfo } /** Identifies the user who created the experiment */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the experiment */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the experiment */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentCreateParams.kt index ae017556..b3c21a00 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,84 +33,158 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Unique identifier for the project that the experiment belongs under */ + /** + * Unique identifier for the project that the experiment belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Id of default base experiment to compare against when viewing this experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun baseExpId(): Optional = body.baseExpId() - /** Identifier of the linked dataset, or null if the experiment is not linked to a dataset */ + /** + * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun datasetId(): Optional = body.datasetId() /** * Version number of the linked dataset the experiment was run against. This can be used to * reproduce the experiment after the dataset has been modified. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun datasetVersion(): Optional = body.datasetVersion() - /** Textual description of the experiment */ + /** + * Textual description of the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() /** * Normally, creating an experiment with the same name as an existing experiment will return the * existing one un-modified. But if `ensure_new` is true, registration will generate a new * experiment with a unique name in case of a conflict. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun ensureNew(): Optional = body.ensureNew() - /** User-controlled metadata about the experiment */ + /** + * User-controlled metadata about the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Name of the experiment. Within a project, experiment names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() /** * Whether or not the experiment is public. Public experiments can be viewed by anybody inside * or outside the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun public_(): Optional = body.public_() - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun repoInfo(): Optional = body.repoInfo() - /** Unique identifier for the project that the experiment belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Returns the raw JSON value of [baseExpId]. + * + * Unlike [baseExpId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _baseExpId(): JsonField = body._baseExpId() - /** Identifier of the linked dataset, or null if the experiment is not linked to a dataset */ + /** + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _datasetId(): JsonField = body._datasetId() /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Returns the raw JSON value of [datasetVersion]. + * + * Unlike [datasetVersion], this method doesn't throw if the JSON field has an unexpected type. */ fun _datasetVersion(): JsonField = body._datasetVersion() - /** Textual description of the experiment */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() /** - * Normally, creating an experiment with the same name as an existing experiment will return the - * existing one un-modified. But if `ensure_new` is true, registration will generate a new - * experiment with a unique name in case of a conflict. + * Returns the raw JSON value of [ensureNew]. + * + * Unlike [ensureNew], this method doesn't throw if the JSON field has an unexpected type. */ fun _ensureNew(): JsonField = body._ensureNew() - /** User-controlled metadata about the experiment */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody inside - * or outside the organization + * Returns the raw JSON value of [public_]. + * + * Unlike [public_], this method doesn't throw if the JSON field has an unexpected type. */ fun _public_(): JsonField = body._public_() - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ fun _repoInfo(): JsonField = body._repoInfo() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -162,26 +237,47 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the project that the experiment belongs under */ + /** + * Unique identifier for the project that the experiment belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Id of default base experiment to compare against when viewing this experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun baseExpId(): Optional = Optional.ofNullable(baseExpId.getNullable("base_exp_id")) /** * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun datasetId(): Optional = Optional.ofNullable(datasetId.getNullable("dataset_id")) /** * Version number of the linked dataset the experiment was run against. This can be used to * reproduce the experiment after the dataset has been modified. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun datasetVersion(): Optional = Optional.ofNullable(datasetVersion.getNullable("dataset_version")) - /** Textual description of the experiment */ + /** + * Textual description of the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) @@ -189,69 +285,119 @@ private constructor( * Normally, creating an experiment with the same name as an existing experiment will return * the existing one un-modified. But if `ensure_new` is true, registration will generate a * new experiment with a unique name in case of a conflict. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun ensureNew(): Optional = Optional.ofNullable(ensureNew.getNullable("ensure_new")) - /** User-controlled metadata about the experiment */ + /** + * User-controlled metadata about the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Name of the experiment. Within a project, experiment names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** * Whether or not the experiment is public. Public experiments can be viewed by anybody * inside or outside the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun public_(): Optional = Optional.ofNullable(public_.getNullable("public")) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun repoInfo(): Optional = Optional.ofNullable(repoInfo.getNullable("repo_info")) - /** Unique identifier for the project that the experiment belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Returns the raw JSON value of [baseExpId]. + * + * Unlike [baseExpId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("base_exp_id") @ExcludeMissing fun _baseExpId(): JsonField = baseExpId /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField = datasetId /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Returns the raw JSON value of [datasetVersion]. + * + * Unlike [datasetVersion], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("dataset_version") @ExcludeMissing fun _datasetVersion(): JsonField = datasetVersion - /** Textual description of the experiment */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Normally, creating an experiment with the same name as an existing experiment will return - * the existing one un-modified. But if `ensure_new` is true, registration will generate a - * new experiment with a unique name in case of a conflict. + * Returns the raw JSON value of [ensureNew]. + * + * Unlike [ensureNew], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("ensure_new") @ExcludeMissing fun _ensureNew(): JsonField = ensureNew - /** User-controlled metadata about the experiment */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Returns the raw JSON value of [public_]. + * + * Unlike [public_], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("public") @ExcludeMissing fun _public_(): JsonField = public_ - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("repo_info") @ExcludeMissing fun _repoInfo(): JsonField = repoInfo @JsonAnyGetter @@ -326,16 +472,28 @@ private constructor( /** Unique identifier for the project that the experiment belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the experiment belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Id of default base experiment to compare against when viewing this experiment */ fun baseExpId(baseExpId: String?) = baseExpId(JsonField.ofNullable(baseExpId)) - /** Id of default base experiment to compare against when viewing this experiment */ + /** Alias for calling [Builder.baseExpId] with `baseExpId.orElse(null)`. */ fun baseExpId(baseExpId: Optional) = baseExpId(baseExpId.getOrNull()) - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Sets [Builder.baseExpId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExpId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun baseExpId(baseExpId: JsonField) = apply { this.baseExpId = baseExpId } /** @@ -344,15 +502,15 @@ private constructor( */ fun datasetId(datasetId: String?) = datasetId(JsonField.ofNullable(datasetId)) - /** - * Identifier of the linked dataset, or null if the experiment is not linked to a - * dataset - */ + /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */ fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull()) /** - * Identifier of the linked dataset, or null if the experiment is not linked to a - * dataset + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetId(datasetId: JsonField) = apply { this.datasetId = datasetId } @@ -363,16 +521,16 @@ private constructor( fun datasetVersion(datasetVersion: String?) = datasetVersion(JsonField.ofNullable(datasetVersion)) - /** - * Version number of the linked dataset the experiment was run against. This can be used - * to reproduce the experiment after the dataset has been modified. - */ + /** Alias for calling [Builder.datasetVersion] with `datasetVersion.orElse(null)`. */ fun datasetVersion(datasetVersion: Optional) = datasetVersion(datasetVersion.getOrNull()) /** - * Version number of the linked dataset the experiment was run against. This can be used - * to reproduce the experiment after the dataset has been modified. + * Sets [Builder.datasetVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetVersion(datasetVersion: JsonField) = apply { this.datasetVersion = datasetVersion @@ -381,10 +539,16 @@ private constructor( /** Textual description of the experiment */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the experiment */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the experiment */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -397,42 +561,52 @@ private constructor( fun ensureNew(ensureNew: Boolean?) = ensureNew(JsonField.ofNullable(ensureNew)) /** - * Normally, creating an experiment with the same name as an existing experiment will - * return the existing one un-modified. But if `ensure_new` is true, registration will - * generate a new experiment with a unique name in case of a conflict. + * Alias for [Builder.ensureNew]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun ensureNew(ensureNew: Boolean) = ensureNew(ensureNew as Boolean?) - /** - * Normally, creating an experiment with the same name as an existing experiment will - * return the existing one un-modified. But if `ensure_new` is true, registration will - * generate a new experiment with a unique name in case of a conflict. - */ + /** Alias for calling [Builder.ensureNew] with `ensureNew.orElse(null)`. */ fun ensureNew(ensureNew: Optional) = ensureNew(ensureNew.getOrNull()) /** - * Normally, creating an experiment with the same name as an existing experiment will - * return the existing one un-modified. But if `ensure_new` is true, registration will - * generate a new experiment with a unique name in case of a conflict. + * Sets [Builder.ensureNew] to an arbitrary JSON value. + * + * You should usually call [Builder.ensureNew] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun ensureNew(ensureNew: JsonField) = apply { this.ensureNew = ensureNew } /** User-controlled metadata about the experiment */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the experiment */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the experiment */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Name of the experiment. Within a project, experiment names are unique */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the experiment. Within a project, experiment names are unique */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -442,30 +616,37 @@ private constructor( fun public_(public_: Boolean?) = public_(JsonField.ofNullable(public_)) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Alias for [Builder.public_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun public_(public_: Boolean) = public_(public_ as Boolean?) - /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization - */ + /** Alias for calling [Builder.public_] with `public_.orElse(null)`. */ fun public_(public_: Optional) = public_(public_.getOrNull()) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Sets [Builder.public_] to an arbitrary JSON value. + * + * You should usually call [Builder.public_] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun public_(public_: JsonField) = apply { this.public_ = public_ } /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = repoInfo(JsonField.ofNullable(repoInfo)) - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun repoInfo(repoInfo: JsonField) = apply { this.repoInfo = repoInfo } fun additionalProperties(additionalProperties: Map) = apply { @@ -554,16 +735,28 @@ private constructor( /** Unique identifier for the project that the experiment belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the experiment belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Id of default base experiment to compare against when viewing this experiment */ fun baseExpId(baseExpId: String?) = apply { body.baseExpId(baseExpId) } - /** Id of default base experiment to compare against when viewing this experiment */ + /** Alias for calling [Builder.baseExpId] with `baseExpId.orElse(null)`. */ fun baseExpId(baseExpId: Optional) = baseExpId(baseExpId.getOrNull()) - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Sets [Builder.baseExpId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExpId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun baseExpId(baseExpId: JsonField) = apply { body.baseExpId(baseExpId) } /** @@ -571,13 +764,15 @@ private constructor( */ fun datasetId(datasetId: String?) = apply { body.datasetId(datasetId) } - /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset - */ + /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */ fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull()) /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun datasetId(datasetId: JsonField) = apply { body.datasetId(datasetId) } @@ -587,16 +782,16 @@ private constructor( */ fun datasetVersion(datasetVersion: String?) = apply { body.datasetVersion(datasetVersion) } - /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. - */ + /** Alias for calling [Builder.datasetVersion] with `datasetVersion.orElse(null)`. */ fun datasetVersion(datasetVersion: Optional) = datasetVersion(datasetVersion.getOrNull()) /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Sets [Builder.datasetVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetVersion(datasetVersion: JsonField) = apply { body.datasetVersion(datasetVersion) @@ -605,10 +800,16 @@ private constructor( /** Textual description of the experiment */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the experiment */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the experiment */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** @@ -619,42 +820,51 @@ private constructor( fun ensureNew(ensureNew: Boolean?) = apply { body.ensureNew(ensureNew) } /** - * Normally, creating an experiment with the same name as an existing experiment will return - * the existing one un-modified. But if `ensure_new` is true, registration will generate a - * new experiment with a unique name in case of a conflict. + * Alias for [Builder.ensureNew]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun ensureNew(ensureNew: Boolean) = ensureNew(ensureNew as Boolean?) - /** - * Normally, creating an experiment with the same name as an existing experiment will return - * the existing one un-modified. But if `ensure_new` is true, registration will generate a - * new experiment with a unique name in case of a conflict. - */ + /** Alias for calling [Builder.ensureNew] with `ensureNew.orElse(null)`. */ fun ensureNew(ensureNew: Optional) = ensureNew(ensureNew.getOrNull()) /** - * Normally, creating an experiment with the same name as an existing experiment will return - * the existing one un-modified. But if `ensure_new` is true, registration will generate a - * new experiment with a unique name in case of a conflict. + * Sets [Builder.ensureNew] to an arbitrary JSON value. + * + * You should usually call [Builder.ensureNew] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun ensureNew(ensureNew: JsonField) = apply { body.ensureNew(ensureNew) } /** User-controlled metadata about the experiment */ fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } - /** User-controlled metadata about the experiment */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the experiment */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** Name of the experiment. Within a project, experiment names are unique */ fun name(name: String?) = apply { body.name(name) } - /** Name of the experiment. Within a project, experiment names are unique */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -664,30 +874,36 @@ private constructor( fun public_(public_: Boolean?) = apply { body.public_(public_) } /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Alias for [Builder.public_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun public_(public_: Boolean) = public_(public_ as Boolean?) - /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization - */ + /** Alias for calling [Builder.public_] with `public_.orElse(null)`. */ fun public_(public_: Optional) = public_(public_.getOrNull()) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Sets [Builder.public_] to an arbitrary JSON value. + * + * You should usually call [Builder.public_] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun public_(public_: JsonField) = apply { body.public_(public_) } /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = apply { body.repoInfo(repoInfo) } - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun repoInfo(repoInfo: JsonField) = apply { body.repoInfo(repoInfo) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentEvent.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentEvent.kt index d05a1609..009aab07 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentEvent.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentEvent.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -80,6 +81,9 @@ private constructor( /** * A unique identifier for the experiment event. If you don't provide one, BrainTrust will * generate one for you + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun id(): String = id.getRequired("id") @@ -87,25 +91,51 @@ private constructor( * The transaction id of an event is unique to the network operation that processed the event * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve * a versioned snapshot of the experiment (see the `version` parameter) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun _xactId(): String = _xactId.getRequired("_xact_id") - /** The timestamp the experiment event was created */ + /** + * The timestamp the experiment event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun created(): OffsetDateTime = created.getRequired("created") - /** Unique identifier for the experiment */ + /** + * Unique identifier for the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun experimentId(): String = experimentId.getRequired("experiment_id") - /** Unique identifier for the project that the experiment belongs under */ + /** + * Unique identifier for the project that the experiment belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** A unique identifier for the trace this experiment event belongs to */ + /** + * A unique identifier for the trace this experiment event belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun rootSpanId(): String = rootSpanId.getRequired("root_span_id") /** * A unique identifier used to link different experiment events together as part of a full * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full * details on tracing + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun spanId(): String = spanId.getRequired("span_id") @@ -113,6 +143,9 @@ private constructor( * Context is additional information about the code that produced the experiment event. It is * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the * location in code which produced the experiment event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun context(): Optional = Optional.ofNullable(context.getNullable("context")) @@ -137,7 +170,12 @@ private constructor( */ @JsonProperty("input") @ExcludeMissing fun _input(): JsonValue = input - /** Whether this span is a root span */ + /** + * Whether this span is a root span + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isRoot(): Optional = Optional.ofNullable(isRoot.getNullable("is_root")) /** @@ -146,6 +184,9 @@ private constructor( * example, you could log the `prompt`, example's `id`, or anything else that would be useful to * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys * must be strings + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) @@ -153,10 +194,18 @@ private constructor( * Metrics are numerical measurements tracking the execution of the code that produced the * experiment event. Use "start" and "end" to track the time span over which the experiment * event was produced + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metrics(): Optional = Optional.ofNullable(metrics.getNullable("metrics")) - /** Indicates the event was copied from another object. */ + /** + * Indicates the event was copied from another object. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) /** @@ -176,111 +225,155 @@ private constructor( * generated and grouth truth summary. The word similarity score could help you determine * whether the summarization was covering similar concepts or not. You can use these scores to * help you sort, filter, and compare experiments + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Human-identifying attributes of the span, such as name, type, etc. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun spanAttributes(): Optional = Optional.ofNullable(spanAttributes.getNullable("span_attributes")) /** * An array of the parent `span_ids` of this experiment event. This should be empty for the root * span of a trace, and should most often contain just one parent element for subspans + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanParents(): Optional> = Optional.ofNullable(spanParents.getNullable("span_parents")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * A unique identifier for the experiment event. If you don't provide one, BrainTrust will - * generate one for you + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The transaction id of an event is unique to the network operation that processed the event - * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve - * a versioned snapshot of the experiment (see the `version` parameter) + * Returns the raw JSON value of [_xactId]. + * + * Unlike [_xactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_xact_id") @ExcludeMissing fun __xactId(): JsonField = _xactId - /** The timestamp the experiment event was created */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Unique identifier for the experiment */ + /** + * Returns the raw JSON value of [experimentId]. + * + * Unlike [experimentId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("experiment_id") @ExcludeMissing fun _experimentId(): JsonField = experimentId - /** Unique identifier for the project that the experiment belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** A unique identifier for the trace this experiment event belongs to */ + /** + * Returns the raw JSON value of [rootSpanId]. + * + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId /** - * A unique identifier used to link different experiment events together as part of a full - * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full - * details on tracing + * Returns the raw JSON value of [spanId]. + * + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId /** - * Context is additional information about the code that produced the experiment event. It is - * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the - * location in code which produced the experiment event + * Returns the raw JSON value of [context]. + * + * Unlike [context], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("context") @ExcludeMissing fun _context(): JsonField = context - /** Whether this span is a root span */ + /** + * Returns the raw JSON value of [isRoot]. + * + * Unlike [isRoot], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_root") @ExcludeMissing fun _isRoot(): JsonField = isRoot /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. For - * example, you could log the `prompt`, example's `id`, or anything else that would be useful to - * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys - * must be strings + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * experiment event. Use "start" and "end" to track the time span over which the experiment - * event was produced + * Returns the raw JSON value of [metrics]. + * + * Unlike [metrics], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metrics") @ExcludeMissing fun _metrics(): JsonField = metrics - /** Indicates the event was copied from another object. */ + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety - * of signals that help you determine how accurate the outputs are compared to what you expect - * and diagnose failures. For example, a summarization app might have one score that tells you - * how accurate the summary is, and another that measures the word similarity between the - * generated and grouth truth summary. The word similarity score could help you determine - * whether the summarization was covering similar concepts or not. You can use these scores to - * help you sort, filter, and compare experiments + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Returns the raw JSON value of [spanAttributes]. + * + * Unlike [spanAttributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("span_attributes") @ExcludeMissing fun _spanAttributes(): JsonField = spanAttributes /** - * An array of the parent `span_ids` of this experiment event. This should be empty for the root - * span of a trace, and should most often contain just one parent element for subspans + * Returns the raw JSON value of [spanParents]. + * + * Unlike [spanParents], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_parents") @ExcludeMissing fun _spanParents(): JsonField> = spanParents - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -391,8 +484,10 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** - * A unique identifier for the experiment event. If you don't provide one, BrainTrust will - * generate one for you + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } @@ -404,22 +499,35 @@ private constructor( fun _xactId(_xactId: String) = _xactId(JsonField.of(_xactId)) /** - * The transaction id of an event is unique to the network operation that processed the - * event insertion. Transaction ids are monotonically increasing over time and can be used - * to retrieve a versioned snapshot of the experiment (see the `version` parameter) + * Sets [Builder._xactId] to an arbitrary JSON value. + * + * You should usually call [Builder._xactId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun _xactId(_xactId: JsonField) = apply { this._xactId = _xactId } /** The timestamp the experiment event was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) - /** The timestamp the experiment event was created */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Unique identifier for the experiment */ fun experimentId(experimentId: String) = experimentId(JsonField.of(experimentId)) - /** Unique identifier for the experiment */ + /** + * Sets [Builder.experimentId] to an arbitrary JSON value. + * + * You should usually call [Builder.experimentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun experimentId(experimentId: JsonField) = apply { this.experimentId = experimentId } @@ -427,13 +535,25 @@ private constructor( /** Unique identifier for the project that the experiment belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the experiment belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** A unique identifier for the trace this experiment event belongs to */ fun rootSpanId(rootSpanId: String) = rootSpanId(JsonField.of(rootSpanId)) - /** A unique identifier for the trace this experiment event belongs to */ + /** + * Sets [Builder.rootSpanId] to an arbitrary JSON value. + * + * You should usually call [Builder.rootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } /** @@ -444,9 +564,10 @@ private constructor( fun spanId(spanId: String) = spanId(JsonField.of(spanId)) /** - * A unique identifier used to link different experiment events together as part of a full - * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full - * details on tracing + * Sets [Builder.spanId] to an arbitrary JSON value. + * + * You should usually call [Builder.spanId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } @@ -457,17 +578,14 @@ private constructor( */ fun context(context: Context?) = context(JsonField.ofNullable(context)) - /** - * Context is additional information about the code that produced the experiment event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the experiment event - */ + /** Alias for calling [Builder.context] with `context.orElse(null)`. */ fun context(context: Optional) = context(context.getOrNull()) /** - * Context is additional information about the code that produced the experiment event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the experiment event + * Sets [Builder.context] to an arbitrary JSON value. + * + * You should usually call [Builder.context] with a well-typed [Context] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun context(context: JsonField) = apply { this.context = context } @@ -495,13 +613,22 @@ private constructor( /** Whether this span is a root span */ fun isRoot(isRoot: Boolean?) = isRoot(JsonField.ofNullable(isRoot)) - /** Whether this span is a root span */ + /** + * Alias for [Builder.isRoot]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isRoot(isRoot: Boolean) = isRoot(isRoot as Boolean?) - /** Whether this span is a root span */ + /** Alias for calling [Builder.isRoot] with `isRoot.orElse(null)`. */ fun isRoot(isRoot: Optional) = isRoot(isRoot.getOrNull()) - /** Whether this span is a root span */ + /** + * Sets [Builder.isRoot] to an arbitrary JSON value. + * + * You should usually call [Builder.isRoot] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun isRoot(isRoot: JsonField) = apply { this.isRoot = isRoot } /** @@ -513,21 +640,15 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } @@ -538,27 +659,30 @@ private constructor( */ fun metrics(metrics: Metrics?) = metrics(JsonField.ofNullable(metrics)) - /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * experiment event. Use "start" and "end" to track the time span over which the experiment - * event was produced - */ + /** Alias for calling [Builder.metrics] with `metrics.orElse(null)`. */ fun metrics(metrics: Optional) = metrics(metrics.getOrNull()) /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * experiment event. Use "start" and "end" to track the time span over which the experiment - * event was produced + * Sets [Builder.metrics] to an arbitrary JSON value. + * + * You should usually call [Builder.metrics] with a well-typed [Metrics] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun metrics(metrics: JsonField) = apply { this.metrics = metrics } /** Indicates the event was copied from another object. */ fun origin(origin: ObjectReference?) = origin(JsonField.ofNullable(origin)) - /** Indicates the event was copied from another object. */ + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) - /** Indicates the event was copied from another object. */ + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [ObjectReference] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** @@ -581,25 +705,14 @@ private constructor( */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare experiments - */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare experiments + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun scores(scores: JsonField) = apply { this.scores = scores } @@ -607,11 +720,17 @@ private constructor( fun spanAttributes(spanAttributes: SpanAttributes?) = spanAttributes(JsonField.ofNullable(spanAttributes)) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** Alias for calling [Builder.spanAttributes] with `spanAttributes.orElse(null)`. */ fun spanAttributes(spanAttributes: Optional) = spanAttributes(spanAttributes.getOrNull()) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Sets [Builder.spanAttributes] to an arbitrary JSON value. + * + * You should usually call [Builder.spanAttributes] with a well-typed [SpanAttributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun spanAttributes(spanAttributes: JsonField) = apply { this.spanAttributes = spanAttributes } @@ -622,23 +741,24 @@ private constructor( */ fun spanParents(spanParents: List?) = spanParents(JsonField.ofNullable(spanParents)) - /** - * An array of the parent `span_ids` of this experiment event. This should be empty for the - * root span of a trace, and should most often contain just one parent element for subspans - */ + /** Alias for calling [Builder.spanParents] with `spanParents.orElse(null)`. */ fun spanParents(spanParents: Optional>) = spanParents(spanParents.getOrNull()) /** - * An array of the parent `span_ids` of this experiment event. This should be empty for the - * root span of a trace, and should most often contain just one parent element for subspans + * Sets [Builder.spanParents] to an arbitrary JSON value. + * + * You should usually call [Builder.spanParents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun spanParents(spanParents: JsonField>) = apply { this.spanParents = spanParents.map { it.toMutableList() } } /** - * An array of the parent `span_ids` of this experiment event. This should be empty for the - * root span of a trace, and should most often contain just one parent element for subspans + * Adds a single [String] to [spanParents]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addSpanParent(spanParent: String) = apply { spanParents = @@ -650,15 +770,25 @@ private constructor( /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -730,29 +860,59 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the file in code where the experiment event was created */ + /** + * Name of the file in code where the experiment event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFilename(): Optional = Optional.ofNullable(callerFilename.getNullable("caller_filename")) - /** The function in code which created the experiment event */ + /** + * The function in code which created the experiment event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFunctionname(): Optional = Optional.ofNullable(callerFunctionname.getNullable("caller_functionname")) - /** Line of code where the experiment event was created */ + /** + * Line of code where the experiment event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerLineno(): Optional = Optional.ofNullable(callerLineno.getNullable("caller_lineno")) - /** Name of the file in code where the experiment event was created */ + /** + * Returns the raw JSON value of [callerFilename]. + * + * Unlike [callerFilename], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_filename") @ExcludeMissing fun _callerFilename(): JsonField = callerFilename - /** The function in code which created the experiment event */ + /** + * Returns the raw JSON value of [callerFunctionname]. + * + * Unlike [callerFunctionname], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("caller_functionname") @ExcludeMissing fun _callerFunctionname(): JsonField = callerFunctionname - /** Line of code where the experiment event was created */ + /** + * Returns the raw JSON value of [callerLineno]. + * + * Unlike [callerLineno], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_lineno") @ExcludeMissing fun _callerLineno(): JsonField = callerLineno @@ -802,11 +962,17 @@ private constructor( fun callerFilename(callerFilename: String?) = callerFilename(JsonField.ofNullable(callerFilename)) - /** Name of the file in code where the experiment event was created */ + /** Alias for calling [Builder.callerFilename] with `callerFilename.orElse(null)`. */ fun callerFilename(callerFilename: Optional) = callerFilename(callerFilename.getOrNull()) - /** Name of the file in code where the experiment event was created */ + /** + * Sets [Builder.callerFilename] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFilename] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFilename(callerFilename: JsonField) = apply { this.callerFilename = callerFilename } @@ -815,11 +981,20 @@ private constructor( fun callerFunctionname(callerFunctionname: String?) = callerFunctionname(JsonField.ofNullable(callerFunctionname)) - /** The function in code which created the experiment event */ + /** + * Alias for calling [Builder.callerFunctionname] with + * `callerFunctionname.orElse(null)`. + */ fun callerFunctionname(callerFunctionname: Optional) = callerFunctionname(callerFunctionname.getOrNull()) - /** The function in code which created the experiment event */ + /** + * Sets [Builder.callerFunctionname] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFunctionname] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFunctionname(callerFunctionname: JsonField) = apply { this.callerFunctionname = callerFunctionname } @@ -827,13 +1002,23 @@ private constructor( /** Line of code where the experiment event was created */ fun callerLineno(callerLineno: Long?) = callerLineno(JsonField.ofNullable(callerLineno)) - /** Line of code where the experiment event was created */ + /** + * Alias for [Builder.callerLineno]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun callerLineno(callerLineno: Long) = callerLineno(callerLineno as Long?) - /** Line of code where the experiment event was created */ + /** Alias for calling [Builder.callerLineno] with `callerLineno.orElse(null)`. */ fun callerLineno(callerLineno: Optional) = callerLineno(callerLineno.getOrNull()) - /** Line of code where the experiment event was created */ + /** + * Sets [Builder.callerLineno] to an arbitrary JSON value. + * + * You should usually call [Builder.callerLineno] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerLineno(callerLineno: JsonField) = apply { this.callerLineno = callerLineno } @@ -902,10 +1087,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The model used for this example */ + /** + * The model used for this example + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) - /** The model used for this example */ + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model @JsonAnyGetter @@ -946,10 +1140,16 @@ private constructor( /** The model used for this example */ fun model(model: String?) = model(JsonField.ofNullable(model)) - /** The model used for this example */ + /** Alias for calling [Builder.model] with `model.orElse(null)`. */ fun model(model: Optional) = model(model.getOrNull()) - /** The model used for this example */ + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun additionalProperties(additionalProperties: Map) = apply { @@ -1043,6 +1243,9 @@ private constructor( /** * The number of tokens in the completion generated by the model (only set if this is an LLM * span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun completionTokens(): Optional = Optional.ofNullable(completionTokens.getNullable("completion_tokens")) @@ -1050,12 +1253,18 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the experiment event * finished + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun end(): Optional = Optional.ofNullable(end.getNullable("end")) /** * The number of tokens in the prompt used to generate the experiment event (only set if * this is an LLM span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun promptTokens(): Optional = Optional.ofNullable(promptTokens.getNullable("prompt_tokens")) @@ -1063,41 +1272,59 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the experiment event * started + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun start(): Optional = Optional.ofNullable(start.getNullable("start")) - /** The total number of tokens in the input and output of the experiment event. */ + /** + * The total number of tokens in the input and output of the experiment event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tokens(): Optional = Optional.ofNullable(tokens.getNullable("tokens")) /** - * The number of tokens in the completion generated by the model (only set if this is an LLM - * span) + * Returns the raw JSON value of [completionTokens]. + * + * Unlike [completionTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("completion_tokens") @ExcludeMissing fun _completionTokens(): JsonField = completionTokens /** - * A unix timestamp recording when the section of code which produced the experiment event - * finished + * Returns the raw JSON value of [end]. + * + * Unlike [end], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("end") @ExcludeMissing fun _end(): JsonField = end /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) + * Returns the raw JSON value of [promptTokens]. + * + * Unlike [promptTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("prompt_tokens") @ExcludeMissing fun _promptTokens(): JsonField = promptTokens /** - * A unix timestamp recording when the section of code which produced the experiment event - * started + * Returns the raw JSON value of [start]. + * + * Unlike [start], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("start") @ExcludeMissing fun _start(): JsonField = start - /** The total number of tokens in the input and output of the experiment event. */ + /** + * Returns the raw JSON value of [tokens]. + * + * Unlike [tokens], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tokens") @ExcludeMissing fun _tokens(): JsonField = tokens @JsonAnyGetter @@ -1174,22 +1401,25 @@ private constructor( completionTokens(JsonField.ofNullable(completionTokens)) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for [Builder.completionTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun completionTokens(completionTokens: Long) = completionTokens(completionTokens as Long?) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for calling [Builder.completionTokens] with `completionTokens.orElse(null)`. */ fun completionTokens(completionTokens: Optional) = completionTokens(completionTokens.getOrNull()) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Sets [Builder.completionTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.completionTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun completionTokens(completionTokens: JsonField) = apply { this.completionTokens = completionTokens @@ -1202,20 +1432,21 @@ private constructor( fun end(end: Double?) = end(JsonField.ofNullable(end)) /** - * A unix timestamp recording when the section of code which produced the experiment - * event finished + * Alias for [Builder.end]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun end(end: Double) = end(end as Double?) - /** - * A unix timestamp recording when the section of code which produced the experiment - * event finished - */ + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ fun end(end: Optional) = end(end.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the experiment - * event finished + * Sets [Builder.end] to an arbitrary JSON value. + * + * You should usually call [Builder.end] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun end(end: JsonField) = apply { this.end = end } @@ -1226,20 +1457,21 @@ private constructor( fun promptTokens(promptTokens: Long?) = promptTokens(JsonField.ofNullable(promptTokens)) /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) + * Alias for [Builder.promptTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun promptTokens(promptTokens: Long) = promptTokens(promptTokens as Long?) - /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) - */ + /** Alias for calling [Builder.promptTokens] with `promptTokens.orElse(null)`. */ fun promptTokens(promptTokens: Optional) = promptTokens(promptTokens.getOrNull()) /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) + * Sets [Builder.promptTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.promptTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun promptTokens(promptTokens: JsonField) = apply { this.promptTokens = promptTokens @@ -1252,33 +1484,44 @@ private constructor( fun start(start: Double?) = start(JsonField.ofNullable(start)) /** - * A unix timestamp recording when the section of code which produced the experiment - * event started + * Alias for [Builder.start]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun start(start: Double) = start(start as Double?) - /** - * A unix timestamp recording when the section of code which produced the experiment - * event started - */ + /** Alias for calling [Builder.start] with `start.orElse(null)`. */ fun start(start: Optional) = start(start.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the experiment - * event started + * Sets [Builder.start] to an arbitrary JSON value. + * + * You should usually call [Builder.start] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun start(start: JsonField) = apply { this.start = start } /** The total number of tokens in the input and output of the experiment event. */ fun tokens(tokens: Long?) = tokens(JsonField.ofNullable(tokens)) - /** The total number of tokens in the input and output of the experiment event. */ + /** + * Alias for [Builder.tokens]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun tokens(tokens: Long) = tokens(tokens as Long?) - /** The total number of tokens in the input and output of the experiment event. */ + /** Alias for calling [Builder.tokens] with `tokens.orElse(null)`. */ fun tokens(tokens: Optional) = tokens(tokens.getOrNull()) - /** The total number of tokens in the input and output of the experiment event. */ + /** + * Sets [Builder.tokens] to an arbitrary JSON value. + * + * You should usually call [Builder.tokens] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tokens(tokens: JsonField) = apply { this.tokens = tokens } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFeedbackParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFeedbackParams.kt index b4b3324a..1d338421 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFeedbackParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFeedbackParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,10 +33,19 @@ private constructor( /** Experiment id */ fun experimentId(): String = experimentId - /** A list of experiment feedback items */ + /** + * A list of experiment feedback items + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun feedback(): List = body.feedback() - /** A list of experiment feedback items */ + /** + * Returns the raw JSON value of [feedback]. + * + * Unlike [feedback], this method doesn't throw if the JSON field has an unexpected type. + */ fun _feedback(): JsonField> = body._feedback() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,10 +78,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of experiment feedback items */ + /** + * A list of experiment feedback items + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun feedback(): List = feedback.getRequired("feedback") - /** A list of experiment feedback items */ + /** + * Returns the raw JSON value of [feedback]. + * + * Unlike [feedback], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("feedback") @ExcludeMissing fun _feedback(): JsonField> = feedback @@ -121,12 +140,22 @@ private constructor( /** A list of experiment feedback items */ fun feedback(feedback: List) = feedback(JsonField.of(feedback)) - /** A list of experiment feedback items */ + /** + * Sets [Builder.feedback] to an arbitrary JSON value. + * + * You should usually call [Builder.feedback] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun feedback(feedback: JsonField>) = apply { this.feedback = feedback.map { it.toMutableList() } } - /** A list of experiment feedback items */ + /** + * Adds a single [FeedbackExperimentItem] to [Builder.feedback]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeedback(feedback: FeedbackExperimentItem) = apply { this.feedback = (this.feedback ?: JsonField.of(mutableListOf())).also { @@ -217,12 +246,22 @@ private constructor( /** A list of experiment feedback items */ fun feedback(feedback: List) = apply { body.feedback(feedback) } - /** A list of experiment feedback items */ + /** + * Sets [Builder.feedback] to an arbitrary JSON value. + * + * You should usually call [Builder.feedback] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun feedback(feedback: JsonField>) = apply { body.feedback(feedback) } - /** A list of experiment feedback items */ + /** + * Adds a single [FeedbackExperimentItem] to [Builder.feedback]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeedback(feedback: FeedbackExperimentItem) = apply { body.addFeedback(feedback) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchParams.kt index 53ca3670..0edbea15 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchParams.kt @@ -164,37 +164,13 @@ private constructor( fun limit(limit: Long?) = apply { this.limit = limit } /** - * limit the number of traces fetched + * Alias for [Builder.limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** @@ -211,18 +187,7 @@ private constructor( */ fun maxRootSpanId(maxRootSpanId: String?) = apply { this.maxRootSpanId = maxRootSpanId } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) @@ -240,18 +205,7 @@ private constructor( */ fun maxXactId(maxXactId: String?) = apply { this.maxXactId = maxXactId } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** @@ -262,12 +216,7 @@ private constructor( */ fun version(version: String?) = apply { this.version = version } - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchPostParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchPostParams.kt index b6cde61b..42a6bf11 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchPostParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentFetchPostParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -42,6 +43,9 @@ private constructor( * earliest. * * The string can be obtained directly from the `cursor` property of the previous fetch query + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun cursor(): Optional = body.cursor() @@ -58,6 +62,9 @@ private constructor( * * The `limit` parameter controls the number of full traces to return. So you may end up with * more individual rows than the specified limit if you are fetching events containing traces. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun limit(): Optional = body.limit() @@ -72,6 +79,9 @@ private constructor( * for the next page can be found as the row with the minimum (earliest) value of the tuple * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating * fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxRootSpanId(): Optional = body.maxRootSpanId() @@ -86,6 +96,9 @@ private constructor( * for the next page can be found as the row with the minimum (earliest) value of the tuple * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating * fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxXactId(): Optional = body.maxXactId() @@ -94,66 +107,44 @@ private constructor( * * The version id is essentially a filter on the latest event transaction id. You can use the * `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun version(): Optional = body.version() /** - * An opaque string to be used as a cursor for the next page of results, in order from latest to - * earliest. + * Returns the raw JSON value of [cursor]. * - * The string can be obtained directly from the `cursor` property of the previous fetch query + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ fun _cursor(): JsonField = body._cursor() /** - * limit the number of traces fetched + * Returns the raw JSON value of [limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later - * pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. - * This happens because pagination occurs over the whole version history of the event log. You - * will most likely want to exclude any such duplicate, outdated rows (by `id`) from your - * combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up with - * more individual rows than the specified limit if you are fetching events containing traces. + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. */ fun _limit(): JsonField = body._limit() /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the - * explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument - * going forwards. + * Returns the raw JSON value of [maxRootSpanId]. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the cursor - * for the next page can be found as the row with the minimum (earliest) value of the tuple - * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating - * fetch queries. + * Unlike [maxRootSpanId], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxRootSpanId(): JsonField = body._maxRootSpanId() /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the - * explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument - * going forwards. + * Returns the raw JSON value of [maxXactId]. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the cursor - * for the next page can be found as the row with the minimum (earliest) value of the tuple - * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating - * fetch queries. + * Unlike [maxXactId], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxXactId(): JsonField = body._maxXactId() /** - * Retrieve a snapshot of events from a past time + * Returns the raw JSON value of [version]. * - * The version id is essentially a filter on the latest event transaction id. You can use the - * `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. */ fun _version(): JsonField = body._version() @@ -205,6 +196,9 @@ private constructor( * * The string can be obtained directly from the `cursor` property of the previous fetch * query + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun cursor(): Optional = Optional.ofNullable(cursor.getNullable("cursor")) @@ -222,6 +216,9 @@ private constructor( * The `limit` parameter controls the number of full traces to return. So you may end up * with more individual rows than the specified limit if you are fetching events containing * traces. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun limit(): Optional = Optional.ofNullable(limit.getNullable("limit")) @@ -236,6 +233,9 @@ private constructor( * cursor for the next page can be found as the row with the minimum (earliest) value of the * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of * paginating fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxRootSpanId(): Optional = Optional.ofNullable(maxRootSpanId.getNullable("max_root_span_id")) @@ -251,6 +251,9 @@ private constructor( * cursor for the next page can be found as the row with the minimum (earliest) value of the * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of * paginating fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxXactId(): Optional = Optional.ofNullable(maxXactId.getNullable("max_xact_id")) @@ -260,70 +263,47 @@ private constructor( * * The version id is essentially a filter on the latest event transaction id. You can use * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Returns the raw JSON value of [cursor]. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField = cursor /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. + * Returns the raw JSON value of [limit]. * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Returns the raw JSON value of [maxRootSpanId]. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * Unlike [maxRootSpanId], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("max_root_span_id") @ExcludeMissing fun _maxRootSpanId(): JsonField = maxRootSpanId /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Returns the raw JSON value of [maxXactId]. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * Unlike [maxXactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("max_xact_id") @ExcludeMissing fun _maxXactId(): JsonField = maxXactId /** - * Retrieve a snapshot of events from a past time + * Returns the raw JSON value of [version]. * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -383,21 +363,15 @@ private constructor( */ fun cursor(cursor: String?) = cursor(JsonField.ofNullable(cursor)) - /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. - * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Sets [Builder.cursor] to an arbitrary JSON value. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * You should usually call [Builder.cursor] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun cursor(cursor: JsonField) = apply { this.cursor = cursor } @@ -419,53 +393,21 @@ private constructor( fun limit(limit: Long?) = limit(JsonField.ofNullable(limit)) /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. + * Alias for [Builder.limit]. * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** - * limit the number of traces fetched + * Sets [Builder.limit] to an arbitrary JSON value. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun limit(limit: JsonField) = apply { this.limit = limit } @@ -484,32 +426,16 @@ private constructor( fun maxRootSpanId(maxRootSpanId: String?) = maxRootSpanId(JsonField.ofNullable(maxRootSpanId)) - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. + * Sets [Builder.maxRootSpanId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. + * You should usually call [Builder.maxRootSpanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxRootSpanId(maxRootSpanId: JsonField) = apply { this.maxRootSpanId = maxRootSpanId @@ -529,31 +455,15 @@ private constructor( */ fun maxXactId(maxXactId: String?) = maxXactId(JsonField.ofNullable(maxXactId)) - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Sets [Builder.maxXactId] to an arbitrary JSON value. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. + * You should usually call [Builder.maxXactId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxXactId(maxXactId: JsonField) = apply { this.maxXactId = maxXactId } @@ -566,21 +476,15 @@ private constructor( */ fun version(version: String?) = version(JsonField.ofNullable(version)) - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can - * use the `max_xact_id` returned by a past fetch as the version to reproduce that exact - * fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) /** - * Retrieve a snapshot of events from a past time + * Sets [Builder.version] to an arbitrary JSON value. * - * The version id is essentially a filter on the latest event transaction id. You can - * use the `max_xact_id` returned by a past fetch as the version to reproduce that exact - * fetch. + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun version(version: JsonField) = apply { this.version = version } @@ -676,21 +580,14 @@ private constructor( */ fun cursor(cursor: String?) = apply { body.cursor(cursor) } - /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. - * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Sets [Builder.cursor] to an arbitrary JSON value. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * You should usually call [Builder.cursor] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun cursor(cursor: JsonField) = apply { body.cursor(cursor) } @@ -712,53 +609,20 @@ private constructor( fun limit(limit: Long?) = apply { body.limit(limit) } /** - * limit the number of traces fetched + * Alias for [Builder.limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** - * limit the number of traces fetched + * Sets [Builder.limit] to an arbitrary JSON value. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun limit(limit: JsonField) = apply { body.limit(limit) } @@ -776,32 +640,16 @@ private constructor( */ fun maxRootSpanId(maxRootSpanId: String?) = apply { body.maxRootSpanId(maxRootSpanId) } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. + * Sets [Builder.maxRootSpanId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * You should usually call [Builder.maxRootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun maxRootSpanId(maxRootSpanId: JsonField) = apply { body.maxRootSpanId(maxRootSpanId) @@ -821,31 +669,15 @@ private constructor( */ fun maxXactId(maxXactId: String?) = apply { body.maxXactId(maxXactId) } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. + * Sets [Builder.maxXactId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * You should usually call [Builder.maxXactId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun maxXactId(maxXactId: JsonField) = apply { body.maxXactId(maxXactId) } @@ -857,19 +689,14 @@ private constructor( */ fun version(version: String?) = apply { body.version(version) } - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) /** - * Retrieve a snapshot of events from a past time + * Sets [Builder.version] to an arbitrary JSON value. * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun version(version: JsonField) = apply { body.version(version) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentInsertParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentInsertParams.kt index e04423cf..52aad5c8 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentInsertParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentInsertParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,10 +33,19 @@ private constructor( /** Experiment id */ fun experimentId(): String = experimentId - /** A list of experiment events to insert */ + /** + * A list of experiment events to insert + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = body.events() - /** A list of experiment events to insert */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ fun _events(): JsonField> = body._events() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,10 +78,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of experiment events to insert */ + /** + * A list of experiment events to insert + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = events.getRequired("events") - /** A list of experiment events to insert */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events @@ -121,12 +140,22 @@ private constructor( /** A list of experiment events to insert */ fun events(events: List) = events(JsonField.of(events)) - /** A list of experiment events to insert */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun events(events: JsonField>) = apply { this.events = events.map { it.toMutableList() } } - /** A list of experiment events to insert */ + /** + * Adds a single [InsertExperimentEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: InsertExperimentEvent) = apply { events = (events ?: JsonField.of(mutableListOf())).also { @@ -216,10 +245,20 @@ private constructor( /** A list of experiment events to insert */ fun events(events: List) = apply { body.events(events) } - /** A list of experiment events to insert */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun events(events: JsonField>) = apply { body.events(events) } - /** A list of experiment events to insert */ + /** + * Adds a single [InsertExperimentEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: InsertExperimentEvent) = apply { body.addEvent(event) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentListParams.kt index 2b4b05c0..71db2f5c 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentListParams.kt @@ -147,19 +147,13 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** Name of the experiment to search for */ fun experimentName(experimentName: String?) = apply { this.experimentName = experimentName } - /** Name of the experiment to search for */ + /** Alias for calling [Builder.experimentName] with `experimentName.orElse(null)`. */ fun experimentName(experimentName: Optional) = experimentName(experimentName.getOrNull()) @@ -169,49 +163,44 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Project id */ fun projectId(projectId: String?) = apply { this.projectId = projectId } - /** Project id */ + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** @@ -223,13 +212,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentSummarizeParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentSummarizeParams.kt index c988c73a..d6df3b64 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentSummarizeParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentSummarizeParams.kt @@ -108,10 +108,8 @@ private constructor( } /** - * The experiment to compare against, if summarizing scores and metrics. If omitted, will - * fall back to the `base_exp_id` stored in the experiment metadata, and then to the most - * recent experiment run in the same project. Must pass `summarize_scores=true` for this id - * to be used + * Alias for calling [Builder.comparisonExperimentId] with + * `comparisonExperimentId.orElse(null)`. */ fun comparisonExperimentId(comparisonExperimentId: Optional) = comparisonExperimentId(comparisonExperimentId.getOrNull()) @@ -125,15 +123,13 @@ private constructor( } /** - * Whether to summarize the scores and metrics. If false (or omitted), only the metadata - * will be returned. + * Alias for [Builder.summarizeScores]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun summarizeScores(summarizeScores: Boolean) = summarizeScores(summarizeScores as Boolean?) - /** - * Whether to summarize the scores and metrics. If false (or omitted), only the metadata - * will be returned. - */ + /** Alias for calling [Builder.summarizeScores] with `summarizeScores.orElse(null)`. */ fun summarizeScores(summarizeScores: Optional) = summarizeScores(summarizeScores.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentUpdateParams.kt index 1f99550c..2b2b32af 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ExperimentUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,64 +38,126 @@ private constructor( /** Experiment id */ fun experimentId(): String = experimentId - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Id of default base experiment to compare against when viewing this experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun baseExpId(): Optional = body.baseExpId() - /** Identifier of the linked dataset, or null if the experiment is not linked to a dataset */ + /** + * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun datasetId(): Optional = body.datasetId() /** * Version number of the linked dataset the experiment was run against. This can be used to * reproduce the experiment after the dataset has been modified. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun datasetVersion(): Optional = body.datasetVersion() - /** Textual description of the experiment */ + /** + * Textual description of the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** User-controlled metadata about the experiment */ + /** + * User-controlled metadata about the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Name of the experiment. Within a project, experiment names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() /** * Whether or not the experiment is public. Public experiments can be viewed by anybody inside * or outside the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun public_(): Optional = body.public_() - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun repoInfo(): Optional = body.repoInfo() - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Returns the raw JSON value of [baseExpId]. + * + * Unlike [baseExpId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _baseExpId(): JsonField = body._baseExpId() - /** Identifier of the linked dataset, or null if the experiment is not linked to a dataset */ + /** + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _datasetId(): JsonField = body._datasetId() /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Returns the raw JSON value of [datasetVersion]. + * + * Unlike [datasetVersion], this method doesn't throw if the JSON field has an unexpected type. */ fun _datasetVersion(): JsonField = body._datasetVersion() - /** Textual description of the experiment */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** User-controlled metadata about the experiment */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody inside - * or outside the organization + * Returns the raw JSON value of [public_]. + * + * Unlike [public_], this method doesn't throw if the JSON field has an unexpected type. */ fun _public_(): JsonField = body._public_() - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ fun _repoInfo(): JsonField = body._repoInfo() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -148,75 +211,134 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Id of default base experiment to compare against when viewing this experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun baseExpId(): Optional = Optional.ofNullable(baseExpId.getNullable("base_exp_id")) /** * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun datasetId(): Optional = Optional.ofNullable(datasetId.getNullable("dataset_id")) /** * Version number of the linked dataset the experiment was run against. This can be used to * reproduce the experiment after the dataset has been modified. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun datasetVersion(): Optional = Optional.ofNullable(datasetVersion.getNullable("dataset_version")) - /** Textual description of the experiment */ + /** + * Textual description of the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** User-controlled metadata about the experiment */ + /** + * User-controlled metadata about the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Name of the experiment. Within a project, experiment names are unique + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** * Whether or not the experiment is public. Public experiments can be viewed by anybody * inside or outside the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun public_(): Optional = Optional.ofNullable(public_.getNullable("public")) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Metadata about the state of the repo when the experiment was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun repoInfo(): Optional = Optional.ofNullable(repoInfo.getNullable("repo_info")) - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Returns the raw JSON value of [baseExpId]. + * + * Unlike [baseExpId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("base_exp_id") @ExcludeMissing fun _baseExpId(): JsonField = baseExpId /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * Returns the raw JSON value of [datasetId]. + * + * Unlike [datasetId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField = datasetId /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Returns the raw JSON value of [datasetVersion]. + * + * Unlike [datasetVersion], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("dataset_version") @ExcludeMissing fun _datasetVersion(): JsonField = datasetVersion - /** Textual description of the experiment */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** User-controlled metadata about the experiment */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Returns the raw JSON value of [public_]. + * + * Unlike [public_], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("public") @ExcludeMissing fun _public_(): JsonField = public_ - /** Metadata about the state of the repo when the experiment was created */ + /** + * Returns the raw JSON value of [repoInfo]. + * + * Unlike [repoInfo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("repo_info") @ExcludeMissing fun _repoInfo(): JsonField = repoInfo @JsonAnyGetter @@ -278,10 +400,16 @@ private constructor( /** Id of default base experiment to compare against when viewing this experiment */ fun baseExpId(baseExpId: String?) = baseExpId(JsonField.ofNullable(baseExpId)) - /** Id of default base experiment to compare against when viewing this experiment */ + /** Alias for calling [Builder.baseExpId] with `baseExpId.orElse(null)`. */ fun baseExpId(baseExpId: Optional) = baseExpId(baseExpId.getOrNull()) - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Sets [Builder.baseExpId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExpId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun baseExpId(baseExpId: JsonField) = apply { this.baseExpId = baseExpId } /** @@ -290,15 +418,15 @@ private constructor( */ fun datasetId(datasetId: String?) = datasetId(JsonField.ofNullable(datasetId)) - /** - * Identifier of the linked dataset, or null if the experiment is not linked to a - * dataset - */ + /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */ fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull()) /** - * Identifier of the linked dataset, or null if the experiment is not linked to a - * dataset + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetId(datasetId: JsonField) = apply { this.datasetId = datasetId } @@ -309,16 +437,16 @@ private constructor( fun datasetVersion(datasetVersion: String?) = datasetVersion(JsonField.ofNullable(datasetVersion)) - /** - * Version number of the linked dataset the experiment was run against. This can be used - * to reproduce the experiment after the dataset has been modified. - */ + /** Alias for calling [Builder.datasetVersion] with `datasetVersion.orElse(null)`. */ fun datasetVersion(datasetVersion: Optional) = datasetVersion(datasetVersion.getOrNull()) /** - * Version number of the linked dataset the experiment was run against. This can be used - * to reproduce the experiment after the dataset has been modified. + * Sets [Builder.datasetVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetVersion(datasetVersion: JsonField) = apply { this.datasetVersion = datasetVersion @@ -327,10 +455,16 @@ private constructor( /** Textual description of the experiment */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the experiment */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the experiment */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -338,19 +472,31 @@ private constructor( /** User-controlled metadata about the experiment */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the experiment */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the experiment */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Name of the experiment. Within a project, experiment names are unique */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the experiment. Within a project, experiment names are unique */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -360,30 +506,37 @@ private constructor( fun public_(public_: Boolean?) = public_(JsonField.ofNullable(public_)) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Alias for [Builder.public_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun public_(public_: Boolean) = public_(public_ as Boolean?) - /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization - */ + /** Alias for calling [Builder.public_] with `public_.orElse(null)`. */ fun public_(public_: Optional) = public_(public_.getOrNull()) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Sets [Builder.public_] to an arbitrary JSON value. + * + * You should usually call [Builder.public_] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun public_(public_: JsonField) = apply { this.public_ = public_ } /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = repoInfo(JsonField.ofNullable(repoInfo)) - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun repoInfo(repoInfo: JsonField) = apply { this.repoInfo = repoInfo } fun additionalProperties(additionalProperties: Map) = apply { @@ -475,10 +628,16 @@ private constructor( /** Id of default base experiment to compare against when viewing this experiment */ fun baseExpId(baseExpId: String?) = apply { body.baseExpId(baseExpId) } - /** Id of default base experiment to compare against when viewing this experiment */ + /** Alias for calling [Builder.baseExpId] with `baseExpId.orElse(null)`. */ fun baseExpId(baseExpId: Optional) = baseExpId(baseExpId.getOrNull()) - /** Id of default base experiment to compare against when viewing this experiment */ + /** + * Sets [Builder.baseExpId] to an arbitrary JSON value. + * + * You should usually call [Builder.baseExpId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun baseExpId(baseExpId: JsonField) = apply { body.baseExpId(baseExpId) } /** @@ -486,13 +645,15 @@ private constructor( */ fun datasetId(datasetId: String?) = apply { body.datasetId(datasetId) } - /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset - */ + /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */ fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull()) /** - * Identifier of the linked dataset, or null if the experiment is not linked to a dataset + * Sets [Builder.datasetId] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun datasetId(datasetId: JsonField) = apply { body.datasetId(datasetId) } @@ -502,16 +663,16 @@ private constructor( */ fun datasetVersion(datasetVersion: String?) = apply { body.datasetVersion(datasetVersion) } - /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. - */ + /** Alias for calling [Builder.datasetVersion] with `datasetVersion.orElse(null)`. */ fun datasetVersion(datasetVersion: Optional) = datasetVersion(datasetVersion.getOrNull()) /** - * Version number of the linked dataset the experiment was run against. This can be used to - * reproduce the experiment after the dataset has been modified. + * Sets [Builder.datasetVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun datasetVersion(datasetVersion: JsonField) = apply { body.datasetVersion(datasetVersion) @@ -520,28 +681,45 @@ private constructor( /** Textual description of the experiment */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the experiment */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the experiment */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** User-controlled metadata about the experiment */ fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } - /** User-controlled metadata about the experiment */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the experiment */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** Name of the experiment. Within a project, experiment names are unique */ fun name(name: String?) = apply { body.name(name) } - /** Name of the experiment. Within a project, experiment names are unique */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the experiment. Within a project, experiment names are unique */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -551,30 +729,36 @@ private constructor( fun public_(public_: Boolean?) = apply { body.public_(public_) } /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Alias for [Builder.public_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun public_(public_: Boolean) = public_(public_ as Boolean?) - /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization - */ + /** Alias for calling [Builder.public_] with `public_.orElse(null)`. */ fun public_(public_: Optional) = public_(public_.getOrNull()) /** - * Whether or not the experiment is public. Public experiments can be viewed by anybody - * inside or outside the organization + * Sets [Builder.public_] to an arbitrary JSON value. + * + * You should usually call [Builder.public_] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun public_(public_: JsonField) = apply { body.public_(public_) } /** Metadata about the state of the repo when the experiment was created */ fun repoInfo(repoInfo: RepoInfo?) = apply { body.repoInfo(repoInfo) } - /** Metadata about the state of the repo when the experiment was created */ + /** Alias for calling [Builder.repoInfo] with `repoInfo.orElse(null)`. */ fun repoInfo(repoInfo: Optional) = repoInfo(repoInfo.getOrNull()) - /** Metadata about the state of the repo when the experiment was created */ + /** + * Sets [Builder.repoInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.repoInfo] with a well-typed [RepoInfo] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun repoInfo(repoInfo: JsonField) = apply { body.repoInfo(repoInfo) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackDatasetItem.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackDatasetItem.kt index 887cdc58..95b2eb66 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackDatasetItem.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackDatasetItem.kt @@ -44,45 +44,79 @@ private constructor( /** * The id of the dataset event to log feedback for. This is the row `id` returned by `POST * /v1/dataset/{dataset_id}/insert` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun id(): String = id.getRequired("id") - /** An optional comment string to log about the dataset event */ + /** + * An optional comment string to log about the dataset event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun comment(): Optional = Optional.ofNullable(comment.getNullable("comment")) /** * A dictionary with additional data about the feedback. If you have a `user_id`, you can log it * here and access it in the Braintrust UI. Note, this metadata does not correspond to the main * event itself, but rather the audit log attached to the event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * The source of the feedback. Must be one of "external" (default), "app", or "api" + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * The id of the dataset event to log feedback for. This is the row `id` returned by `POST - * /v1/dataset/{dataset_id}/insert` + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** An optional comment string to log about the dataset event */ + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can log it - * here and access it in the Braintrust UI. Note, this metadata does not correspond to the main - * event itself, but rather the audit log attached to the event. + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -146,18 +180,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** - * The id of the dataset event to log feedback for. This is the row `id` returned by `POST - * /v1/dataset/{dataset_id}/insert` + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } /** An optional comment string to log about the dataset event */ fun comment(comment: String?) = comment(JsonField.ofNullable(comment)) - /** An optional comment string to log about the dataset event */ + /** Alias for calling [Builder.comment] with `comment.orElse(null)`. */ fun comment(comment: Optional) = comment(comment.getOrNull()) - /** An optional comment string to log about the dataset event */ + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun comment(comment: JsonField) = apply { this.comment = comment } /** @@ -167,41 +208,54 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can - * log it here and access it in the Braintrust UI. Note, this metadata does not correspond - * to the main event itself, but rather the audit log attached to the event. - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can - * log it here and access it in the Braintrust UI. Note, this metadata does not correspond - * to the main event itself, but rather the audit log attached to the event. + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackExperimentItem.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackExperimentItem.kt index a30bbcd2..f0c2949a 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackExperimentItem.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackExperimentItem.kt @@ -48,10 +48,18 @@ private constructor( /** * The id of the experiment event to log feedback for. This is the row `id` returned by `POST * /v1/experiment/{experiment_id}/insert` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun id(): String = id.getRequired("id") - /** An optional comment string to log about the experiment event */ + /** + * An optional comment string to log about the experiment event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun comment(): Optional = Optional.ofNullable(comment.getNullable("comment")) /** @@ -64,47 +72,77 @@ private constructor( * A dictionary with additional data about the feedback. If you have a `user_id`, you can log it * here and access it in the Braintrust UI. Note, this metadata does not correspond to the main * event itself, but rather the audit log attached to the event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the * existing scores for the experiment event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * The source of the feedback. Must be one of "external" (default), "app", or "api" + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * The id of the experiment event to log feedback for. This is the row `id` returned by `POST - * /v1/experiment/{experiment_id}/insert` + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** An optional comment string to log about the experiment event */ + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can log it - * here and access it in the Braintrust UI. Note, this metadata does not correspond to the main - * event itself, but rather the audit log attached to the event. + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the - * existing scores for the experiment event + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -173,18 +211,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** - * The id of the experiment event to log feedback for. This is the row `id` returned by - * `POST /v1/experiment/{experiment_id}/insert` + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } /** An optional comment string to log about the experiment event */ fun comment(comment: String?) = comment(JsonField.ofNullable(comment)) - /** An optional comment string to log about the experiment event */ + /** Alias for calling [Builder.comment] with `comment.orElse(null)`. */ fun comment(comment: Optional) = comment(comment.getOrNull()) - /** An optional comment string to log about the experiment event */ + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun comment(comment: JsonField) = apply { this.comment = comment } /** @@ -200,17 +245,15 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can - * log it here and access it in the Braintrust UI. Note, this metadata does not correspond - * to the main event itself, but rather the audit log attached to the event. - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can - * log it here and access it in the Braintrust UI. Note, this metadata does not correspond - * to the main event itself, but rather the audit log attached to the event. + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } @@ -220,39 +263,53 @@ private constructor( */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** - * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into - * the existing scores for the experiment event - */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) /** - * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into - * the existing scores for the experiment event + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun scores(scores: JsonField) = apply { this.scores = scores } /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackProjectLogsItem.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackProjectLogsItem.kt index 14572b2f..5bc5746b 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackProjectLogsItem.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackProjectLogsItem.kt @@ -48,10 +48,18 @@ private constructor( /** * The id of the project logs event to log feedback for. This is the row `id` returned by `POST * /v1/project_logs/{project_id}/insert` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun id(): String = id.getRequired("id") - /** An optional comment string to log about the project logs event */ + /** + * An optional comment string to log about the project logs event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun comment(): Optional = Optional.ofNullable(comment.getNullable("comment")) /** @@ -64,47 +72,77 @@ private constructor( * A dictionary with additional data about the feedback. If you have a `user_id`, you can log it * here and access it in the Braintrust UI. Note, this metadata does not correspond to the main * event itself, but rather the audit log attached to the event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the * existing scores for the project logs event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * The source of the feedback. Must be one of "external" (default), "app", or "api" + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * The id of the project logs event to log feedback for. This is the row `id` returned by `POST - * /v1/project_logs/{project_id}/insert` + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** An optional comment string to log about the project logs event */ + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can log it - * here and access it in the Braintrust UI. Note, this metadata does not correspond to the main - * event itself, but rather the audit log attached to the event. + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the - * existing scores for the project logs event + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -173,18 +211,25 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** - * The id of the project logs event to log feedback for. This is the row `id` returned by - * `POST /v1/project_logs/{project_id}/insert` + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } /** An optional comment string to log about the project logs event */ fun comment(comment: String?) = comment(JsonField.ofNullable(comment)) - /** An optional comment string to log about the project logs event */ + /** Alias for calling [Builder.comment] with `comment.orElse(null)`. */ fun comment(comment: Optional) = comment(comment.getOrNull()) - /** An optional comment string to log about the project logs event */ + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun comment(comment: JsonField) = apply { this.comment = comment } /** @@ -200,17 +245,15 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can - * log it here and access it in the Braintrust UI. Note, this metadata does not correspond - * to the main event itself, but rather the audit log attached to the event. - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the feedback. If you have a `user_id`, you can - * log it here and access it in the Braintrust UI. Note, this metadata does not correspond - * to the main event itself, but rather the audit log attached to the event. + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } @@ -220,39 +263,53 @@ private constructor( */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** - * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into - * the existing scores for the project logs event - */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) /** - * A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into - * the existing scores for the project logs event + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun scores(scores: JsonField) = apply { this.scores = scores } /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ fun source(source: Source?) = source(JsonField.ofNullable(source)) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ fun source(source: Optional) = source(source.getOrNull()) - /** The source of the feedback. Must be one of "external" (default), "app", or "api" */ + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun source(source: JsonField) = apply { this.source = source } /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackResponseSchema.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackResponseSchema.kt index d4e37e96..c87c941a 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackResponseSchema.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FeedbackResponseSchema.kt @@ -28,8 +28,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status @JsonAnyGetter @@ -76,6 +85,12 @@ private constructor( fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchDatasetEventsResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchDatasetEventsResponse.kt index 93503c6a..4d0220c2 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchDatasetEventsResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchDatasetEventsResponse.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,7 +33,12 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of fetched events */ + /** + * A list of fetched events + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = events.getRequired("events") /** @@ -40,17 +46,23 @@ private constructor( * * Pass this string directly as the `cursor` param to your next fetch request to get the next * page of results. Not provided if the returned result set is empty. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun cursor(): Optional = Optional.ofNullable(cursor.getNullable("cursor")) - /** A list of fetched events */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events /** - * Pagination cursor + * Returns the raw JSON value of [cursor]. * - * Pass this string directly as the `cursor` param to your next fetch request to get the next - * page of results. Not provided if the returned result set is empty. + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField = cursor @@ -102,12 +114,22 @@ private constructor( /** A list of fetched events */ fun events(events: List) = events(JsonField.of(events)) - /** A list of fetched events */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun events(events: JsonField>) = apply { this.events = events.map { it.toMutableList() } } - /** A list of fetched events */ + /** + * Adds a single [DatasetEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: DatasetEvent) = apply { events = (events ?: JsonField.of(mutableListOf())).also { @@ -123,19 +145,14 @@ private constructor( */ fun cursor(cursor: String?) = cursor(JsonField.ofNullable(cursor)) - /** - * Pagination cursor - * - * Pass this string directly as the `cursor` param to your next fetch request to get the - * next page of results. Not provided if the returned result set is empty. - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * Pagination cursor + * Sets [Builder.cursor] to an arbitrary JSON value. * - * Pass this string directly as the `cursor` param to your next fetch request to get the - * next page of results. Not provided if the returned result set is empty. + * You should usually call [Builder.cursor] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun cursor(cursor: JsonField) = apply { this.cursor = cursor } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchExperimentEventsResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchExperimentEventsResponse.kt index 23656816..6bbddad4 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchExperimentEventsResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchExperimentEventsResponse.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,7 +33,12 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of fetched events */ + /** + * A list of fetched events + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = events.getRequired("events") /** @@ -40,17 +46,23 @@ private constructor( * * Pass this string directly as the `cursor` param to your next fetch request to get the next * page of results. Not provided if the returned result set is empty. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun cursor(): Optional = Optional.ofNullable(cursor.getNullable("cursor")) - /** A list of fetched events */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events /** - * Pagination cursor + * Returns the raw JSON value of [cursor]. * - * Pass this string directly as the `cursor` param to your next fetch request to get the next - * page of results. Not provided if the returned result set is empty. + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField = cursor @@ -103,12 +115,22 @@ private constructor( /** A list of fetched events */ fun events(events: List) = events(JsonField.of(events)) - /** A list of fetched events */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun events(events: JsonField>) = apply { this.events = events.map { it.toMutableList() } } - /** A list of fetched events */ + /** + * Adds a single [ExperimentEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: ExperimentEvent) = apply { events = (events ?: JsonField.of(mutableListOf())).also { @@ -124,19 +146,14 @@ private constructor( */ fun cursor(cursor: String?) = cursor(JsonField.ofNullable(cursor)) - /** - * Pagination cursor - * - * Pass this string directly as the `cursor` param to your next fetch request to get the - * next page of results. Not provided if the returned result set is empty. - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * Pagination cursor + * Sets [Builder.cursor] to an arbitrary JSON value. * - * Pass this string directly as the `cursor` param to your next fetch request to get the - * next page of results. Not provided if the returned result set is empty. + * You should usually call [Builder.cursor] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun cursor(cursor: JsonField) = apply { this.cursor = cursor } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchProjectLogsEventsResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchProjectLogsEventsResponse.kt index 1fd8d53c..ac15fc3d 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchProjectLogsEventsResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FetchProjectLogsEventsResponse.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,7 +33,12 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of fetched events */ + /** + * A list of fetched events + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = events.getRequired("events") /** @@ -40,19 +46,25 @@ private constructor( * * Pass this string directly as the `cursor` param to your next fetch request to get the next * page of results. Not provided if the returned result set is empty. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun cursor(): Optional = Optional.ofNullable(cursor.getNullable("cursor")) - /** A list of fetched events */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events /** - * Pagination cursor + * Returns the raw JSON value of [cursor]. * - * Pass this string directly as the `cursor` param to your next fetch request to get the next - * page of results. Not provided if the returned result set is empty. + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField = cursor @@ -106,12 +118,22 @@ private constructor( /** A list of fetched events */ fun events(events: List) = events(JsonField.of(events)) - /** A list of fetched events */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun events(events: JsonField>) = apply { this.events = events.map { it.toMutableList() } } - /** A list of fetched events */ + /** + * Adds a single [ProjectLogsEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: ProjectLogsEvent) = apply { events = (events ?: JsonField.of(mutableListOf())).also { @@ -127,19 +149,14 @@ private constructor( */ fun cursor(cursor: String?) = cursor(JsonField.ofNullable(cursor)) - /** - * Pagination cursor - * - * Pass this string directly as the `cursor` param to your next fetch request to get the - * next page of results. Not provided if the returned result set is empty. - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * Pagination cursor + * Sets [Builder.cursor] to an arbitrary JSON value. * - * Pass this string directly as the `cursor` param to your next fetch request to get the - * next page of results. Not provided if the returned result set is empty. + * You should usually call [Builder.cursor] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun cursor(cursor: JsonField) = apply { this.cursor = cursor } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Function.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Function.kt index e4656f96..64717439 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Function.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Function.kt @@ -77,114 +77,252 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") /** * The transaction id of an event is unique to the network operation that processed the event * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve * a versioned snapshot of the prompt (see the `version` parameter) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun _xactId(): String = _xactId.getRequired("_xact_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun functionData(): FunctionData = functionData.getRequired("function_data") - /** A literal 'p' which identifies the object as a project prompt */ + /** + * A literal 'p' which identifies the object as a project prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun logId(): LogId = logId.getRequired("log_id") - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the organization */ + /** + * Unique identifier for the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun orgId(): String = orgId.getRequired("org_id") - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") - /** Date of prompt creation */ + /** + * Date of prompt creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** JSON schema for the function's parameters and return type */ + /** + * JSON schema for the function's parameters and return type + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionSchema(): Optional = Optional.ofNullable(functionSchema.getNullable("function_schema")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionType(): Optional = Optional.ofNullable(functionType.getNullable("function_type")) - /** User-controlled metadata about the prompt */ + /** + * User-controlled metadata about the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The transaction id of an event is unique to the network operation that processed the event - * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve - * a versioned snapshot of the prompt (see the `version` parameter) + * Returns the raw JSON value of [_xactId]. + * + * Unlike [_xactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_xact_id") @ExcludeMissing fun __xactId(): JsonField = _xactId + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("function_data") @ExcludeMissing fun _functionData(): JsonField = functionData - /** A literal 'p' which identifies the object as a project prompt */ + /** + * Returns the raw JSON value of [logId]. + * + * Unlike [logId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("log_id") @ExcludeMissing fun _logId(): JsonField = logId - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the organization */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** Date of prompt creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** JSON schema for the function's parameters and return type */ + /** + * Returns the raw JSON value of [functionSchema]. + * + * Unlike [functionSchema], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("function_schema") @ExcludeMissing fun _functionSchema(): JsonField = functionSchema + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("function_type") @ExcludeMissing fun _functionType(): JsonField = functionType - /** User-controlled metadata about the prompt */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -284,7 +422,12 @@ private constructor( /** Unique identifier for the prompt */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** @@ -295,81 +438,136 @@ private constructor( fun _xactId(_xactId: String) = _xactId(JsonField.of(_xactId)) /** - * The transaction id of an event is unique to the network operation that processed the - * event insertion. Transaction ids are monotonically increasing over time and can be used - * to retrieve a versioned snapshot of the prompt (see the `version` parameter) + * Sets [Builder._xactId] to an arbitrary JSON value. + * + * You should usually call [Builder._xactId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun _xactId(_xactId: JsonField) = apply { this._xactId = _xactId } fun functionData(functionData: FunctionData) = functionData(JsonField.of(functionData)) + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { this.functionData = functionData } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = functionData(FunctionData.ofPrompt(prompt)) + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = functionData(FunctionData.ofCode(code)) + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = functionData(FunctionData.ofGlobal(global)) /** A literal 'p' which identifies the object as a project prompt */ fun logId(logId: LogId) = logId(JsonField.of(logId)) - /** A literal 'p' which identifies the object as a project prompt */ + /** + * Sets [Builder.logId] to an arbitrary JSON value. + * + * You should usually call [Builder.logId] with a well-typed [LogId] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun logId(logId: JsonField) = apply { this.logId = logId } /** Name of the prompt */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the organization */ fun orgId(orgId: String) = orgId(JsonField.of(orgId)) - /** Unique identifier for the organization */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Unique identifier for the prompt */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** Date of prompt creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of prompt creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of prompt creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** JSON schema for the function's parameters and return type */ fun functionSchema(functionSchema: FunctionSchema?) = functionSchema(JsonField.ofNullable(functionSchema)) - /** JSON schema for the function's parameters and return type */ + /** Alias for calling [Builder.functionSchema] with `functionSchema.orElse(null)`. */ fun functionSchema(functionSchema: Optional) = functionSchema(functionSchema.getOrNull()) - /** JSON schema for the function's parameters and return type */ + /** + * Sets [Builder.functionSchema] to an arbitrary JSON value. + * + * You should usually call [Builder.functionSchema] with a well-typed [FunctionSchema] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionSchema(functionSchema: JsonField) = apply { this.functionSchema = functionSchema } @@ -377,9 +575,17 @@ private constructor( fun functionType(functionType: FunctionType?) = functionType(JsonField.ofNullable(functionType)) + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { this.functionType = functionType } @@ -387,39 +593,68 @@ private constructor( /** User-controlled metadata about the prompt */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the prompt */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the prompt */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun origin(origin: Origin?) = origin(JsonField.ofNullable(origin)) + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [Origin] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -634,8 +869,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -682,6 +927,13 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -839,12 +1091,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun data(): Data = data.getRequired("data") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -895,14 +1167,30 @@ private constructor( fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } + /** Alias for calling [data] with `Data.ofBundle(bundle)`. */ fun data(bundle: Data.Bundle) = data(Data.ofBundle(bundle)) + /** Alias for calling [data] with `Data.ofInline(inline)`. */ fun data(inline: Data.Inline) = data(Data.ofInline(inline)) fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1095,36 +1383,90 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun bundleId(): String = bundleId.getRequired("bundle_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun location(): CodeBundle.Location = location.getRequired("location") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): CodeBundle.RuntimeContext = runtimeContext.getRequired("runtime_context") - /** A preview of the code */ + /** + * A preview of the code + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun preview(): Optional = Optional.ofNullable(preview.getNullable("preview")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [bundleId]. + * + * Unlike [bundleId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("bundle_id") @ExcludeMissing fun _bundleId(): JsonField = bundleId + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext - /** A preview of the code */ + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1195,6 +1537,13 @@ private constructor( fun bundleId(bundleId: String) = bundleId(JsonField.of(bundleId)) + /** + * Sets [Builder.bundleId] to an arbitrary JSON value. + * + * You should usually call [Builder.bundleId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun bundleId(bundleId: JsonField) = apply { this.bundleId = bundleId } @@ -1202,19 +1551,41 @@ private constructor( fun location(location: CodeBundle.Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed + * [CodeBundle.Location] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun location(location: JsonField) = apply { this.location = location } + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofExperiment(experiment)`. + */ fun location(experiment: CodeBundle.Location.Experiment) = location(CodeBundle.Location.ofExperiment(experiment)) + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofFunction(function)`. + */ fun location(function: CodeBundle.Location.Function) = location(CodeBundle.Location.ofFunction(function)) fun runtimeContext(runtimeContext: CodeBundle.RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [CodeBundle.RuntimeContext] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext @@ -1223,14 +1594,27 @@ private constructor( /** A preview of the code */ fun preview(preview: String?) = preview(JsonField.ofNullable(preview)) - /** A preview of the code */ + /** Alias for calling [Builder.preview] with `preview.orElse(null)`. */ fun preview(preview: Optional) = preview(preview.getOrNull()) - /** A preview of the code */ + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun preview(preview: JsonField) = apply { this.preview = preview } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1402,19 +1786,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun code(): String = code.getRequired("code") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): RuntimeContext = runtimeContext.getRequired("runtime_context") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1470,17 +1887,38 @@ private constructor( fun code(code: String) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun code(code: JsonField) = apply { this.code = code } fun runtimeContext(runtimeContext: RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [RuntimeContext] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1529,14 +1967,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -1592,12 +2052,26 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } @@ -2011,12 +2485,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2067,10 +2561,24 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2624,29 +3132,51 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Id of the object the function is originating from */ + /** + * Id of the object the function is originating from + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * The function exists for internal purposes and should not be displayed in the list of * functions. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun internal_(): Optional = Optional.ofNullable(internal_.getNullable("internal")) - /** Id of the object the function is originating from */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Returns the raw JSON value of [internal_]. + * + * Unlike [internal_], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("internal") @ExcludeMissing fun _internal_(): JsonField = internal_ @@ -2702,13 +3232,25 @@ private constructor( /** Id of the object the function is originating from */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** Id of the object the function is originating from */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -2720,20 +3262,21 @@ private constructor( fun internal_(internal_: Boolean?) = internal_(JsonField.ofNullable(internal_)) /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Alias for [Builder.internal_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun internal_(internal_: Boolean) = internal_(internal_ as Boolean?) - /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. - */ + /** Alias for calling [Builder.internal_] with `internal_.orElse(null)`. */ fun internal_(internal_: Optional) = internal_(internal_.getOrNull()) /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Sets [Builder.internal_] to an arbitrary JSON value. + * + * You should usually call [Builder.internal_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun internal_(internal_: JsonField) = apply { this.internal_ = internal_ } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionCreateParams.kt index 13824b46..e21eb0c2 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionCreateParams.kt @@ -45,58 +45,148 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun functionData(): FunctionData = body.functionData() - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = body.slug() - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** JSON schema for the function's parameters and return type */ + /** + * JSON schema for the function's parameters and return type + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionSchema(): Optional = body.functionSchema() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionType(): Optional = body.functionType() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = body.origin() - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = body.promptData() - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = body.tags() + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionData(): JsonField = body._functionData() - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ fun _slug(): JsonField = body._slug() - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** JSON schema for the function's parameters and return type */ + /** + * Returns the raw JSON value of [functionSchema]. + * + * Unlike [functionSchema], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionSchema(): JsonField = body._functionSchema() + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionType(): JsonField = body._functionType() + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ fun _origin(): JsonField = body._origin() - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _promptData(): JsonField = body._promptData() - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ fun _tags(): JsonField> = body._tags() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -149,72 +239,165 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun functionData(): FunctionData = functionData.getRequired("function_data") - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** JSON schema for the function's parameters and return type */ + /** + * JSON schema for the function's parameters and return type + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionSchema(): Optional = Optional.ofNullable(functionSchema.getNullable("function_schema")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionType(): Optional = Optional.ofNullable(functionType.getNullable("function_type")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_data") @ExcludeMissing fun _functionData(): JsonField = functionData - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** JSON schema for the function's parameters and return type */ + /** + * Returns the raw JSON value of [functionSchema]. + * + * Unlike [functionSchema], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_schema") @ExcludeMissing fun _functionSchema(): JsonField = functionSchema + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_type") @ExcludeMissing fun _functionType(): JsonField = functionType + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -291,43 +474,77 @@ private constructor( fun functionData(functionData: FunctionData) = functionData(JsonField.of(functionData)) + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { this.functionData = functionData } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = functionData(FunctionData.ofPrompt(prompt)) + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = functionData(FunctionData.ofCode(code)) + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = functionData(FunctionData.ofGlobal(global)) /** Name of the prompt */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Unique identifier for the prompt */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -336,11 +553,17 @@ private constructor( fun functionSchema(functionSchema: FunctionSchema?) = functionSchema(JsonField.ofNullable(functionSchema)) - /** JSON schema for the function's parameters and return type */ + /** Alias for calling [Builder.functionSchema] with `functionSchema.orElse(null)`. */ fun functionSchema(functionSchema: Optional) = functionSchema(functionSchema.getOrNull()) - /** JSON schema for the function's parameters and return type */ + /** + * Sets [Builder.functionSchema] to an arbitrary JSON value. + * + * You should usually call [Builder.functionSchema] with a well-typed [FunctionSchema] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun functionSchema(functionSchema: JsonField) = apply { this.functionSchema = functionSchema } @@ -348,26 +571,48 @@ private constructor( fun functionType(functionType: FunctionType?) = functionType(JsonField.ofNullable(functionType)) + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { this.functionType = functionType } fun origin(origin: Origin?) = origin(JsonField.ofNullable(origin)) + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [Origin] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } @@ -375,15 +620,25 @@ private constructor( /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } @@ -477,41 +732,73 @@ private constructor( fun functionData(functionData: FunctionData) = apply { body.functionData(functionData) } + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { body.functionData(functionData) } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = apply { body.functionData(prompt) } + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = apply { body.functionData(code) } + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = apply { body.functionData(global) } /** Name of the prompt */ fun name(name: String) = apply { body.name(name) } - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Unique identifier for the prompt */ fun slug(slug: String) = apply { body.slug(slug) } - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { body.slug(slug) } /** Textual description of the prompt */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** JSON schema for the function's parameters and return type */ @@ -519,49 +806,86 @@ private constructor( body.functionSchema(functionSchema) } - /** JSON schema for the function's parameters and return type */ + /** Alias for calling [Builder.functionSchema] with `functionSchema.orElse(null)`. */ fun functionSchema(functionSchema: Optional) = functionSchema(functionSchema.getOrNull()) - /** JSON schema for the function's parameters and return type */ + /** + * Sets [Builder.functionSchema] to an arbitrary JSON value. + * + * You should usually call [Builder.functionSchema] with a well-typed [FunctionSchema] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionSchema(functionSchema: JsonField) = apply { body.functionSchema(functionSchema) } fun functionType(functionType: FunctionType?) = apply { body.functionType(functionType) } + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { body.functionType(functionType) } fun origin(origin: Origin?) = apply { body.origin(origin) } + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [Origin] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun origin(origin: JsonField) = apply { body.origin(origin) } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = apply { body.promptData(promptData) } - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { body.promptData(promptData) } /** A list of tags for the prompt */ fun tags(tags: List?) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { body.addTag(tag) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -858,8 +1182,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -906,6 +1240,13 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1063,12 +1404,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun data(): Data = data.getRequired("data") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1119,14 +1480,30 @@ private constructor( fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } + /** Alias for calling [data] with `Data.ofBundle(bundle)`. */ fun data(bundle: Data.Bundle) = data(Data.ofBundle(bundle)) + /** Alias for calling [data] with `Data.ofInline(inline)`. */ fun data(inline: Data.Inline) = data(Data.ofInline(inline)) fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1319,36 +1696,90 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun bundleId(): String = bundleId.getRequired("bundle_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun location(): CodeBundle.Location = location.getRequired("location") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): CodeBundle.RuntimeContext = runtimeContext.getRequired("runtime_context") - /** A preview of the code */ + /** + * A preview of the code + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun preview(): Optional = Optional.ofNullable(preview.getNullable("preview")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [bundleId]. + * + * Unlike [bundleId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("bundle_id") @ExcludeMissing fun _bundleId(): JsonField = bundleId + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext - /** A preview of the code */ + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1419,6 +1850,13 @@ private constructor( fun bundleId(bundleId: String) = bundleId(JsonField.of(bundleId)) + /** + * Sets [Builder.bundleId] to an arbitrary JSON value. + * + * You should usually call [Builder.bundleId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun bundleId(bundleId: JsonField) = apply { this.bundleId = bundleId } @@ -1426,19 +1864,41 @@ private constructor( fun location(location: CodeBundle.Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed + * [CodeBundle.Location] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun location(location: JsonField) = apply { this.location = location } + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofExperiment(experiment)`. + */ fun location(experiment: CodeBundle.Location.Experiment) = location(CodeBundle.Location.ofExperiment(experiment)) + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofFunction(function)`. + */ fun location(function: CodeBundle.Location.Function) = location(CodeBundle.Location.ofFunction(function)) fun runtimeContext(runtimeContext: CodeBundle.RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [CodeBundle.RuntimeContext] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext @@ -1447,14 +1907,27 @@ private constructor( /** A preview of the code */ fun preview(preview: String?) = preview(JsonField.ofNullable(preview)) - /** A preview of the code */ + /** Alias for calling [Builder.preview] with `preview.orElse(null)`. */ fun preview(preview: Optional) = preview(preview.getOrNull()) - /** A preview of the code */ + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun preview(preview: JsonField) = apply { this.preview = preview } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1626,19 +2099,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun code(): String = code.getRequired("code") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): RuntimeContext = runtimeContext.getRequired("runtime_context") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1694,17 +2200,38 @@ private constructor( fun code(code: String) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun code(code: JsonField) = apply { this.code = code } fun runtimeContext(runtimeContext: RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [RuntimeContext] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1753,14 +2280,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -1816,12 +2365,26 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } @@ -2235,12 +2798,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2291,10 +2874,24 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2673,29 +3270,51 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Id of the object the function is originating from */ + /** + * Id of the object the function is originating from + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * The function exists for internal purposes and should not be displayed in the list of * functions. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun internal_(): Optional = Optional.ofNullable(internal_.getNullable("internal")) - /** Id of the object the function is originating from */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Returns the raw JSON value of [internal_]. + * + * Unlike [internal_], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("internal") @ExcludeMissing fun _internal_(): JsonField = internal_ @@ -2751,13 +3370,25 @@ private constructor( /** Id of the object the function is originating from */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** Id of the object the function is originating from */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -2769,20 +3400,21 @@ private constructor( fun internal_(internal_: Boolean?) = internal_(JsonField.ofNullable(internal_)) /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Alias for [Builder.internal_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun internal_(internal_: Boolean) = internal_(internal_ as Boolean?) - /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. - */ + /** Alias for calling [Builder.internal_] with `internal_.orElse(null)`. */ fun internal_(internal_: Optional) = internal_(internal_.getOrNull()) /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Sets [Builder.internal_] to an arbitrary JSON value. + * + * You should usually call [Builder.internal_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun internal_(internal_: JsonField) = apply { this.internal_ = internal_ } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt index 4cdd84ba..b9d63939 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt @@ -52,46 +52,95 @@ private constructor( /** Argument to the function, which can be any JSON serializable value */ fun _input(): JsonValue = body._input() - /** If the function is an LLM, additional messages to pass along to it */ + /** + * If the function is an LLM, additional messages to pass along to it + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun messages(): Optional> = body.messages() - /** Any relevant metadata */ + /** + * Any relevant metadata + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = body.metadata() - /** The mode format of the returned value (defaults to 'auto') */ + /** + * The mode format of the returned value (defaults to 'auto') + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun mode(): Optional = body.mode() - /** Options for tracing the function call */ + /** + * Options for tracing the function call + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun parent(): Optional = body.parent() /** * Whether to stream the response. If true, results will be returned in the Braintrust SSE * format. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun stream(): Optional = body.stream() - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun version(): Optional = body.version() - /** If the function is an LLM, additional messages to pass along to it */ + /** + * Returns the raw JSON value of [messages]. + * + * Unlike [messages], this method doesn't throw if the JSON field has an unexpected type. + */ fun _messages(): JsonField> = body._messages() - /** Any relevant metadata */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ fun _metadata(): JsonField = body._metadata() - /** The mode format of the returned value (defaults to 'auto') */ + /** + * Returns the raw JSON value of [mode]. + * + * Unlike [mode], this method doesn't throw if the JSON field has an unexpected type. + */ fun _mode(): JsonField = body._mode() - /** Options for tracing the function call */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ fun _parent(): JsonField = body._parent() /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE - * format. + * Returns the raw JSON value of [stream]. + * + * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type. */ fun _stream(): JsonField = body._stream() - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ fun _version(): JsonField = body._version() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -148,49 +197,98 @@ private constructor( /** Argument to the function, which can be any JSON serializable value */ @JsonProperty("input") @ExcludeMissing fun _input(): JsonValue = input - /** If the function is an LLM, additional messages to pass along to it */ + /** + * If the function is an LLM, additional messages to pass along to it + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun messages(): Optional> = Optional.ofNullable(messages.getNullable("messages")) - /** Any relevant metadata */ + /** + * Any relevant metadata + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** The mode format of the returned value (defaults to 'auto') */ + /** + * The mode format of the returned value (defaults to 'auto') + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun mode(): Optional = Optional.ofNullable(mode.getNullable("mode")) - /** Options for tracing the function call */ + /** + * Options for tracing the function call + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) /** * Whether to stream the response. If true, results will be returned in the Braintrust SSE * format. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun stream(): Optional = Optional.ofNullable(stream.getNullable("stream")) - /** The version of the function */ + /** + * The version of the function + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) - /** If the function is an LLM, additional messages to pass along to it */ + /** + * Returns the raw JSON value of [messages]. + * + * Unlike [messages], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("messages") @ExcludeMissing fun _messages(): JsonField> = messages - /** Any relevant metadata */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** The mode format of the returned value (defaults to 'auto') */ + /** + * Returns the raw JSON value of [mode]. + * + * Unlike [mode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonField = mode - /** Options for tracing the function call */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE - * format. + * Returns the raw JSON value of [stream]. + * + * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("stream") @ExcludeMissing fun _stream(): JsonField = stream - /** The version of the function */ + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @JsonAnyGetter @@ -256,12 +354,22 @@ private constructor( /** If the function is an LLM, additional messages to pass along to it */ fun messages(messages: List) = messages(JsonField.of(messages)) - /** If the function is an LLM, additional messages to pass along to it */ + /** + * Sets [Builder.messages] to an arbitrary JSON value. + * + * You should usually call [Builder.messages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun messages(messages: JsonField>) = apply { this.messages = messages.map { it.toMutableList() } } - /** If the function is an LLM, additional messages to pass along to it */ + /** + * Adds a single [Message] to [messages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMessage(message: Message) = apply { messages = (messages ?: JsonField.of(mutableListOf())).also { @@ -269,54 +377,72 @@ private constructor( } } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofSystem(system)`. */ fun addMessage(system: Message.System) = addMessage(Message.ofSystem(system)) - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofUser(user)`. */ fun addMessage(user: Message.User) = addMessage(Message.ofUser(user)) - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofAssistant(assistant)`. */ fun addMessage(assistant: Message.Assistant) = addMessage(Message.ofAssistant(assistant)) - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofTool(tool)`. */ fun addMessage(tool: Message.Tool) = addMessage(Message.ofTool(tool)) - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofFunction(function)`. */ fun addMessage(function: Message.Function) = addMessage(Message.ofFunction(function)) - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofFallback(fallback)`. */ fun addMessage(fallback: Message.Fallback) = addMessage(Message.ofFallback(fallback)) /** Any relevant metadata */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** Any relevant metadata */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** Any relevant metadata */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** The mode format of the returned value (defaults to 'auto') */ fun mode(mode: Mode?) = mode(JsonField.ofNullable(mode)) - /** The mode format of the returned value (defaults to 'auto') */ + /** Alias for calling [Builder.mode] with `mode.orElse(null)`. */ fun mode(mode: Optional) = mode(mode.getOrNull()) - /** The mode format of the returned value (defaults to 'auto') */ + /** + * Sets [Builder.mode] to an arbitrary JSON value. + * + * You should usually call [Builder.mode] with a well-typed [Mode] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun mode(mode: JsonField) = apply { this.mode = mode } /** Options for tracing the function call */ fun parent(parent: Parent) = parent(JsonField.of(parent)) - /** Options for tracing the function call */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } - /** Span parent properties */ + /** Alias for calling [parent] with `Parent.ofSpanParentStruct(spanParentStruct)`. */ fun parent(spanParentStruct: Parent.SpanParentStruct) = parent(Parent.ofSpanParentStruct(spanParentStruct)) - /** The parent's span identifier, created by calling `.export()` on a span */ + /** Alias for calling [parent] with `Parent.ofString(string)`. */ fun parent(string: String) = parent(Parent.ofString(string)) /** @@ -326,27 +452,34 @@ private constructor( fun stream(stream: Boolean?) = stream(JsonField.ofNullable(stream)) /** - * Whether to stream the response. If true, results will be returned in the Braintrust - * SSE format. + * Alias for [Builder.stream]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun stream(stream: Boolean) = stream(stream as Boolean?) - /** - * Whether to stream the response. If true, results will be returned in the Braintrust - * SSE format. - */ + /** Alias for calling [Builder.stream] with `stream.orElse(null)`. */ fun stream(stream: Optional) = stream(stream.getOrNull()) /** - * Whether to stream the response. If true, results will be returned in the Braintrust - * SSE format. + * Sets [Builder.stream] to an arbitrary JSON value. + * + * You should usually call [Builder.stream] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun stream(stream: JsonField) = apply { this.stream = stream } /** The version of the function */ fun version(version: String) = version(JsonField.of(version)) - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun version(version: JsonField) = apply { this.version = version } fun additionalProperties(additionalProperties: Map) = apply { @@ -444,60 +577,86 @@ private constructor( /** If the function is an LLM, additional messages to pass along to it */ fun messages(messages: List) = apply { body.messages(messages) } - /** If the function is an LLM, additional messages to pass along to it */ + /** + * Sets [Builder.messages] to an arbitrary JSON value. + * + * You should usually call [Builder.messages] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun messages(messages: JsonField>) = apply { body.messages(messages) } - /** If the function is an LLM, additional messages to pass along to it */ + /** + * Adds a single [Message] to [messages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMessage(message: Message) = apply { body.addMessage(message) } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofSystem(system)`. */ fun addMessage(system: Message.System) = apply { body.addMessage(system) } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofUser(user)`. */ fun addMessage(user: Message.User) = apply { body.addMessage(user) } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofAssistant(assistant)`. */ fun addMessage(assistant: Message.Assistant) = apply { body.addMessage(assistant) } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofTool(tool)`. */ fun addMessage(tool: Message.Tool) = apply { body.addMessage(tool) } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofFunction(function)`. */ fun addMessage(function: Message.Function) = apply { body.addMessage(function) } - /** If the function is an LLM, additional messages to pass along to it */ + /** Alias for calling [addMessage] with `Message.ofFallback(fallback)`. */ fun addMessage(fallback: Message.Fallback) = apply { body.addMessage(fallback) } /** Any relevant metadata */ fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } - /** Any relevant metadata */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** Any relevant metadata */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { body.metadata(metadata) } /** The mode format of the returned value (defaults to 'auto') */ fun mode(mode: Mode?) = apply { body.mode(mode) } - /** The mode format of the returned value (defaults to 'auto') */ + /** Alias for calling [Builder.mode] with `mode.orElse(null)`. */ fun mode(mode: Optional) = mode(mode.getOrNull()) - /** The mode format of the returned value (defaults to 'auto') */ + /** + * Sets [Builder.mode] to an arbitrary JSON value. + * + * You should usually call [Builder.mode] with a well-typed [Mode] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun mode(mode: JsonField) = apply { body.mode(mode) } /** Options for tracing the function call */ fun parent(parent: Parent) = apply { body.parent(parent) } - /** Options for tracing the function call */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun parent(parent: JsonField) = apply { body.parent(parent) } - /** Span parent properties */ + /** Alias for calling [parent] with `Parent.ofSpanParentStruct(spanParentStruct)`. */ fun parent(spanParentStruct: Parent.SpanParentStruct) = apply { body.parent(spanParentStruct) } - /** The parent's span identifier, created by calling `.export()` on a span */ + /** Alias for calling [parent] with `Parent.ofString(string)`. */ fun parent(string: String) = apply { body.parent(string) } /** @@ -507,27 +666,32 @@ private constructor( fun stream(stream: Boolean?) = apply { body.stream(stream) } /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE - * format. + * Alias for [Builder.stream]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun stream(stream: Boolean) = stream(stream as Boolean?) - /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE - * format. - */ + /** Alias for calling [Builder.stream] with `stream.orElse(null)`. */ fun stream(stream: Optional) = stream(stream.getOrNull()) /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE - * format. + * Sets [Builder.stream] to an arbitrary JSON value. + * + * You should usually call [Builder.stream] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun stream(stream: JsonField) = apply { body.stream(stream) } /** The version of the function */ fun version(version: String) = apply { body.version(version) } - /** The version of the function */ + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun version(version: JsonField) = apply { body.version(version) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -896,16 +1060,44 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -958,14 +1150,35 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -1131,16 +1344,44 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -1193,19 +1434,42 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: Content) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [Content] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } + /** Alias for calling [content] with `Content.ofText(text)`. */ fun content(text: String) = content(Content.ofText(text)) + /** Alias for calling [content] with `Content.ofArray(array)`. */ fun contentOfArray(array: List) = content(Content.ofArray(array)) fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -1673,28 +1937,76 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun functionCall(): Optional = Optional.ofNullable(functionCall.getNullable("function_call")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun toolCalls(): Optional> = Optional.ofNullable(toolCalls.getNullable("tool_calls")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [functionCall]. + * + * Unlike [functionCall], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_call") @ExcludeMissing fun _functionCall(): JsonField = functionCall + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [toolCalls]. + * + * Unlike [toolCalls], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("tool_calls") @ExcludeMissing fun _toolCalls(): JsonField> = toolCalls @@ -1755,40 +2067,84 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String?) = content(JsonField.ofNullable(content)) + /** Alias for calling [Builder.content] with `content.orElse(null)`. */ fun content(content: Optional) = content(content.getOrNull()) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun functionCall(functionCall: FunctionCall?) = functionCall(JsonField.ofNullable(functionCall)) + /** Alias for calling [Builder.functionCall] with `functionCall.orElse(null)`. */ fun functionCall(functionCall: Optional) = functionCall(functionCall.getOrNull()) + /** + * Sets [Builder.functionCall] to an arbitrary JSON value. + * + * You should usually call [Builder.functionCall] with a well-typed [FunctionCall] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun functionCall(functionCall: JsonField) = apply { this.functionCall = functionCall } fun name(name: String?) = name(JsonField.ofNullable(name)) + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun toolCalls(toolCalls: List?) = toolCalls(JsonField.ofNullable(toolCalls)) + /** Alias for calling [Builder.toolCalls] with `toolCalls.orElse(null)`. */ fun toolCalls(toolCalls: Optional>) = toolCalls(toolCalls.getOrNull()) + /** + * Sets [Builder.toolCalls] to an arbitrary JSON value. + * + * You should usually call [Builder.toolCalls] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun toolCalls(toolCalls: JsonField>) = apply { this.toolCalls = toolCalls.map { it.toMutableList() } } + /** + * Adds a single [ChatCompletionMessageToolCall] to [toolCalls]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addToolCall(toolCall: ChatCompletionMessageToolCall) = apply { toolCalls = (toolCalls ?: JsonField.of(mutableListOf())).also { @@ -1940,14 +2296,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun arguments(): String = arguments.getRequired("arguments") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * Returns the raw JSON value of [arguments]. + * + * Unlike [arguments], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("arguments") @ExcludeMissing fun _arguments(): JsonField = arguments + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -1998,12 +2376,26 @@ private constructor( fun arguments(arguments: String) = arguments(JsonField.of(arguments)) + /** + * Sets [Builder.arguments] to an arbitrary JSON value. + * + * You should usually call [Builder.arguments] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun arguments(arguments: JsonField) = apply { this.arguments = arguments } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -2089,17 +2481,46 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun toolCallId(): Optional = Optional.ofNullable(toolCallId.getNullable("tool_call_id")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [toolCallId]. + * + * Unlike [toolCallId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("tool_call_id") @ExcludeMissing fun _toolCallId(): JsonField = toolCallId @@ -2154,14 +2575,35 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun toolCallId(toolCallId: String) = toolCallId(JsonField.of(toolCallId)) + /** + * Sets [Builder.toolCallId] to an arbitrary JSON value. + * + * You should usually call [Builder.toolCallId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun toolCallId(toolCallId: JsonField) = apply { this.toolCallId = toolCallId } @@ -2329,16 +2771,45 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content @JsonAnyGetter @@ -2392,14 +2863,35 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun additionalProperties(additionalProperties: Map) = apply { @@ -2562,12 +3054,31 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content @JsonAnyGetter @@ -2617,12 +3128,27 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String?) = content(JsonField.ofNullable(content)) + /** Alias for calling [Builder.content] with `content.orElse(null)`. */ fun content(content: Optional) = content(content.getOrNull()) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun additionalProperties(additionalProperties: Map) = apply { @@ -3114,31 +3640,72 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the container object you are logging to */ + /** + * The id of the container object you are logging to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun objectId(): String = objectId.getRequired("object_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun objectType(): ObjectType = objectType.getRequired("object_type") - /** Include these properties in every span created under this parent */ + /** + * Include these properties in every span created under this parent + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun propagatedEvent(): Optional = Optional.ofNullable(propagatedEvent.getNullable("propagated_event")) - /** Identifiers for the row to to log a subspan under */ + /** + * Identifiers for the row to to log a subspan under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun rowIds(): Optional = Optional.ofNullable(rowIds.getNullable("row_ids")) - /** The id of the container object you are logging to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Include these properties in every span created under this parent */ + /** + * Returns the raw JSON value of [propagatedEvent]. + * + * Unlike [propagatedEvent], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("propagated_event") @ExcludeMissing fun _propagatedEvent(): JsonField = propagatedEvent - /** Identifiers for the row to to log a subspan under */ + /** + * Returns the raw JSON value of [rowIds]. + * + * Unlike [rowIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("row_ids") @ExcludeMissing fun _rowIds(): JsonField = rowIds @JsonAnyGetter @@ -3196,11 +3763,24 @@ private constructor( /** The id of the container object you are logging to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the container object you are logging to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -3209,11 +3789,19 @@ private constructor( fun propagatedEvent(propagatedEvent: PropagatedEvent?) = propagatedEvent(JsonField.ofNullable(propagatedEvent)) - /** Include these properties in every span created under this parent */ + /** + * Alias for calling [Builder.propagatedEvent] with `propagatedEvent.orElse(null)`. + */ fun propagatedEvent(propagatedEvent: Optional) = propagatedEvent(propagatedEvent.getOrNull()) - /** Include these properties in every span created under this parent */ + /** + * Sets [Builder.propagatedEvent] to an arbitrary JSON value. + * + * You should usually call [Builder.propagatedEvent] with a well-typed + * [PropagatedEvent] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun propagatedEvent(propagatedEvent: JsonField) = apply { this.propagatedEvent = propagatedEvent } @@ -3221,10 +3809,16 @@ private constructor( /** Identifiers for the row to to log a subspan under */ fun rowIds(rowIds: RowIds?) = rowIds(JsonField.ofNullable(rowIds)) - /** Identifiers for the row to to log a subspan under */ + /** Alias for calling [Builder.rowIds] with `rowIds.orElse(null)`. */ fun rowIds(rowIds: Optional) = rowIds(rowIds.getOrNull()) - /** Identifiers for the row to to log a subspan under */ + /** + * Sets [Builder.rowIds] to an arbitrary JSON value. + * + * You should usually call [Builder.rowIds] with a well-typed [RowIds] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun rowIds(rowIds: JsonField) = apply { this.rowIds = rowIds } fun additionalProperties(additionalProperties: Map) = apply { @@ -3475,24 +4069,56 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the row */ + /** + * The id of the row + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun id(): String = id.getRequired("id") - /** The root_span_id of the row */ + /** + * The root_span_id of the row + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun rootSpanId(): String = rootSpanId.getRequired("root_span_id") - /** The span_id of the row */ + /** + * The span_id of the row + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ fun spanId(): String = spanId.getRequired("span_id") - /** The id of the row */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The root_span_id of the row */ + /** + * Returns the raw JSON value of [rootSpanId]. + * + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId - /** The span_id of the row */ + /** + * Returns the raw JSON value of [spanId]. + * + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId @JsonAnyGetter @@ -3548,13 +4174,25 @@ private constructor( /** The id of the row */ fun id(id: String) = id(JsonField.of(id)) - /** The id of the row */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The root_span_id of the row */ fun rootSpanId(rootSpanId: String) = rootSpanId(JsonField.of(rootSpanId)) - /** The root_span_id of the row */ + /** + * Sets [Builder.rootSpanId] to an arbitrary JSON value. + * + * You should usually call [Builder.rootSpanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } @@ -3562,7 +4200,13 @@ private constructor( /** The span_id of the row */ fun spanId(spanId: String) = spanId(JsonField.of(spanId)) - /** The span_id of the row */ + /** + * Sets [Builder.spanId] to an arbitrary JSON value. + * + * You should usually call [Builder.spanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionListParams.kt index aaf2b9ca..454c33dd 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionListParams.kt @@ -166,19 +166,13 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** Name of the function to search for */ fun functionName(functionName: String?) = apply { this.functionName = functionName } - /** Name of the function to search for */ + /** Alias for calling [Builder.functionName] with `functionName.orElse(null)`. */ fun functionName(functionName: Optional) = functionName(functionName.getOrNull()) /** @@ -187,55 +181,50 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Project id */ fun projectId(projectId: String?) = apply { this.projectId = projectId } - /** Project id */ + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** Retrieve prompt with a specific slug */ fun slug(slug: String?) = apply { this.slug = slug } - /** Retrieve prompt with a specific slug */ + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ fun slug(slug: Optional) = slug(slug.getOrNull()) /** @@ -247,13 +236,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) @@ -265,12 +248,7 @@ private constructor( */ fun version(version: String?) = apply { this.version = version } - /** - * Retrieve prompt at a specific version. - * - * The version id can either be a transaction id (e.g. '1000192656880881099') or a version - * identifier (e.g. '81cd05ee665fdfb3'). - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionReplaceParams.kt index 65c621fc..43b976b6 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionReplaceParams.kt @@ -45,58 +45,148 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun functionData(): FunctionData = body.functionData() - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = body.slug() - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** JSON schema for the function's parameters and return type */ + /** + * JSON schema for the function's parameters and return type + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionSchema(): Optional = body.functionSchema() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionType(): Optional = body.functionType() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = body.origin() - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = body.promptData() - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = body.tags() + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionData(): JsonField = body._functionData() - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ fun _slug(): JsonField = body._slug() - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** JSON schema for the function's parameters and return type */ + /** + * Returns the raw JSON value of [functionSchema]. + * + * Unlike [functionSchema], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionSchema(): JsonField = body._functionSchema() + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionType(): JsonField = body._functionType() + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ fun _origin(): JsonField = body._origin() - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _promptData(): JsonField = body._promptData() - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ fun _tags(): JsonField> = body._tags() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -149,72 +239,165 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun functionData(): FunctionData = functionData.getRequired("function_data") - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** JSON schema for the function's parameters and return type */ + /** + * JSON schema for the function's parameters and return type + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionSchema(): Optional = Optional.ofNullable(functionSchema.getNullable("function_schema")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionType(): Optional = Optional.ofNullable(functionType.getNullable("function_type")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_data") @ExcludeMissing fun _functionData(): JsonField = functionData - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** JSON schema for the function's parameters and return type */ + /** + * Returns the raw JSON value of [functionSchema]. + * + * Unlike [functionSchema], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_schema") @ExcludeMissing fun _functionSchema(): JsonField = functionSchema + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_type") @ExcludeMissing fun _functionType(): JsonField = functionType + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -291,43 +474,77 @@ private constructor( fun functionData(functionData: FunctionData) = functionData(JsonField.of(functionData)) + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { this.functionData = functionData } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = functionData(FunctionData.ofPrompt(prompt)) + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = functionData(FunctionData.ofCode(code)) + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = functionData(FunctionData.ofGlobal(global)) /** Name of the prompt */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Unique identifier for the prompt */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -336,11 +553,17 @@ private constructor( fun functionSchema(functionSchema: FunctionSchema?) = functionSchema(JsonField.ofNullable(functionSchema)) - /** JSON schema for the function's parameters and return type */ + /** Alias for calling [Builder.functionSchema] with `functionSchema.orElse(null)`. */ fun functionSchema(functionSchema: Optional) = functionSchema(functionSchema.getOrNull()) - /** JSON schema for the function's parameters and return type */ + /** + * Sets [Builder.functionSchema] to an arbitrary JSON value. + * + * You should usually call [Builder.functionSchema] with a well-typed [FunctionSchema] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun functionSchema(functionSchema: JsonField) = apply { this.functionSchema = functionSchema } @@ -348,26 +571,48 @@ private constructor( fun functionType(functionType: FunctionType?) = functionType(JsonField.ofNullable(functionType)) + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { this.functionType = functionType } fun origin(origin: Origin?) = origin(JsonField.ofNullable(origin)) + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [Origin] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } @@ -375,15 +620,25 @@ private constructor( /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } @@ -477,41 +732,73 @@ private constructor( fun functionData(functionData: FunctionData) = apply { body.functionData(functionData) } + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { body.functionData(functionData) } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = apply { body.functionData(prompt) } + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = apply { body.functionData(code) } + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = apply { body.functionData(global) } /** Name of the prompt */ fun name(name: String) = apply { body.name(name) } - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Unique identifier for the prompt */ fun slug(slug: String) = apply { body.slug(slug) } - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { body.slug(slug) } /** Textual description of the prompt */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** JSON schema for the function's parameters and return type */ @@ -519,49 +806,86 @@ private constructor( body.functionSchema(functionSchema) } - /** JSON schema for the function's parameters and return type */ + /** Alias for calling [Builder.functionSchema] with `functionSchema.orElse(null)`. */ fun functionSchema(functionSchema: Optional) = functionSchema(functionSchema.getOrNull()) - /** JSON schema for the function's parameters and return type */ + /** + * Sets [Builder.functionSchema] to an arbitrary JSON value. + * + * You should usually call [Builder.functionSchema] with a well-typed [FunctionSchema] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionSchema(functionSchema: JsonField) = apply { body.functionSchema(functionSchema) } fun functionType(functionType: FunctionType?) = apply { body.functionType(functionType) } + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { body.functionType(functionType) } fun origin(origin: Origin?) = apply { body.origin(origin) } + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [Origin] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun origin(origin: JsonField) = apply { body.origin(origin) } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = apply { body.promptData(promptData) } - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { body.promptData(promptData) } /** A list of tags for the prompt */ fun tags(tags: List?) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { body.addTag(tag) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -858,8 +1182,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -906,6 +1240,13 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1063,12 +1404,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun data(): Data = data.getRequired("data") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1119,14 +1480,30 @@ private constructor( fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } + /** Alias for calling [data] with `Data.ofBundle(bundle)`. */ fun data(bundle: Data.Bundle) = data(Data.ofBundle(bundle)) + /** Alias for calling [data] with `Data.ofInline(inline)`. */ fun data(inline: Data.Inline) = data(Data.ofInline(inline)) fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1319,36 +1696,90 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun bundleId(): String = bundleId.getRequired("bundle_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun location(): CodeBundle.Location = location.getRequired("location") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): CodeBundle.RuntimeContext = runtimeContext.getRequired("runtime_context") - /** A preview of the code */ + /** + * A preview of the code + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun preview(): Optional = Optional.ofNullable(preview.getNullable("preview")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [bundleId]. + * + * Unlike [bundleId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("bundle_id") @ExcludeMissing fun _bundleId(): JsonField = bundleId + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext - /** A preview of the code */ + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1419,6 +1850,13 @@ private constructor( fun bundleId(bundleId: String) = bundleId(JsonField.of(bundleId)) + /** + * Sets [Builder.bundleId] to an arbitrary JSON value. + * + * You should usually call [Builder.bundleId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun bundleId(bundleId: JsonField) = apply { this.bundleId = bundleId } @@ -1426,19 +1864,41 @@ private constructor( fun location(location: CodeBundle.Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed + * [CodeBundle.Location] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun location(location: JsonField) = apply { this.location = location } + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofExperiment(experiment)`. + */ fun location(experiment: CodeBundle.Location.Experiment) = location(CodeBundle.Location.ofExperiment(experiment)) + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofFunction(function)`. + */ fun location(function: CodeBundle.Location.Function) = location(CodeBundle.Location.ofFunction(function)) fun runtimeContext(runtimeContext: CodeBundle.RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [CodeBundle.RuntimeContext] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext @@ -1447,14 +1907,27 @@ private constructor( /** A preview of the code */ fun preview(preview: String?) = preview(JsonField.ofNullable(preview)) - /** A preview of the code */ + /** Alias for calling [Builder.preview] with `preview.orElse(null)`. */ fun preview(preview: Optional) = preview(preview.getOrNull()) - /** A preview of the code */ + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun preview(preview: JsonField) = apply { this.preview = preview } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1626,19 +2099,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun code(): String = code.getRequired("code") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): RuntimeContext = runtimeContext.getRequired("runtime_context") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1694,17 +2200,38 @@ private constructor( fun code(code: String) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun code(code: JsonField) = apply { this.code = code } fun runtimeContext(runtimeContext: RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [RuntimeContext] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1753,14 +2280,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -1816,12 +2365,26 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } @@ -2235,12 +2798,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2291,10 +2874,24 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2673,29 +3270,51 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Id of the object the function is originating from */ + /** + * Id of the object the function is originating from + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") /** * The function exists for internal purposes and should not be displayed in the list of * functions. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun internal_(): Optional = Optional.ofNullable(internal_.getNullable("internal")) - /** Id of the object the function is originating from */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Returns the raw JSON value of [internal_]. + * + * Unlike [internal_], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("internal") @ExcludeMissing fun _internal_(): JsonField = internal_ @@ -2751,13 +3370,25 @@ private constructor( /** Id of the object the function is originating from */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** Id of the object the function is originating from */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -2769,20 +3400,21 @@ private constructor( fun internal_(internal_: Boolean?) = internal_(JsonField.ofNullable(internal_)) /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Alias for [Builder.internal_]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun internal_(internal_: Boolean) = internal_(internal_ as Boolean?) - /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. - */ + /** Alias for calling [Builder.internal_] with `internal_.orElse(null)`. */ fun internal_(internal_: Optional) = internal_(internal_.getOrNull()) /** - * The function exists for internal purposes and should not be displayed in the list of - * functions. + * Sets [Builder.internal_] to an arbitrary JSON value. + * + * You should usually call [Builder.internal_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun internal_(internal_: JsonField) = apply { this.internal_ = internal_ } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionUpdateParams.kt index 41527b6b..977f2552 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/FunctionUpdateParams.kt @@ -50,32 +50,77 @@ private constructor( /** Function id */ fun functionId(): String = functionId - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionData(): Optional = body.functionData() - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = body.promptData() - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = body.tags() - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionData(): JsonField = body._functionData() - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _promptData(): JsonField = body._promptData() - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ fun _tags(): JsonField> = body._tags() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -120,41 +165,87 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionData(): Optional = Optional.ofNullable(functionData.getNullable("function_data")) - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [functionData]. + * + * Unlike [functionData], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_data") @ExcludeMissing fun _functionData(): JsonField = functionData - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -207,10 +298,16 @@ private constructor( /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -218,37 +315,60 @@ private constructor( fun functionData(functionData: FunctionData?) = functionData(JsonField.ofNullable(functionData)) + /** Alias for calling [Builder.functionData] with `functionData.orElse(null)`. */ fun functionData(functionData: Optional) = functionData(functionData.getOrNull()) + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { this.functionData = functionData } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = functionData(FunctionData.ofPrompt(prompt)) + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = functionData(FunctionData.ofCode(code)) + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = functionData(FunctionData.ofGlobal(global)) /** Name of the prompt */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the prompt */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } @@ -256,15 +376,25 @@ private constructor( /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } @@ -356,55 +486,93 @@ private constructor( /** Textual description of the prompt */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun functionData(functionData: FunctionData?) = apply { body.functionData(functionData) } + /** Alias for calling [Builder.functionData] with `functionData.orElse(null)`. */ fun functionData(functionData: Optional) = functionData(functionData.getOrNull()) + /** + * Sets [Builder.functionData] to an arbitrary JSON value. + * + * You should usually call [Builder.functionData] with a well-typed [FunctionData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionData(functionData: JsonField) = apply { body.functionData(functionData) } + /** Alias for calling [functionData] with `FunctionData.ofPrompt(prompt)`. */ fun functionData(prompt: FunctionData.Prompt) = apply { body.functionData(prompt) } + /** Alias for calling [functionData] with `FunctionData.ofCode(code)`. */ fun functionData(code: FunctionData.Code) = apply { body.functionData(code) } + /** Alias for calling [functionData] with `FunctionData.ofGlobal(global)`. */ fun functionData(global: FunctionData.Global) = apply { body.functionData(global) } /** Name of the prompt */ fun name(name: String?) = apply { body.name(name) } - /** Name of the prompt */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = apply { body.promptData(promptData) } - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { body.promptData(promptData) } /** A list of tags for the prompt */ fun tags(tags: List?) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { body.addTag(tag) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -702,8 +870,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -750,6 +928,13 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -907,12 +1092,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun data(): Data = data.getRequired("data") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -963,14 +1168,30 @@ private constructor( fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } + /** Alias for calling [data] with `Data.ofBundle(bundle)`. */ fun data(bundle: Data.Bundle) = data(Data.ofBundle(bundle)) + /** Alias for calling [data] with `Data.ofInline(inline)`. */ fun data(inline: Data.Inline) = data(Data.ofInline(inline)) fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1163,36 +1384,90 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun bundleId(): String = bundleId.getRequired("bundle_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun location(): CodeBundle.Location = location.getRequired("location") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): CodeBundle.RuntimeContext = runtimeContext.getRequired("runtime_context") - /** A preview of the code */ + /** + * A preview of the code + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun preview(): Optional = Optional.ofNullable(preview.getNullable("preview")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [bundleId]. + * + * Unlike [bundleId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("bundle_id") @ExcludeMissing fun _bundleId(): JsonField = bundleId + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext - /** A preview of the code */ + /** + * Returns the raw JSON value of [preview]. + * + * Unlike [preview], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1263,6 +1538,13 @@ private constructor( fun bundleId(bundleId: String) = bundleId(JsonField.of(bundleId)) + /** + * Sets [Builder.bundleId] to an arbitrary JSON value. + * + * You should usually call [Builder.bundleId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun bundleId(bundleId: JsonField) = apply { this.bundleId = bundleId } @@ -1270,19 +1552,41 @@ private constructor( fun location(location: CodeBundle.Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed + * [CodeBundle.Location] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun location(location: JsonField) = apply { this.location = location } + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofExperiment(experiment)`. + */ fun location(experiment: CodeBundle.Location.Experiment) = location(CodeBundle.Location.ofExperiment(experiment)) + /** + * Alias for calling [location] with + * `CodeBundle.Location.ofFunction(function)`. + */ fun location(function: CodeBundle.Location.Function) = location(CodeBundle.Location.ofFunction(function)) fun runtimeContext(runtimeContext: CodeBundle.RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [CodeBundle.RuntimeContext] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext @@ -1291,14 +1595,27 @@ private constructor( /** A preview of the code */ fun preview(preview: String?) = preview(JsonField.ofNullable(preview)) - /** A preview of the code */ + /** Alias for calling [Builder.preview] with `preview.orElse(null)`. */ fun preview(preview: Optional) = preview(preview.getOrNull()) - /** A preview of the code */ + /** + * Sets [Builder.preview] to an arbitrary JSON value. + * + * You should usually call [Builder.preview] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun preview(preview: JsonField) = apply { this.preview = preview } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1470,19 +1787,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun code(): String = code.getRequired("code") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun runtimeContext(): RuntimeContext = runtimeContext.getRequired("runtime_context") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Returns the raw JSON value of [runtimeContext]. + * + * Unlike [runtimeContext], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime_context") @ExcludeMissing fun _runtimeContext(): JsonField = runtimeContext + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1538,17 +1888,38 @@ private constructor( fun code(code: String) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun code(code: JsonField) = apply { this.code = code } fun runtimeContext(runtimeContext: RuntimeContext) = runtimeContext(JsonField.of(runtimeContext)) + /** + * Sets [Builder.runtimeContext] to an arbitrary JSON value. + * + * You should usually call [Builder.runtimeContext] with a well-typed + * [RuntimeContext] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun runtimeContext(runtimeContext: JsonField) = apply { this.runtimeContext = runtimeContext } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1597,14 +1968,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun runtime(): Runtime = runtime.getRequired("runtime") + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun version(): String = version.getRequired("version") + /** + * Returns the raw JSON value of [runtime]. + * + * Unlike [runtime], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("runtime") @ExcludeMissing fun _runtime(): JsonField = runtime + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -1660,12 +2053,26 @@ private constructor( fun runtime(runtime: Runtime) = runtime(JsonField.of(runtime)) + /** + * Sets [Builder.runtime] to an arbitrary JSON value. + * + * You should usually call [Builder.runtime] with a well-typed [Runtime] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun runtime(runtime: JsonField) = apply { this.runtime = runtime } fun version(version: String) = version(JsonField.of(version)) + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun version(version: JsonField) = apply { this.version = version } @@ -2079,12 +2486,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2135,10 +2562,24 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Group.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Group.kt index 2dc72265..02e1c660 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Group.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Group.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -53,27 +54,55 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the group */ + /** + * Unique identifier for the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") /** * Unique id for the organization that the group belongs under * * It is forbidden to change the org after creating a group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun orgId(): String = orgId.getRequired("org_id") - /** Date of group creation */ + /** + * Date of group creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date of group deletion, or null if the group is still active */ + /** + * Date of group deletion, or null if the group is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) @@ -82,57 +111,97 @@ private constructor( * * An inheriting group has all the users contained in its member groups, as well as all of their * inherited users + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun memberGroups(): Optional> = Optional.ofNullable(memberGroups.getNullable("member_groups")) - /** Ids of users which belong to this group */ + /** + * Ids of users which belong to this group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun memberUsers(): Optional> = Optional.ofNullable(memberUsers.getNullable("member_users")) - /** Identifies the user who created the group */ + /** + * Identifies the user who created the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the group */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Unique id for the organization that the group belongs under + * Returns the raw JSON value of [orgId]. * - * It is forbidden to change the org after creating a group + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Date of group creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date of group deletion, or null if the group is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Ids of the groups this group inherits from + * Returns the raw JSON value of [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of their - * inherited users + * Unlike [memberGroups], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("member_groups") @ExcludeMissing fun _memberGroups(): JsonField> = memberGroups - /** Ids of users which belong to this group */ + /** + * Returns the raw JSON value of [memberUsers]. + * + * Unlike [memberUsers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("member_users") @ExcludeMissing fun _memberUsers(): JsonField> = memberUsers - /** Identifies the user who created the group */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -206,13 +275,23 @@ private constructor( /** Unique identifier for the group */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the group */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the group */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -223,37 +302,56 @@ private constructor( fun orgId(orgId: String) = orgId(JsonField.of(orgId)) /** - * Unique id for the organization that the group belongs under + * Sets [Builder.orgId] to an arbitrary JSON value. * - * It is forbidden to change the org after creating a group + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Date of group creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of group creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of group creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date of group deletion, or null if the group is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of group deletion, or null if the group is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of group deletion, or null if the group is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } /** Textual description of the group */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** @@ -265,30 +363,25 @@ private constructor( fun memberGroups(memberGroups: List?) = memberGroups(JsonField.ofNullable(memberGroups)) - /** - * Ids of the groups this group inherits from - * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users - */ + /** Alias for calling [Builder.memberGroups] with `memberGroups.orElse(null)`. */ fun memberGroups(memberGroups: Optional>) = memberGroups(memberGroups.getOrNull()) /** - * Ids of the groups this group inherits from + * Sets [Builder.memberGroups] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * You should usually call [Builder.memberGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberGroups(memberGroups: JsonField>) = apply { this.memberGroups = memberGroups.map { it.toMutableList() } } /** - * Ids of the groups this group inherits from + * Adds a single [String] to [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberGroup(memberGroup: String) = apply { memberGroups = @@ -300,15 +393,25 @@ private constructor( /** Ids of users which belong to this group */ fun memberUsers(memberUsers: List?) = memberUsers(JsonField.ofNullable(memberUsers)) - /** Ids of users which belong to this group */ + /** Alias for calling [Builder.memberUsers] with `memberUsers.orElse(null)`. */ fun memberUsers(memberUsers: Optional>) = memberUsers(memberUsers.getOrNull()) - /** Ids of users which belong to this group */ + /** + * Sets [Builder.memberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.memberUsers] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberUsers(memberUsers: JsonField>) = apply { this.memberUsers = memberUsers.map { it.toMutableList() } } - /** Ids of users which belong to this group */ + /** + * Adds a single [String] to [memberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberUser(memberUser: String) = apply { memberUsers = (memberUsers ?: JsonField.of(mutableListOf())).also { @@ -319,10 +422,15 @@ private constructor( /** Identifies the user who created the group */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the group */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the group */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupCreateParams.kt index 492a36c7..3494b349 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupCreateParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,10 +34,20 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() /** @@ -44,40 +55,62 @@ private constructor( * * An inheriting group has all the users contained in its member groups, as well as all of their * inherited users + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun memberGroups(): Optional> = body.memberGroups() - /** Ids of users which belong to this group */ + /** + * Ids of users which belong to this group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun memberUsers(): Optional> = body.memberUsers() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * group belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() /** - * Ids of the groups this group inherits from + * Returns the raw JSON value of [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of their - * inherited users + * Unlike [memberGroups], this method doesn't throw if the JSON field has an unexpected type. */ fun _memberGroups(): JsonField> = body._memberGroups() - /** Ids of users which belong to this group */ + /** + * Returns the raw JSON value of [memberUsers]. + * + * Unlike [memberUsers], this method doesn't throw if the JSON field has an unexpected type. + */ fun _memberUsers(): JsonField> = body._memberUsers() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * group belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -116,10 +149,20 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) @@ -128,11 +171,19 @@ private constructor( * * An inheriting group has all the users contained in its member groups, as well as all of * their inherited users + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun memberGroups(): Optional> = Optional.ofNullable(memberGroups.getNullable("member_groups")) - /** Ids of users which belong to this group */ + /** + * Ids of users which belong to this group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun memberUsers(): Optional> = Optional.ofNullable(memberUsers.getNullable("member_users")) @@ -140,36 +191,51 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the group belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Ids of the groups this group inherits from + * Returns the raw JSON value of [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * Unlike [memberGroups], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("member_groups") @ExcludeMissing fun _memberGroups(): JsonField> = memberGroups - /** Ids of users which belong to this group */ + /** + * Returns the raw JSON value of [memberUsers]. + * + * Unlike [memberUsers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("member_users") @ExcludeMissing fun _memberUsers(): JsonField> = memberUsers /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -230,16 +296,28 @@ private constructor( /** Name of the group */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Textual description of the group */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -253,30 +331,25 @@ private constructor( fun memberGroups(memberGroups: List?) = memberGroups(JsonField.ofNullable(memberGroups)) - /** - * Ids of the groups this group inherits from - * - * An inheriting group has all the users contained in its member groups, as well as all - * of their inherited users - */ + /** Alias for calling [Builder.memberGroups] with `memberGroups.orElse(null)`. */ fun memberGroups(memberGroups: Optional>) = memberGroups(memberGroups.getOrNull()) /** - * Ids of the groups this group inherits from + * Sets [Builder.memberGroups] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all - * of their inherited users + * You should usually call [Builder.memberGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberGroups(memberGroups: JsonField>) = apply { this.memberGroups = memberGroups.map { it.toMutableList() } } /** - * Ids of the groups this group inherits from + * Adds a single [String] to [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all - * of their inherited users + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberGroup(memberGroup: String) = apply { memberGroups = @@ -289,16 +362,26 @@ private constructor( fun memberUsers(memberUsers: List?) = memberUsers(JsonField.ofNullable(memberUsers)) - /** Ids of users which belong to this group */ + /** Alias for calling [Builder.memberUsers] with `memberUsers.orElse(null)`. */ fun memberUsers(memberUsers: Optional>) = memberUsers(memberUsers.getOrNull()) - /** Ids of users which belong to this group */ + /** + * Sets [Builder.memberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.memberUsers] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberUsers(memberUsers: JsonField>) = apply { this.memberUsers = memberUsers.map { it.toMutableList() } } - /** Ids of users which belong to this group */ + /** + * Adds a single [String] to [memberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberUser(memberUser: String) = apply { memberUsers = (memberUsers ?: JsonField.of(mutableListOf())).also { @@ -313,17 +396,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -408,25 +489,28 @@ private constructor( /** Name of the group */ fun name(name: String) = apply { body.name(name) } - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Textual description of the group */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ - fun description(description: JsonField) = apply { body.description(description) } - /** - * Ids of the groups this group inherits from + * Sets [Builder.description] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun memberGroups(memberGroups: List?) = apply { body.memberGroups(memberGroups) } + fun description(description: JsonField) = apply { body.description(description) } /** * Ids of the groups this group inherits from @@ -434,39 +518,52 @@ private constructor( * An inheriting group has all the users contained in its member groups, as well as all of * their inherited users */ + fun memberGroups(memberGroups: List?) = apply { body.memberGroups(memberGroups) } + + /** Alias for calling [Builder.memberGroups] with `memberGroups.orElse(null)`. */ fun memberGroups(memberGroups: Optional>) = memberGroups(memberGroups.getOrNull()) /** - * Ids of the groups this group inherits from + * Sets [Builder.memberGroups] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * You should usually call [Builder.memberGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberGroups(memberGroups: JsonField>) = apply { body.memberGroups(memberGroups) } /** - * Ids of the groups this group inherits from + * Adds a single [String] to [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberGroup(memberGroup: String) = apply { body.addMemberGroup(memberGroup) } /** Ids of users which belong to this group */ fun memberUsers(memberUsers: List?) = apply { body.memberUsers(memberUsers) } - /** Ids of users which belong to this group */ + /** Alias for calling [Builder.memberUsers] with `memberUsers.orElse(null)`. */ fun memberUsers(memberUsers: Optional>) = memberUsers(memberUsers.getOrNull()) - /** Ids of users which belong to this group */ + /** + * Sets [Builder.memberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.memberUsers] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberUsers(memberUsers: JsonField>) = apply { body.memberUsers(memberUsers) } - /** Ids of users which belong to this group */ + /** + * Adds a single [String] to [memberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberUser(memberUser: String) = apply { body.addMemberUser(memberUser) } /** @@ -476,17 +573,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupListParams.kt index d63abcd7..810d7b33 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupListParams.kt @@ -133,19 +133,13 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** Name of the group to search for */ fun groupName(groupName: String?) = apply { this.groupName = groupName } - /** Name of the group to search for */ + /** Alias for calling [Builder.groupName] with `groupName.orElse(null)`. */ fun groupName(groupName: Optional) = groupName(groupName.getOrNull()) /** @@ -154,37 +148,32 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** @@ -196,13 +185,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupReplaceParams.kt index add7d123..9a52d7dc 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupReplaceParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,10 +34,20 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() /** @@ -44,40 +55,62 @@ private constructor( * * An inheriting group has all the users contained in its member groups, as well as all of their * inherited users + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun memberGroups(): Optional> = body.memberGroups() - /** Ids of users which belong to this group */ + /** + * Ids of users which belong to this group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun memberUsers(): Optional> = body.memberUsers() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * group belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() /** - * Ids of the groups this group inherits from + * Returns the raw JSON value of [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of their - * inherited users + * Unlike [memberGroups], this method doesn't throw if the JSON field has an unexpected type. */ fun _memberGroups(): JsonField> = body._memberGroups() - /** Ids of users which belong to this group */ + /** + * Returns the raw JSON value of [memberUsers]. + * + * Unlike [memberUsers], this method doesn't throw if the JSON field has an unexpected type. + */ fun _memberUsers(): JsonField> = body._memberUsers() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * group belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -116,10 +149,20 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) @@ -128,11 +171,19 @@ private constructor( * * An inheriting group has all the users contained in its member groups, as well as all of * their inherited users + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun memberGroups(): Optional> = Optional.ofNullable(memberGroups.getNullable("member_groups")) - /** Ids of users which belong to this group */ + /** + * Ids of users which belong to this group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun memberUsers(): Optional> = Optional.ofNullable(memberUsers.getNullable("member_users")) @@ -140,36 +191,51 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the group belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Ids of the groups this group inherits from + * Returns the raw JSON value of [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * Unlike [memberGroups], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("member_groups") @ExcludeMissing fun _memberGroups(): JsonField> = memberGroups - /** Ids of users which belong to this group */ + /** + * Returns the raw JSON value of [memberUsers]. + * + * Unlike [memberUsers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("member_users") @ExcludeMissing fun _memberUsers(): JsonField> = memberUsers /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -230,16 +296,28 @@ private constructor( /** Name of the group */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Textual description of the group */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -253,30 +331,25 @@ private constructor( fun memberGroups(memberGroups: List?) = memberGroups(JsonField.ofNullable(memberGroups)) - /** - * Ids of the groups this group inherits from - * - * An inheriting group has all the users contained in its member groups, as well as all - * of their inherited users - */ + /** Alias for calling [Builder.memberGroups] with `memberGroups.orElse(null)`. */ fun memberGroups(memberGroups: Optional>) = memberGroups(memberGroups.getOrNull()) /** - * Ids of the groups this group inherits from + * Sets [Builder.memberGroups] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all - * of their inherited users + * You should usually call [Builder.memberGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberGroups(memberGroups: JsonField>) = apply { this.memberGroups = memberGroups.map { it.toMutableList() } } /** - * Ids of the groups this group inherits from + * Adds a single [String] to [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all - * of their inherited users + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberGroup(memberGroup: String) = apply { memberGroups = @@ -289,16 +362,26 @@ private constructor( fun memberUsers(memberUsers: List?) = memberUsers(JsonField.ofNullable(memberUsers)) - /** Ids of users which belong to this group */ + /** Alias for calling [Builder.memberUsers] with `memberUsers.orElse(null)`. */ fun memberUsers(memberUsers: Optional>) = memberUsers(memberUsers.getOrNull()) - /** Ids of users which belong to this group */ + /** + * Sets [Builder.memberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.memberUsers] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberUsers(memberUsers: JsonField>) = apply { this.memberUsers = memberUsers.map { it.toMutableList() } } - /** Ids of users which belong to this group */ + /** + * Adds a single [String] to [memberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberUser(memberUser: String) = apply { memberUsers = (memberUsers ?: JsonField.of(mutableListOf())).also { @@ -313,17 +396,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -408,25 +489,28 @@ private constructor( /** Name of the group */ fun name(name: String) = apply { body.name(name) } - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Textual description of the group */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ - fun description(description: JsonField) = apply { body.description(description) } - /** - * Ids of the groups this group inherits from + * Sets [Builder.description] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun memberGroups(memberGroups: List?) = apply { body.memberGroups(memberGroups) } + fun description(description: JsonField) = apply { body.description(description) } /** * Ids of the groups this group inherits from @@ -434,39 +518,52 @@ private constructor( * An inheriting group has all the users contained in its member groups, as well as all of * their inherited users */ + fun memberGroups(memberGroups: List?) = apply { body.memberGroups(memberGroups) } + + /** Alias for calling [Builder.memberGroups] with `memberGroups.orElse(null)`. */ fun memberGroups(memberGroups: Optional>) = memberGroups(memberGroups.getOrNull()) /** - * Ids of the groups this group inherits from + * Sets [Builder.memberGroups] to an arbitrary JSON value. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * You should usually call [Builder.memberGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberGroups(memberGroups: JsonField>) = apply { body.memberGroups(memberGroups) } /** - * Ids of the groups this group inherits from + * Adds a single [String] to [memberGroups]. * - * An inheriting group has all the users contained in its member groups, as well as all of - * their inherited users + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberGroup(memberGroup: String) = apply { body.addMemberGroup(memberGroup) } /** Ids of users which belong to this group */ fun memberUsers(memberUsers: List?) = apply { body.memberUsers(memberUsers) } - /** Ids of users which belong to this group */ + /** Alias for calling [Builder.memberUsers] with `memberUsers.orElse(null)`. */ fun memberUsers(memberUsers: Optional>) = memberUsers(memberUsers.getOrNull()) - /** Ids of users which belong to this group */ + /** + * Sets [Builder.memberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.memberUsers] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun memberUsers(memberUsers: JsonField>) = apply { body.memberUsers(memberUsers) } - /** Ids of users which belong to this group */ + /** + * Adds a single [String] to [memberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberUser(memberUser: String) = apply { body.addMemberUser(memberUser) } /** @@ -476,17 +573,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the group belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupUpdateParams.kt index 5945b26a..55465b89 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/GroupUpdateParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -38,40 +39,96 @@ private constructor( /** Group id */ fun groupId(): String = groupId - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * A list of group IDs to add to the group's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun addMemberGroups(): Optional> = body.addMemberGroups() - /** A list of user IDs to add to the group */ + /** + * A list of user IDs to add to the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun addMemberUsers(): Optional> = body.addMemberUsers() - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * A list of group IDs to remove from the group's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun removeMemberGroups(): Optional> = body.removeMemberGroups() - /** A list of user IDs to remove from the group */ + /** + * A list of user IDs to remove from the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun removeMemberUsers(): Optional> = body.removeMemberUsers() - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * Returns the raw JSON value of [addMemberGroups]. + * + * Unlike [addMemberGroups], this method doesn't throw if the JSON field has an unexpected type. + */ fun _addMemberGroups(): JsonField> = body._addMemberGroups() - /** A list of user IDs to add to the group */ + /** + * Returns the raw JSON value of [addMemberUsers]. + * + * Unlike [addMemberUsers], this method doesn't throw if the JSON field has an unexpected type. + */ fun _addMemberUsers(): JsonField> = body._addMemberUsers() - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Returns the raw JSON value of [removeMemberGroups]. + * + * Unlike [removeMemberGroups], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _removeMemberGroups(): JsonField> = body._removeMemberGroups() - /** A list of user IDs to remove from the group */ + /** + * Returns the raw JSON value of [removeMemberUsers]. + * + * Unlike [removeMemberUsers], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _removeMemberUsers(): JsonField> = body._removeMemberUsers() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -119,53 +176,111 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * A list of group IDs to add to the group's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun addMemberGroups(): Optional> = Optional.ofNullable(addMemberGroups.getNullable("add_member_groups")) - /** A list of user IDs to add to the group */ + /** + * A list of user IDs to add to the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun addMemberUsers(): Optional> = Optional.ofNullable(addMemberUsers.getNullable("add_member_users")) - /** Textual description of the group */ + /** + * Textual description of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the group */ + /** + * Name of the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * A list of group IDs to remove from the group's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun removeMemberGroups(): Optional> = Optional.ofNullable(removeMemberGroups.getNullable("remove_member_groups")) - /** A list of user IDs to remove from the group */ + /** + * A list of user IDs to remove from the group + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun removeMemberUsers(): Optional> = Optional.ofNullable(removeMemberUsers.getNullable("remove_member_users")) - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * Returns the raw JSON value of [addMemberGroups]. + * + * Unlike [addMemberGroups], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("add_member_groups") @ExcludeMissing fun _addMemberGroups(): JsonField> = addMemberGroups - /** A list of user IDs to add to the group */ + /** + * Returns the raw JSON value of [addMemberUsers]. + * + * Unlike [addMemberUsers], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("add_member_users") @ExcludeMissing fun _addMemberUsers(): JsonField> = addMemberUsers - /** Textual description of the group */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** Name of the group */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Returns the raw JSON value of [removeMemberGroups]. + * + * Unlike [removeMemberGroups], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("remove_member_groups") @ExcludeMissing fun _removeMemberGroups(): JsonField> = removeMemberGroups - /** A list of user IDs to remove from the group */ + /** + * Returns the raw JSON value of [removeMemberUsers]. + * + * Unlike [removeMemberUsers], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("remove_member_users") @ExcludeMissing fun _removeMemberUsers(): JsonField> = removeMemberUsers @@ -224,16 +339,26 @@ private constructor( fun addMemberGroups(addMemberGroups: List?) = addMemberGroups(JsonField.ofNullable(addMemberGroups)) - /** A list of group IDs to add to the group's inheriting-from set */ + /** Alias for calling [Builder.addMemberGroups] with `addMemberGroups.orElse(null)`. */ fun addMemberGroups(addMemberGroups: Optional>) = addMemberGroups(addMemberGroups.getOrNull()) - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * Sets [Builder.addMemberGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberGroups] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun addMemberGroups(addMemberGroups: JsonField>) = apply { this.addMemberGroups = addMemberGroups.map { it.toMutableList() } } - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * Adds a single [String] to [addMemberGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberGroup(addMemberGroup: String) = apply { addMemberGroups = (addMemberGroups ?: JsonField.of(mutableListOf())).also { @@ -245,16 +370,26 @@ private constructor( fun addMemberUsers(addMemberUsers: List?) = addMemberUsers(JsonField.ofNullable(addMemberUsers)) - /** A list of user IDs to add to the group */ + /** Alias for calling [Builder.addMemberUsers] with `addMemberUsers.orElse(null)`. */ fun addMemberUsers(addMemberUsers: Optional>) = addMemberUsers(addMemberUsers.getOrNull()) - /** A list of user IDs to add to the group */ + /** + * Sets [Builder.addMemberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberUsers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun addMemberUsers(addMemberUsers: JsonField>) = apply { this.addMemberUsers = addMemberUsers.map { it.toMutableList() } } - /** A list of user IDs to add to the group */ + /** + * Adds a single [String] to [addMemberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberUser(addMemberUser: String) = apply { addMemberUsers = (addMemberUsers ?: JsonField.of(mutableListOf())).also { @@ -265,10 +400,16 @@ private constructor( /** Textual description of the group */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -276,26 +417,45 @@ private constructor( /** Name of the group */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the group */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** A list of group IDs to remove from the group's inheriting-from set */ fun removeMemberGroups(removeMemberGroups: List?) = removeMemberGroups(JsonField.ofNullable(removeMemberGroups)) - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Alias for calling [Builder.removeMemberGroups] with + * `removeMemberGroups.orElse(null)`. + */ fun removeMemberGroups(removeMemberGroups: Optional>) = removeMemberGroups(removeMemberGroups.getOrNull()) - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Sets [Builder.removeMemberGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberGroups] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun removeMemberGroups(removeMemberGroups: JsonField>) = apply { this.removeMemberGroups = removeMemberGroups.map { it.toMutableList() } } - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Adds a single [String] to [removeMemberGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberGroup(removeMemberGroup: String) = apply { removeMemberGroups = (removeMemberGroups ?: JsonField.of(mutableListOf())).also { @@ -307,16 +467,28 @@ private constructor( fun removeMemberUsers(removeMemberUsers: List?) = removeMemberUsers(JsonField.ofNullable(removeMemberUsers)) - /** A list of user IDs to remove from the group */ + /** + * Alias for calling [Builder.removeMemberUsers] with `removeMemberUsers.orElse(null)`. + */ fun removeMemberUsers(removeMemberUsers: Optional>) = removeMemberUsers(removeMemberUsers.getOrNull()) - /** A list of user IDs to remove from the group */ + /** + * Sets [Builder.removeMemberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberUsers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun removeMemberUsers(removeMemberUsers: JsonField>) = apply { this.removeMemberUsers = removeMemberUsers.map { it.toMutableList() } } - /** A list of user IDs to remove from the group */ + /** + * Adds a single [String] to [removeMemberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberUser(removeMemberUser: String) = apply { removeMemberUsers = (removeMemberUsers ?: JsonField.of(mutableListOf())).also { @@ -413,16 +585,26 @@ private constructor( body.addMemberGroups(addMemberGroups) } - /** A list of group IDs to add to the group's inheriting-from set */ + /** Alias for calling [Builder.addMemberGroups] with `addMemberGroups.orElse(null)`. */ fun addMemberGroups(addMemberGroups: Optional>) = addMemberGroups(addMemberGroups.getOrNull()) - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * Sets [Builder.addMemberGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberGroups] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun addMemberGroups(addMemberGroups: JsonField>) = apply { body.addMemberGroups(addMemberGroups) } - /** A list of group IDs to add to the group's inheriting-from set */ + /** + * Adds a single [String] to [addMemberGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberGroup(addMemberGroup: String) = apply { body.addAddMemberGroup(addMemberGroup) } @@ -432,34 +614,55 @@ private constructor( body.addMemberUsers(addMemberUsers) } - /** A list of user IDs to add to the group */ + /** Alias for calling [Builder.addMemberUsers] with `addMemberUsers.orElse(null)`. */ fun addMemberUsers(addMemberUsers: Optional>) = addMemberUsers(addMemberUsers.getOrNull()) - /** A list of user IDs to add to the group */ + /** + * Sets [Builder.addMemberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberUsers] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun addMemberUsers(addMemberUsers: JsonField>) = apply { body.addMemberUsers(addMemberUsers) } - /** A list of user IDs to add to the group */ + /** + * Adds a single [String] to [addMemberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberUser(addMemberUser: String) = apply { body.addAddMemberUser(addMemberUser) } /** Textual description of the group */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the group */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the group */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** Name of the group */ fun name(name: String?) = apply { body.name(name) } - /** Name of the group */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the group */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** A list of group IDs to remove from the group's inheriting-from set */ @@ -467,16 +670,28 @@ private constructor( body.removeMemberGroups(removeMemberGroups) } - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Alias for calling [Builder.removeMemberGroups] with `removeMemberGroups.orElse(null)`. + */ fun removeMemberGroups(removeMemberGroups: Optional>) = removeMemberGroups(removeMemberGroups.getOrNull()) - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Sets [Builder.removeMemberGroups] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberGroups] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun removeMemberGroups(removeMemberGroups: JsonField>) = apply { body.removeMemberGroups(removeMemberGroups) } - /** A list of group IDs to remove from the group's inheriting-from set */ + /** + * Adds a single [String] to [removeMemberGroups]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberGroup(removeMemberGroup: String) = apply { body.addRemoveMemberGroup(removeMemberGroup) } @@ -486,16 +701,26 @@ private constructor( body.removeMemberUsers(removeMemberUsers) } - /** A list of user IDs to remove from the group */ + /** Alias for calling [Builder.removeMemberUsers] with `removeMemberUsers.orElse(null)`. */ fun removeMemberUsers(removeMemberUsers: Optional>) = removeMemberUsers(removeMemberUsers.getOrNull()) - /** A list of user IDs to remove from the group */ + /** + * Sets [Builder.removeMemberUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberUsers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun removeMemberUsers(removeMemberUsers: JsonField>) = apply { body.removeMemberUsers(removeMemberUsers) } - /** A list of user IDs to remove from the group */ + /** + * Adds a single [String] to [removeMemberUsers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberUser(removeMemberUser: String) = apply { body.addRemoveMemberUser(removeMemberUser) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertDatasetEvent.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertDatasetEvent.kt index 95ab2268..a85c0c55 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertDatasetEvent.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertDatasetEvent.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -66,6 +67,9 @@ private constructor( /** * A unique identifier for the dataset event. If you don't provide one, BrainTrust will generate * one for you + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -80,6 +84,9 @@ private constructor( * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _isMerge(): Optional = Optional.ofNullable(_isMerge.getNullable("_is_merge")) @@ -95,6 +102,9 @@ private constructor( * 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the * merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and * `input.c`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _mergePaths(): Optional>> = Optional.ofNullable(_mergePaths.getNullable("_merge_paths")) @@ -102,6 +112,9 @@ private constructor( /** * Pass `_object_delete=true` to mark the dataset event deleted. Deleted events will not show up * in subsequent fetches for this dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _objectDelete(): Optional = Optional.ofNullable(_objectDelete.getNullable("_object_delete")) @@ -123,10 +136,18 @@ private constructor( * case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _parentId(): Optional = Optional.ofNullable(_parentId.getNullable("_parent_id")) - /** The timestamp the dataset event was created */ + /** + * The timestamp the dataset event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) /** @@ -144,10 +165,18 @@ private constructor( * example, you could log the `prompt`, example's `id`, or anything else that would be useful to * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys * must be strings + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** Indicates the event was copied from another object. */ + /** + * Indicates the event was copied from another object. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) /** @@ -165,6 +194,9 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun rootSpanId(): Optional = Optional.ofNullable(rootSpanId.getNullable("root_span_id")) @@ -183,6 +215,9 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanId(): Optional = Optional.ofNullable(spanId.getNullable("span_id")) @@ -201,150 +236,109 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanParents(): Optional> = Optional.ofNullable(spanParents.getNullable("span_parents")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * A unique identifier for the dataset event. If you don't provide one, BrainTrust will generate - * one for you + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The `_is_merge` field controls how the row is merged with any existing row with the same id - * in the DB. By default (or when set to `false`), the existing row is completely replaced by - * the new row. When set to `true`, the new row is deep-merged into the existing row, if one is - * found. If no existing row is found, the new row is inserted as is. + * Returns the raw JSON value of [_isMerge]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * Unlike [_isMerge], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_is_merge") @ExcludeMissing fun __isMerge(): JsonField = _isMerge /** - * The `_merge_paths` field allows controlling the depth of the merge, when `_is_merge=true`. - * `_merge_paths` is a list of paths, where each path is a list of field names. The deep merge - * will not descend below any of the specified merge paths. + * Returns the raw JSON value of [_mergePaths]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": 10}, - * "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": true, - * "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, - * "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": {"a": {"q": - * 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the - * merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and - * `input.c`. + * Unlike [_mergePaths], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_merge_paths") @ExcludeMissing fun __mergePaths(): JsonField>> = _mergePaths /** - * Pass `_object_delete=true` to mark the dataset event deleted. Deleted events will not show up - * in subsequent fetches for this dataset + * Returns the raw JSON value of [_objectDelete]. + * + * Unlike [_objectDelete], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_object_delete") @ExcludeMissing fun __objectDelete(): JsonField = _objectDelete /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. + * Returns the raw JSON value of [_parentId]. * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). - * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent - * row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after - * foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row - * `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this - * case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [_parentId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_parent_id") @ExcludeMissing fun __parentId(): JsonField = _parentId - /** The timestamp the dataset event was created */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. For - * example, you could log the `prompt`, example's `id`, or anything else that would be useful to - * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys - * must be strings + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** Indicates the event was copied from another object. */ + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. + * Returns the raw JSON value of [rootSpanId]. * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. + * Returns the raw JSON value of [spanId]. * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. + * Returns the raw JSON value of [spanParents]. * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [spanParents], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_parents") @ExcludeMissing fun _spanParents(): JsonField> = spanParents - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -425,15 +419,14 @@ private constructor( */ fun id(id: String?) = id(JsonField.ofNullable(id)) - /** - * A unique identifier for the dataset event. If you don't provide one, BrainTrust will - * generate one for you - */ + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) /** - * A unique identifier for the dataset event. If you don't provide one, BrainTrust will - * generate one for you + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } @@ -452,44 +445,21 @@ private constructor( fun _isMerge(_isMerge: Boolean?) = _isMerge(JsonField.ofNullable(_isMerge)) /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. + * Alias for [Builder._isMerge]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * This unboxed primitive overload exists for backwards compatibility. */ fun _isMerge(_isMerge: Boolean) = _isMerge(_isMerge as Boolean?) - /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. - * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` - */ + /** Alias for calling [Builder._isMerge] with `_isMerge.orElse(null)`. */ fun _isMerge(_isMerge: Optional) = _isMerge(_isMerge.getOrNull()) /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. + * Sets [Builder._isMerge] to an arbitrary JSON value. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * You should usually call [Builder._isMerge] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun _isMerge(_isMerge: JsonField) = apply { this._isMerge = _isMerge } @@ -509,51 +479,25 @@ private constructor( fun _mergePaths(_mergePaths: List>?) = _mergePaths(JsonField.ofNullable(_mergePaths)) - /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. - * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. - */ + /** Alias for calling [Builder._mergePaths] with `_mergePaths.orElse(null)`. */ fun _mergePaths(_mergePaths: Optional>>) = _mergePaths(_mergePaths.getOrNull()) /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. + * Sets [Builder._mergePaths] to an arbitrary JSON value. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. + * You should usually call [Builder._mergePaths] with a well-typed `List>` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun _mergePaths(_mergePaths: JsonField>>) = apply { this._mergePaths = _mergePaths.map { it.toMutableList() } } /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. + * Adds a single [List] to [_mergePaths]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMergePath(mergePath: List) = apply { _mergePaths = @@ -570,21 +514,22 @@ private constructor( _objectDelete(JsonField.ofNullable(_objectDelete)) /** - * Pass `_object_delete=true` to mark the dataset event deleted. Deleted events will not - * show up in subsequent fetches for this dataset + * Alias for [Builder._objectDelete]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun _objectDelete(_objectDelete: Boolean) = _objectDelete(_objectDelete as Boolean?) - /** - * Pass `_object_delete=true` to mark the dataset event deleted. Deleted events will not - * show up in subsequent fetches for this dataset - */ + /** Alias for calling [Builder._objectDelete] with `_objectDelete.orElse(null)`. */ fun _objectDelete(_objectDelete: Optional) = _objectDelete(_objectDelete.getOrNull()) /** - * Pass `_object_delete=true` to mark the dataset event deleted. Deleted events will not - * show up in subsequent fetches for this dataset + * Sets [Builder._objectDelete] to an arbitrary JSON value. + * + * You should usually call [Builder._objectDelete] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun _objectDelete(_objectDelete: JsonField) = apply { this._objectDelete = _objectDelete @@ -610,53 +555,31 @@ private constructor( */ fun _parentId(_parentId: String?) = _parentId(JsonField.ofNullable(_parentId)) - /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. - * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). - * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the - * parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the - * root span row `"abc"` will show up in the summary view. You can view the full trace - * hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder._parentId] with `_parentId.orElse(null)`. */ fun _parentId(_parentId: Optional) = _parentId(_parentId.getOrNull()) /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. - * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). + * Sets [Builder._parentId] to an arbitrary JSON value. * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the - * parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the - * root span row `"abc"` will show up in the summary view. You can view the full trace - * hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder._parentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun _parentId(_parentId: JsonField) = apply { this._parentId = _parentId } /** The timestamp the dataset event was created */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** The timestamp the dataset event was created */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** The timestamp the dataset event was created */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** @@ -679,51 +602,32 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** Indicates the event was copied from another object. */ fun origin(origin: ObjectReference?) = origin(JsonField.ofNullable(origin)) - /** Indicates the event was copied from another object. */ + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) - /** Indicates the event was copied from another object. */ - fun origin(origin: JsonField) = apply { this.origin = origin } - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.origin] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.origin] with a well-typed [ObjectReference] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun rootSpanId(rootSpanId: String?) = rootSpanId(JsonField.ofNullable(rootSpanId)) + fun origin(origin: JsonField) = apply { this.origin = origin } /** * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now @@ -742,24 +646,17 @@ private constructor( * * If the row is being merged into an existing row, this field will be ignored. */ + fun rootSpanId(rootSpanId: String?) = rootSpanId(JsonField.ofNullable(rootSpanId)) + + /** Alias for calling [Builder.rootSpanId] with `rootSpanId.orElse(null)`. */ fun rootSpanId(rootSpanId: Optional) = rootSpanId(rootSpanId.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Sets [Builder.rootSpanId] to an arbitrary JSON value. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.rootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } @@ -782,41 +679,14 @@ private constructor( */ fun spanId(spanId: String?) = spanId(JsonField.ofNullable(spanId)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.spanId] with `spanId.orElse(null)`. */ fun spanId(spanId: Optional) = spanId(spanId.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Sets [Builder.spanId] to an arbitrary JSON value. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.spanId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } @@ -839,62 +709,24 @@ private constructor( */ fun spanParents(spanParents: List?) = spanParents(JsonField.ofNullable(spanParents)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.spanParents] with `spanParents.orElse(null)`. */ fun spanParents(spanParents: Optional>) = spanParents(spanParents.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Sets [Builder.spanParents] to an arbitrary JSON value. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.spanParents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun spanParents(spanParents: JsonField>) = apply { this.spanParents = spanParents.map { it.toMutableList() } } /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Adds a single [String] to [spanParents]. * - * If the row is being merged into an existing row, this field will be ignored. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addSpanParent(spanParent: String) = apply { spanParents = @@ -906,15 +738,25 @@ private constructor( /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -976,10 +818,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The model used for this example */ + /** + * The model used for this example + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) - /** The model used for this example */ + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model @JsonAnyGetter @@ -1020,10 +871,16 @@ private constructor( /** The model used for this example */ fun model(model: String?) = model(JsonField.ofNullable(model)) - /** The model used for this example */ + /** Alias for calling [Builder.model] with `model.orElse(null)`. */ fun model(model: Optional) = model(model.getOrNull()) - /** The model used for this example */ + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertEventsResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertEventsResponse.kt index 099bcb9a..a2436a67 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertEventsResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertEventsResponse.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -29,11 +30,16 @@ private constructor( /** * The ids of all rows that were inserted, aligning one-to-one with the rows provided as input + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun rowIds(): List = rowIds.getRequired("row_ids") /** - * The ids of all rows that were inserted, aligning one-to-one with the rows provided as input + * Returns the raw JSON value of [rowIds]. + * + * Unlike [rowIds], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("row_ids") @ExcludeMissing fun _rowIds(): JsonField> = rowIds @@ -86,16 +92,20 @@ private constructor( fun rowIds(rowIds: List) = rowIds(JsonField.of(rowIds)) /** - * The ids of all rows that were inserted, aligning one-to-one with the rows provided as - * input + * Sets [Builder.rowIds] to an arbitrary JSON value. + * + * You should usually call [Builder.rowIds] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun rowIds(rowIds: JsonField>) = apply { this.rowIds = rowIds.map { it.toMutableList() } } /** - * The ids of all rows that were inserted, aligning one-to-one with the rows provided as - * input + * Adds a single [String] to [rowIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addRowId(rowId: String) = apply { rowIds = diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertExperimentEvent.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertExperimentEvent.kt index 924c9baf..13aa14a8 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertExperimentEvent.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertExperimentEvent.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -80,6 +81,9 @@ private constructor( /** * A unique identifier for the experiment event. If you don't provide one, BrainTrust will * generate one for you + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -94,6 +98,9 @@ private constructor( * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _isMerge(): Optional = Optional.ofNullable(_isMerge.getNullable("_is_merge")) @@ -109,6 +116,9 @@ private constructor( * 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the * merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and * `input.c`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _mergePaths(): Optional>> = Optional.ofNullable(_mergePaths.getNullable("_merge_paths")) @@ -116,6 +126,9 @@ private constructor( /** * Pass `_object_delete=true` to mark the experiment event deleted. Deleted events will not show * up in subsequent fetches for this experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _objectDelete(): Optional = Optional.ofNullable(_objectDelete.getNullable("_object_delete")) @@ -137,6 +150,9 @@ private constructor( * case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _parentId(): Optional = Optional.ofNullable(_parentId.getNullable("_parent_id")) @@ -144,10 +160,18 @@ private constructor( * Context is additional information about the code that produced the experiment event. It is * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the * location in code which produced the experiment event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun context(): Optional = Optional.ofNullable(context.getNullable("context")) - /** The timestamp the experiment event was created */ + /** + * The timestamp the experiment event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) /** The error that occurred, if any. */ @@ -177,6 +201,9 @@ private constructor( * example, you could log the `prompt`, example's `id`, or anything else that would be useful to * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys * must be strings + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) @@ -184,10 +211,18 @@ private constructor( * Metrics are numerical measurements tracking the execution of the code that produced the * experiment event. Use "start" and "end" to track the time span over which the experiment * event was produced + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metrics(): Optional = Optional.ofNullable(metrics.getNullable("metrics")) - /** Indicates the event was copied from another object. */ + /** + * Indicates the event was copied from another object. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) /** @@ -214,6 +249,9 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun rootSpanId(): Optional = Optional.ofNullable(rootSpanId.getNullable("root_span_id")) @@ -225,10 +263,18 @@ private constructor( * generated and grouth truth summary. The word similarity score could help you determine * whether the summarization was covering similar concepts or not. You can use these scores to * help you sort, filter, and compare experiments + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Human-identifying attributes of the span, such as name, type, etc. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun spanAttributes(): Optional = Optional.ofNullable(spanAttributes.getNullable("span_attributes")) @@ -247,6 +293,9 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanId(): Optional = Optional.ofNullable(spanId.getNullable("span_id")) @@ -265,180 +314,139 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanParents(): Optional> = Optional.ofNullable(spanParents.getNullable("span_parents")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * A unique identifier for the experiment event. If you don't provide one, BrainTrust will - * generate one for you + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The `_is_merge` field controls how the row is merged with any existing row with the same id - * in the DB. By default (or when set to `false`), the existing row is completely replaced by - * the new row. When set to `true`, the new row is deep-merged into the existing row, if one is - * found. If no existing row is found, the new row is inserted as is. + * Returns the raw JSON value of [_isMerge]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * Unlike [_isMerge], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_is_merge") @ExcludeMissing fun __isMerge(): JsonField = _isMerge /** - * The `_merge_paths` field allows controlling the depth of the merge, when `_is_merge=true`. - * `_merge_paths` is a list of paths, where each path is a list of field names. The deep merge - * will not descend below any of the specified merge paths. + * Returns the raw JSON value of [_mergePaths]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": 10}, - * "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": true, - * "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, - * "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": {"a": {"q": - * 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the - * merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and - * `input.c`. + * Unlike [_mergePaths], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_merge_paths") @ExcludeMissing fun __mergePaths(): JsonField>> = _mergePaths /** - * Pass `_object_delete=true` to mark the experiment event deleted. Deleted events will not show - * up in subsequent fetches for this experiment + * Returns the raw JSON value of [_objectDelete]. + * + * Unlike [_objectDelete], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_object_delete") @ExcludeMissing fun __objectDelete(): JsonField = _objectDelete /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. + * Returns the raw JSON value of [_parentId]. * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). - * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent - * row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after - * foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row - * `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this - * case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [_parentId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_parent_id") @ExcludeMissing fun __parentId(): JsonField = _parentId /** - * Context is additional information about the code that produced the experiment event. It is - * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the - * location in code which produced the experiment event + * Returns the raw JSON value of [context]. + * + * Unlike [context], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("context") @ExcludeMissing fun _context(): JsonField = context - /** The timestamp the experiment event was created */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. For - * example, you could log the `prompt`, example's `id`, or anything else that would be useful to - * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys - * must be strings + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * experiment event. Use "start" and "end" to track the time span over which the experiment - * event was produced + * Returns the raw JSON value of [metrics]. + * + * Unlike [metrics], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metrics") @ExcludeMissing fun _metrics(): JsonField = metrics - /** Indicates the event was copied from another object. */ + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Returns the raw JSON value of [rootSpanId]. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety - * of signals that help you determine how accurate the outputs are compared to what you expect - * and diagnose failures. For example, a summarization app might have one score that tells you - * how accurate the summary is, and another that measures the word similarity between the - * generated and grouth truth summary. The word similarity score could help you determine - * whether the summarization was covering similar concepts or not. You can use these scores to - * help you sort, filter, and compare experiments + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Returns the raw JSON value of [spanAttributes]. + * + * Unlike [spanAttributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("span_attributes") @ExcludeMissing fun _spanAttributes(): JsonField = spanAttributes /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Returns the raw JSON value of [spanId]. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Returns the raw JSON value of [spanParents]. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [spanParents], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_parents") @ExcludeMissing fun _spanParents(): JsonField> = spanParents - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -535,15 +543,14 @@ private constructor( */ fun id(id: String?) = id(JsonField.ofNullable(id)) - /** - * A unique identifier for the experiment event. If you don't provide one, BrainTrust will - * generate one for you - */ + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) /** - * A unique identifier for the experiment event. If you don't provide one, BrainTrust will - * generate one for you + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } @@ -562,44 +569,21 @@ private constructor( fun _isMerge(_isMerge: Boolean?) = _isMerge(JsonField.ofNullable(_isMerge)) /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. + * Alias for [Builder._isMerge]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * This unboxed primitive overload exists for backwards compatibility. */ fun _isMerge(_isMerge: Boolean) = _isMerge(_isMerge as Boolean?) - /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. - * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` - */ + /** Alias for calling [Builder._isMerge] with `_isMerge.orElse(null)`. */ fun _isMerge(_isMerge: Optional) = _isMerge(_isMerge.getOrNull()) /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. + * Sets [Builder._isMerge] to an arbitrary JSON value. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * You should usually call [Builder._isMerge] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun _isMerge(_isMerge: JsonField) = apply { this._isMerge = _isMerge } @@ -619,51 +603,25 @@ private constructor( fun _mergePaths(_mergePaths: List>?) = _mergePaths(JsonField.ofNullable(_mergePaths)) - /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. - * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. - */ + /** Alias for calling [Builder._mergePaths] with `_mergePaths.orElse(null)`. */ fun _mergePaths(_mergePaths: Optional>>) = _mergePaths(_mergePaths.getOrNull()) /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. + * Sets [Builder._mergePaths] to an arbitrary JSON value. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. + * You should usually call [Builder._mergePaths] with a well-typed `List>` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun _mergePaths(_mergePaths: JsonField>>) = apply { this._mergePaths = _mergePaths.map { it.toMutableList() } } /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. + * Adds a single [List] to [_mergePaths]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMergePath(mergePath: List) = apply { _mergePaths = @@ -680,21 +638,22 @@ private constructor( _objectDelete(JsonField.ofNullable(_objectDelete)) /** - * Pass `_object_delete=true` to mark the experiment event deleted. Deleted events will not - * show up in subsequent fetches for this experiment + * Alias for [Builder._objectDelete]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun _objectDelete(_objectDelete: Boolean) = _objectDelete(_objectDelete as Boolean?) - /** - * Pass `_object_delete=true` to mark the experiment event deleted. Deleted events will not - * show up in subsequent fetches for this experiment - */ + /** Alias for calling [Builder._objectDelete] with `_objectDelete.orElse(null)`. */ fun _objectDelete(_objectDelete: Optional) = _objectDelete(_objectDelete.getOrNull()) /** - * Pass `_object_delete=true` to mark the experiment event deleted. Deleted events will not - * show up in subsequent fetches for this experiment + * Sets [Builder._objectDelete] to an arbitrary JSON value. + * + * You should usually call [Builder._objectDelete] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun _objectDelete(_objectDelete: JsonField) = apply { this._objectDelete = _objectDelete @@ -720,43 +679,15 @@ private constructor( */ fun _parentId(_parentId: String?) = _parentId(JsonField.ofNullable(_parentId)) - /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. - * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). - * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the - * parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the - * root span row `"abc"` will show up in the summary view. You can view the full trace - * hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder._parentId] with `_parentId.orElse(null)`. */ fun _parentId(_parentId: Optional) = _parentId(_parentId.getOrNull()) /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. - * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). + * Sets [Builder._parentId] to an arbitrary JSON value. * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the - * parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the - * root span row `"abc"` will show up in the summary view. You can view the full trace - * hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder._parentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun _parentId(_parentId: JsonField) = apply { this._parentId = _parentId } @@ -767,27 +698,30 @@ private constructor( */ fun context(context: Context?) = context(JsonField.ofNullable(context)) - /** - * Context is additional information about the code that produced the experiment event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the experiment event - */ + /** Alias for calling [Builder.context] with `context.orElse(null)`. */ fun context(context: Optional) = context(context.getOrNull()) /** - * Context is additional information about the code that produced the experiment event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the experiment event + * Sets [Builder.context] to an arbitrary JSON value. + * + * You should usually call [Builder.context] with a well-typed [Context] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun context(context: JsonField) = apply { this.context = context } /** The timestamp the experiment event was created */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** The timestamp the experiment event was created */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** The timestamp the experiment event was created */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** The error that occurred, if any. */ @@ -820,21 +754,15 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } @@ -845,27 +773,30 @@ private constructor( */ fun metrics(metrics: Metrics?) = metrics(JsonField.ofNullable(metrics)) - /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * experiment event. Use "start" and "end" to track the time span over which the experiment - * event was produced - */ + /** Alias for calling [Builder.metrics] with `metrics.orElse(null)`. */ fun metrics(metrics: Optional) = metrics(metrics.getOrNull()) /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * experiment event. Use "start" and "end" to track the time span over which the experiment - * event was produced + * Sets [Builder.metrics] to an arbitrary JSON value. + * + * You should usually call [Builder.metrics] with a well-typed [Metrics] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun metrics(metrics: JsonField) = apply { this.metrics = metrics } /** Indicates the event was copied from another object. */ fun origin(origin: ObjectReference?) = origin(JsonField.ofNullable(origin)) - /** Indicates the event was copied from another object. */ + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) - /** Indicates the event was copied from another object. */ + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [ObjectReference] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** @@ -896,41 +827,15 @@ private constructor( */ fun rootSpanId(rootSpanId: String?) = rootSpanId(JsonField.ofNullable(rootSpanId)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.rootSpanId] with `rootSpanId.orElse(null)`. */ fun rootSpanId(rootSpanId: Optional) = rootSpanId(rootSpanId.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.rootSpanId] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.rootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } @@ -945,25 +850,14 @@ private constructor( */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare experiments - */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare experiments + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun scores(scores: JsonField) = apply { this.scores = scores } @@ -971,11 +865,17 @@ private constructor( fun spanAttributes(spanAttributes: SpanAttributes?) = spanAttributes(JsonField.ofNullable(spanAttributes)) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** Alias for calling [Builder.spanAttributes] with `spanAttributes.orElse(null)`. */ fun spanAttributes(spanAttributes: Optional) = spanAttributes(spanAttributes.getOrNull()) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Sets [Builder.spanAttributes] to an arbitrary JSON value. + * + * You should usually call [Builder.spanAttributes] with a well-typed [SpanAttributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun spanAttributes(spanAttributes: JsonField) = apply { this.spanAttributes = spanAttributes } @@ -999,41 +899,14 @@ private constructor( */ fun spanId(spanId: String?) = spanId(JsonField.ofNullable(spanId)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.spanId] with `spanId.orElse(null)`. */ fun spanId(spanId: Optional) = spanId(spanId.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.spanId] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.spanId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } @@ -1056,62 +929,24 @@ private constructor( */ fun spanParents(spanParents: List?) = spanParents(JsonField.ofNullable(spanParents)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.spanParents] with `spanParents.orElse(null)`. */ fun spanParents(spanParents: Optional>) = spanParents(spanParents.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.spanParents] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.spanParents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun spanParents(spanParents: JsonField>) = apply { this.spanParents = spanParents.map { it.toMutableList() } } /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Adds a single [String] to [spanParents]. * - * If the row is being merged into an existing row, this field will be ignored. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addSpanParent(spanParent: String) = apply { spanParents = @@ -1123,15 +958,25 @@ private constructor( /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -1203,29 +1048,59 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the file in code where the experiment event was created */ + /** + * Name of the file in code where the experiment event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFilename(): Optional = Optional.ofNullable(callerFilename.getNullable("caller_filename")) - /** The function in code which created the experiment event */ + /** + * The function in code which created the experiment event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFunctionname(): Optional = Optional.ofNullable(callerFunctionname.getNullable("caller_functionname")) - /** Line of code where the experiment event was created */ + /** + * Line of code where the experiment event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerLineno(): Optional = Optional.ofNullable(callerLineno.getNullable("caller_lineno")) - /** Name of the file in code where the experiment event was created */ + /** + * Returns the raw JSON value of [callerFilename]. + * + * Unlike [callerFilename], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_filename") @ExcludeMissing fun _callerFilename(): JsonField = callerFilename - /** The function in code which created the experiment event */ + /** + * Returns the raw JSON value of [callerFunctionname]. + * + * Unlike [callerFunctionname], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("caller_functionname") @ExcludeMissing fun _callerFunctionname(): JsonField = callerFunctionname - /** Line of code where the experiment event was created */ + /** + * Returns the raw JSON value of [callerLineno]. + * + * Unlike [callerLineno], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_lineno") @ExcludeMissing fun _callerLineno(): JsonField = callerLineno @@ -1275,11 +1150,17 @@ private constructor( fun callerFilename(callerFilename: String?) = callerFilename(JsonField.ofNullable(callerFilename)) - /** Name of the file in code where the experiment event was created */ + /** Alias for calling [Builder.callerFilename] with `callerFilename.orElse(null)`. */ fun callerFilename(callerFilename: Optional) = callerFilename(callerFilename.getOrNull()) - /** Name of the file in code where the experiment event was created */ + /** + * Sets [Builder.callerFilename] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFilename] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFilename(callerFilename: JsonField) = apply { this.callerFilename = callerFilename } @@ -1288,11 +1169,20 @@ private constructor( fun callerFunctionname(callerFunctionname: String?) = callerFunctionname(JsonField.ofNullable(callerFunctionname)) - /** The function in code which created the experiment event */ + /** + * Alias for calling [Builder.callerFunctionname] with + * `callerFunctionname.orElse(null)`. + */ fun callerFunctionname(callerFunctionname: Optional) = callerFunctionname(callerFunctionname.getOrNull()) - /** The function in code which created the experiment event */ + /** + * Sets [Builder.callerFunctionname] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFunctionname] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFunctionname(callerFunctionname: JsonField) = apply { this.callerFunctionname = callerFunctionname } @@ -1300,13 +1190,23 @@ private constructor( /** Line of code where the experiment event was created */ fun callerLineno(callerLineno: Long?) = callerLineno(JsonField.ofNullable(callerLineno)) - /** Line of code where the experiment event was created */ + /** + * Alias for [Builder.callerLineno]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun callerLineno(callerLineno: Long) = callerLineno(callerLineno as Long?) - /** Line of code where the experiment event was created */ + /** Alias for calling [Builder.callerLineno] with `callerLineno.orElse(null)`. */ fun callerLineno(callerLineno: Optional) = callerLineno(callerLineno.getOrNull()) - /** Line of code where the experiment event was created */ + /** + * Sets [Builder.callerLineno] to an arbitrary JSON value. + * + * You should usually call [Builder.callerLineno] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerLineno(callerLineno: JsonField) = apply { this.callerLineno = callerLineno } @@ -1375,10 +1275,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The model used for this example */ + /** + * The model used for this example + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) - /** The model used for this example */ + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model @JsonAnyGetter @@ -1419,10 +1328,16 @@ private constructor( /** The model used for this example */ fun model(model: String?) = model(JsonField.ofNullable(model)) - /** The model used for this example */ + /** Alias for calling [Builder.model] with `model.orElse(null)`. */ fun model(model: Optional) = model(model.getOrNull()) - /** The model used for this example */ + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun additionalProperties(additionalProperties: Map) = apply { @@ -1516,6 +1431,9 @@ private constructor( /** * The number of tokens in the completion generated by the model (only set if this is an LLM * span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun completionTokens(): Optional = Optional.ofNullable(completionTokens.getNullable("completion_tokens")) @@ -1523,12 +1441,18 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the experiment event * finished + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun end(): Optional = Optional.ofNullable(end.getNullable("end")) /** * The number of tokens in the prompt used to generate the experiment event (only set if * this is an LLM span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun promptTokens(): Optional = Optional.ofNullable(promptTokens.getNullable("prompt_tokens")) @@ -1536,41 +1460,59 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the experiment event * started + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun start(): Optional = Optional.ofNullable(start.getNullable("start")) - /** The total number of tokens in the input and output of the experiment event. */ + /** + * The total number of tokens in the input and output of the experiment event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tokens(): Optional = Optional.ofNullable(tokens.getNullable("tokens")) /** - * The number of tokens in the completion generated by the model (only set if this is an LLM - * span) + * Returns the raw JSON value of [completionTokens]. + * + * Unlike [completionTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("completion_tokens") @ExcludeMissing fun _completionTokens(): JsonField = completionTokens /** - * A unix timestamp recording when the section of code which produced the experiment event - * finished + * Returns the raw JSON value of [end]. + * + * Unlike [end], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("end") @ExcludeMissing fun _end(): JsonField = end /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) + * Returns the raw JSON value of [promptTokens]. + * + * Unlike [promptTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("prompt_tokens") @ExcludeMissing fun _promptTokens(): JsonField = promptTokens /** - * A unix timestamp recording when the section of code which produced the experiment event - * started + * Returns the raw JSON value of [start]. + * + * Unlike [start], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("start") @ExcludeMissing fun _start(): JsonField = start - /** The total number of tokens in the input and output of the experiment event. */ + /** + * Returns the raw JSON value of [tokens]. + * + * Unlike [tokens], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tokens") @ExcludeMissing fun _tokens(): JsonField = tokens @JsonAnyGetter @@ -1647,22 +1589,25 @@ private constructor( completionTokens(JsonField.ofNullable(completionTokens)) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for [Builder.completionTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun completionTokens(completionTokens: Long) = completionTokens(completionTokens as Long?) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for calling [Builder.completionTokens] with `completionTokens.orElse(null)`. */ fun completionTokens(completionTokens: Optional) = completionTokens(completionTokens.getOrNull()) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Sets [Builder.completionTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.completionTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun completionTokens(completionTokens: JsonField) = apply { this.completionTokens = completionTokens @@ -1675,20 +1620,21 @@ private constructor( fun end(end: Double?) = end(JsonField.ofNullable(end)) /** - * A unix timestamp recording when the section of code which produced the experiment - * event finished + * Alias for [Builder.end]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun end(end: Double) = end(end as Double?) - /** - * A unix timestamp recording when the section of code which produced the experiment - * event finished - */ + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ fun end(end: Optional) = end(end.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the experiment - * event finished + * Sets [Builder.end] to an arbitrary JSON value. + * + * You should usually call [Builder.end] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun end(end: JsonField) = apply { this.end = end } @@ -1699,20 +1645,21 @@ private constructor( fun promptTokens(promptTokens: Long?) = promptTokens(JsonField.ofNullable(promptTokens)) /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) + * Alias for [Builder.promptTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun promptTokens(promptTokens: Long) = promptTokens(promptTokens as Long?) - /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) - */ + /** Alias for calling [Builder.promptTokens] with `promptTokens.orElse(null)`. */ fun promptTokens(promptTokens: Optional) = promptTokens(promptTokens.getOrNull()) /** - * The number of tokens in the prompt used to generate the experiment event (only set if - * this is an LLM span) + * Sets [Builder.promptTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.promptTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun promptTokens(promptTokens: JsonField) = apply { this.promptTokens = promptTokens @@ -1725,33 +1672,44 @@ private constructor( fun start(start: Double?) = start(JsonField.ofNullable(start)) /** - * A unix timestamp recording when the section of code which produced the experiment - * event started + * Alias for [Builder.start]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun start(start: Double) = start(start as Double?) - /** - * A unix timestamp recording when the section of code which produced the experiment - * event started - */ + /** Alias for calling [Builder.start] with `start.orElse(null)`. */ fun start(start: Optional) = start(start.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the experiment - * event started + * Sets [Builder.start] to an arbitrary JSON value. + * + * You should usually call [Builder.start] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun start(start: JsonField) = apply { this.start = start } /** The total number of tokens in the input and output of the experiment event. */ fun tokens(tokens: Long?) = tokens(JsonField.ofNullable(tokens)) - /** The total number of tokens in the input and output of the experiment event. */ + /** + * Alias for [Builder.tokens]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun tokens(tokens: Long) = tokens(tokens as Long?) - /** The total number of tokens in the input and output of the experiment event. */ + /** Alias for calling [Builder.tokens] with `tokens.orElse(null)`. */ fun tokens(tokens: Optional) = tokens(tokens.getOrNull()) - /** The total number of tokens in the input and output of the experiment event. */ + /** + * Sets [Builder.tokens] to an arbitrary JSON value. + * + * You should usually call [Builder.tokens] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tokens(tokens: JsonField) = apply { this.tokens = tokens } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertProjectLogsEvent.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertProjectLogsEvent.kt index 977fb221..cd8dd98c 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertProjectLogsEvent.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/InsertProjectLogsEvent.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -80,6 +81,9 @@ private constructor( /** * A unique identifier for the project logs event. If you don't provide one, BrainTrust will * generate one for you + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -94,6 +98,9 @@ private constructor( * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _isMerge(): Optional = Optional.ofNullable(_isMerge.getNullable("_is_merge")) @@ -109,6 +116,9 @@ private constructor( * 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the * merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and * `input.c`. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _mergePaths(): Optional>> = Optional.ofNullable(_mergePaths.getNullable("_merge_paths")) @@ -116,6 +126,9 @@ private constructor( /** * Pass `_object_delete=true` to mark the project logs event deleted. Deleted events will not * show up in subsequent fetches for this project logs + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _objectDelete(): Optional = Optional.ofNullable(_objectDelete.getNullable("_object_delete")) @@ -137,6 +150,9 @@ private constructor( * case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun _parentId(): Optional = Optional.ofNullable(_parentId.getNullable("_parent_id")) @@ -144,10 +160,18 @@ private constructor( * Context is additional information about the code that produced the project logs event. It is * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the * location in code which produced the project logs event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun context(): Optional = Optional.ofNullable(context.getNullable("context")) - /** The timestamp the project logs event was created */ + /** + * The timestamp the project logs event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) /** The error that occurred, if any. */ @@ -172,6 +196,9 @@ private constructor( * example, you could log the `prompt`, example's `id`, or anything else that would be useful to * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys * must be strings + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) @@ -179,10 +206,18 @@ private constructor( * Metrics are numerical measurements tracking the execution of the code that produced the * project logs event. Use "start" and "end" to track the time span over which the project logs * event was produced + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metrics(): Optional = Optional.ofNullable(metrics.getNullable("metrics")) - /** Indicates the event was copied from another object. */ + /** + * Indicates the event was copied from another object. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) /** @@ -209,6 +244,9 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun rootSpanId(): Optional = Optional.ofNullable(rootSpanId.getNullable("root_span_id")) @@ -220,10 +258,18 @@ private constructor( * generated and grouth truth summary. The word similarity score could help you determine * whether the summarization was covering similar concepts or not. You can use these scores to * help you sort, filter, and compare logs. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Human-identifying attributes of the span, such as name, type, etc. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun spanAttributes(): Optional = Optional.ofNullable(spanAttributes.getNullable("span_attributes")) @@ -242,6 +288,9 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanId(): Optional = Optional.ofNullable(spanId.getNullable("span_id")) @@ -260,180 +309,139 @@ private constructor( * this case, the `"llm_call"` row) by clicking on the "abc" row. * * If the row is being merged into an existing row, this field will be ignored. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanParents(): Optional> = Optional.ofNullable(spanParents.getNullable("span_parents")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * A unique identifier for the project logs event. If you don't provide one, BrainTrust will - * generate one for you + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The `_is_merge` field controls how the row is merged with any existing row with the same id - * in the DB. By default (or when set to `false`), the existing row is completely replaced by - * the new row. When set to `true`, the new row is deep-merged into the existing row, if one is - * found. If no existing row is found, the new row is inserted as is. + * Returns the raw JSON value of [_isMerge]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * Unlike [_isMerge], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_is_merge") @ExcludeMissing fun __isMerge(): JsonField = _isMerge /** - * The `_merge_paths` field allows controlling the depth of the merge, when `_is_merge=true`. - * `_merge_paths` is a list of paths, where each path is a list of field names. The deep merge - * will not descend below any of the specified merge paths. + * Returns the raw JSON value of [_mergePaths]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": 10}, - * "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": true, - * "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, - * "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": {"a": {"q": - * 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the - * merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and - * `input.c`. + * Unlike [_mergePaths], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_merge_paths") @ExcludeMissing fun __mergePaths(): JsonField>> = _mergePaths /** - * Pass `_object_delete=true` to mark the project logs event deleted. Deleted events will not - * show up in subsequent fetches for this project logs + * Returns the raw JSON value of [_objectDelete]. + * + * Unlike [_objectDelete], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_object_delete") @ExcludeMissing fun __objectDelete(): JsonField = _objectDelete /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. + * Returns the raw JSON value of [_parentId]. * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). - * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent - * row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after - * foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row - * `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this - * case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [_parentId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_parent_id") @ExcludeMissing fun __parentId(): JsonField = _parentId /** - * Context is additional information about the code that produced the project logs event. It is - * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the - * location in code which produced the project logs event + * Returns the raw JSON value of [context]. + * + * Unlike [context], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("context") @ExcludeMissing fun _context(): JsonField = context - /** The timestamp the project logs event was created */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. For - * example, you could log the `prompt`, example's `id`, or anything else that would be useful to - * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys - * must be strings + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * project logs event. Use "start" and "end" to track the time span over which the project logs - * event was produced + * Returns the raw JSON value of [metrics]. + * + * Unlike [metrics], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metrics") @ExcludeMissing fun _metrics(): JsonField = metrics - /** Indicates the event was copied from another object. */ + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Returns the raw JSON value of [rootSpanId]. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety - * of signals that help you determine how accurate the outputs are compared to what you expect - * and diagnose failures. For example, a summarization app might have one score that tells you - * how accurate the summary is, and another that measures the word similarity between the - * generated and grouth truth summary. The word similarity score could help you determine - * whether the summarization was covering similar concepts or not. You can use these scores to - * help you sort, filter, and compare logs. + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Returns the raw JSON value of [spanAttributes]. + * + * Unlike [spanAttributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("span_attributes") @ExcludeMissing fun _spanAttributes(): JsonField = spanAttributes /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Returns the raw JSON value of [spanId]. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, and - * the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. + * Returns the raw JSON value of [spanParents]. * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": - * 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": - * "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root - * span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in - * this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * Unlike [spanParents], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_parents") @ExcludeMissing fun _spanParents(): JsonField> = spanParents - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -530,15 +538,14 @@ private constructor( */ fun id(id: String?) = id(JsonField.ofNullable(id)) - /** - * A unique identifier for the project logs event. If you don't provide one, BrainTrust will - * generate one for you - */ + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) /** - * A unique identifier for the project logs event. If you don't provide one, BrainTrust will - * generate one for you + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } @@ -557,44 +564,21 @@ private constructor( fun _isMerge(_isMerge: Boolean?) = _isMerge(JsonField.ofNullable(_isMerge)) /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. + * Alias for [Builder._isMerge]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * This unboxed primitive overload exists for backwards compatibility. */ fun _isMerge(_isMerge: Boolean) = _isMerge(_isMerge as Boolean?) - /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. - * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` - */ + /** Alias for calling [Builder._isMerge] with `_isMerge.orElse(null)`. */ fun _isMerge(_isMerge: Optional) = _isMerge(_isMerge.getOrNull()) /** - * The `_is_merge` field controls how the row is merged with any existing row with the same - * id in the DB. By default (or when set to `false`), the existing row is completely - * replaced by the new row. When set to `true`, the new row is deep-merged into the existing - * row, if one is found. If no existing row is found, the new row is inserted as is. + * Sets [Builder._isMerge] to an arbitrary JSON value. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": - * 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": - * 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we - * replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be - * `{"id": "foo", "input": {"b": 11, "c": 20}}` + * You should usually call [Builder._isMerge] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun _isMerge(_isMerge: JsonField) = apply { this._isMerge = _isMerge } @@ -614,51 +598,25 @@ private constructor( fun _mergePaths(_mergePaths: List>?) = _mergePaths(JsonField.ofNullable(_mergePaths)) - /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. - * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. - */ + /** Alias for calling [Builder._mergePaths] with `_mergePaths.orElse(null)`. */ fun _mergePaths(_mergePaths: Optional>>) = _mergePaths(_mergePaths.getOrNull()) /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. + * Sets [Builder._mergePaths] to an arbitrary JSON value. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. + * You should usually call [Builder._mergePaths] with a well-typed `List>` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun _mergePaths(_mergePaths: JsonField>>) = apply { this._mergePaths = _mergePaths.map { it.toMutableList() } } /** - * The `_merge_paths` field allows controlling the depth of the merge, when - * `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field - * names. The deep merge will not descend below any of the specified merge paths. + * Adds a single [List] to [_mergePaths]. * - * For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": - * 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": - * true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": - * 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": - * {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this - * case, due to the merge paths, we have replaced `input.a` and `output`, but have still - * deep-merged `input` and `input.c`. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMergePath(mergePath: List) = apply { _mergePaths = @@ -675,21 +633,22 @@ private constructor( _objectDelete(JsonField.ofNullable(_objectDelete)) /** - * Pass `_object_delete=true` to mark the project logs event deleted. Deleted events will - * not show up in subsequent fetches for this project logs + * Alias for [Builder._objectDelete]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun _objectDelete(_objectDelete: Boolean) = _objectDelete(_objectDelete as Boolean?) - /** - * Pass `_object_delete=true` to mark the project logs event deleted. Deleted events will - * not show up in subsequent fetches for this project logs - */ + /** Alias for calling [Builder._objectDelete] with `_objectDelete.orElse(null)`. */ fun _objectDelete(_objectDelete: Optional) = _objectDelete(_objectDelete.getOrNull()) /** - * Pass `_object_delete=true` to mark the project logs event deleted. Deleted events will - * not show up in subsequent fetches for this project logs + * Sets [Builder._objectDelete] to an arbitrary JSON value. + * + * You should usually call [Builder._objectDelete] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun _objectDelete(_objectDelete: JsonField) = apply { this._objectDelete = _objectDelete @@ -715,43 +674,15 @@ private constructor( */ fun _parentId(_parentId: String?) = _parentId(JsonField.ofNullable(_parentId)) - /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. - * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). - * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the - * parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the - * root span row `"abc"` will show up in the summary view. You can view the full trace - * hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder._parentId] with `_parentId.orElse(null)`. */ fun _parentId(_parentId: Optional) = _parentId(_parentId.getOrNull()) /** - * DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for - * `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, - * `root_span_id`, and `span_parents` explicitly instead. - * - * Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking - * hierarchical relationships are important for tracing (see the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details). + * Sets [Builder._parentId] to an arbitrary JSON value. * - * For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", - * "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the - * parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What - * comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the - * root span row `"abc"` will show up in the summary view. You can view the full trace - * hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder._parentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun _parentId(_parentId: JsonField) = apply { this._parentId = _parentId } @@ -762,27 +693,30 @@ private constructor( */ fun context(context: Context?) = context(JsonField.ofNullable(context)) - /** - * Context is additional information about the code that produced the project logs event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the project logs event - */ + /** Alias for calling [Builder.context] with `context.orElse(null)`. */ fun context(context: Optional) = context(context.getOrNull()) /** - * Context is additional information about the code that produced the project logs event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the project logs event + * Sets [Builder.context] to an arbitrary JSON value. + * + * You should usually call [Builder.context] with a well-typed [Context] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun context(context: JsonField) = apply { this.context = context } /** The timestamp the project logs event was created */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** The timestamp the project logs event was created */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** The timestamp the project logs event was created */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** The error that occurred, if any. */ @@ -812,21 +746,15 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } @@ -837,27 +765,30 @@ private constructor( */ fun metrics(metrics: Metrics?) = metrics(JsonField.ofNullable(metrics)) - /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * project logs event. Use "start" and "end" to track the time span over which the project - * logs event was produced - */ + /** Alias for calling [Builder.metrics] with `metrics.orElse(null)`. */ fun metrics(metrics: Optional) = metrics(metrics.getOrNull()) /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * project logs event. Use "start" and "end" to track the time span over which the project - * logs event was produced + * Sets [Builder.metrics] to an arbitrary JSON value. + * + * You should usually call [Builder.metrics] with a well-typed [Metrics] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun metrics(metrics: JsonField) = apply { this.metrics = metrics } /** Indicates the event was copied from another object. */ fun origin(origin: ObjectReference?) = origin(JsonField.ofNullable(origin)) - /** Indicates the event was copied from another object. */ + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) - /** Indicates the event was copied from another object. */ + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [ObjectReference] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** @@ -888,41 +819,15 @@ private constructor( */ fun rootSpanId(rootSpanId: String?) = rootSpanId(JsonField.ofNullable(rootSpanId)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.rootSpanId] with `rootSpanId.orElse(null)`. */ fun rootSpanId(rootSpanId: Optional) = rootSpanId(rootSpanId.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.rootSpanId] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.rootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } @@ -937,25 +842,14 @@ private constructor( */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare logs. - */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare logs. + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun scores(scores: JsonField) = apply { this.scores = scores } @@ -963,11 +857,17 @@ private constructor( fun spanAttributes(spanAttributes: SpanAttributes?) = spanAttributes(JsonField.ofNullable(spanAttributes)) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** Alias for calling [Builder.spanAttributes] with `spanAttributes.orElse(null)`. */ fun spanAttributes(spanAttributes: Optional) = spanAttributes(spanAttributes.getOrNull()) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Sets [Builder.spanAttributes] to an arbitrary JSON value. + * + * You should usually call [Builder.spanAttributes] with a well-typed [SpanAttributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun spanAttributes(spanAttributes: JsonField) = apply { this.spanAttributes = spanAttributes } @@ -991,41 +891,14 @@ private constructor( */ fun spanId(spanId: String?) = spanId(JsonField.ofNullable(spanId)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.spanId] with `spanId.orElse(null)`. */ fun spanId(spanId: Optional) = spanId(spanId.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.spanId] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.spanId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } @@ -1048,62 +921,24 @@ private constructor( */ fun spanParents(spanParents: List?) = spanParents(JsonField.ofNullable(spanParents)) - /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. - * - * If the row is being merged into an existing row, this field will be ignored. - */ + /** Alias for calling [Builder.spanParents] with `spanParents.orElse(null)`. */ fun spanParents(spanParents: Optional>) = spanParents(spanParents.getOrNull()) /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Sets [Builder.spanParents] to an arbitrary JSON value. * - * If the row is being merged into an existing row, this field will be ignored. + * You should usually call [Builder.spanParents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun spanParents(spanParents: JsonField>) = apply { this.spanParents = spanParents.map { it.toMutableList() } } /** - * Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now - * deprecated. The span_id is a unique identifier describing the row's place in the a trace, - * and the root_span_id is a unique identifier for the whole trace. See the - * [guide](https://www.braintrust.dev/docs/guides/tracing) for full details. - * - * For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": - * "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": - * {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": - * "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], - * "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": - * 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You - * can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the - * "abc" row. + * Adds a single [String] to [spanParents]. * - * If the row is being merged into an existing row, this field will be ignored. + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addSpanParent(spanParent: String) = apply { spanParents = @@ -1115,15 +950,25 @@ private constructor( /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -1195,29 +1040,59 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the file in code where the project logs event was created */ + /** + * Name of the file in code where the project logs event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFilename(): Optional = Optional.ofNullable(callerFilename.getNullable("caller_filename")) - /** The function in code which created the project logs event */ + /** + * The function in code which created the project logs event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFunctionname(): Optional = Optional.ofNullable(callerFunctionname.getNullable("caller_functionname")) - /** Line of code where the project logs event was created */ + /** + * Line of code where the project logs event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerLineno(): Optional = Optional.ofNullable(callerLineno.getNullable("caller_lineno")) - /** Name of the file in code where the project logs event was created */ + /** + * Returns the raw JSON value of [callerFilename]. + * + * Unlike [callerFilename], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_filename") @ExcludeMissing fun _callerFilename(): JsonField = callerFilename - /** The function in code which created the project logs event */ + /** + * Returns the raw JSON value of [callerFunctionname]. + * + * Unlike [callerFunctionname], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("caller_functionname") @ExcludeMissing fun _callerFunctionname(): JsonField = callerFunctionname - /** Line of code where the project logs event was created */ + /** + * Returns the raw JSON value of [callerLineno]. + * + * Unlike [callerLineno], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_lineno") @ExcludeMissing fun _callerLineno(): JsonField = callerLineno @@ -1267,11 +1142,17 @@ private constructor( fun callerFilename(callerFilename: String?) = callerFilename(JsonField.ofNullable(callerFilename)) - /** Name of the file in code where the project logs event was created */ + /** Alias for calling [Builder.callerFilename] with `callerFilename.orElse(null)`. */ fun callerFilename(callerFilename: Optional) = callerFilename(callerFilename.getOrNull()) - /** Name of the file in code where the project logs event was created */ + /** + * Sets [Builder.callerFilename] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFilename] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFilename(callerFilename: JsonField) = apply { this.callerFilename = callerFilename } @@ -1280,11 +1161,20 @@ private constructor( fun callerFunctionname(callerFunctionname: String?) = callerFunctionname(JsonField.ofNullable(callerFunctionname)) - /** The function in code which created the project logs event */ + /** + * Alias for calling [Builder.callerFunctionname] with + * `callerFunctionname.orElse(null)`. + */ fun callerFunctionname(callerFunctionname: Optional) = callerFunctionname(callerFunctionname.getOrNull()) - /** The function in code which created the project logs event */ + /** + * Sets [Builder.callerFunctionname] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFunctionname] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFunctionname(callerFunctionname: JsonField) = apply { this.callerFunctionname = callerFunctionname } @@ -1292,13 +1182,23 @@ private constructor( /** Line of code where the project logs event was created */ fun callerLineno(callerLineno: Long?) = callerLineno(JsonField.ofNullable(callerLineno)) - /** Line of code where the project logs event was created */ + /** + * Alias for [Builder.callerLineno]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun callerLineno(callerLineno: Long) = callerLineno(callerLineno as Long?) - /** Line of code where the project logs event was created */ + /** Alias for calling [Builder.callerLineno] with `callerLineno.orElse(null)`. */ fun callerLineno(callerLineno: Optional) = callerLineno(callerLineno.getOrNull()) - /** Line of code where the project logs event was created */ + /** + * Sets [Builder.callerLineno] to an arbitrary JSON value. + * + * You should usually call [Builder.callerLineno] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerLineno(callerLineno: JsonField) = apply { this.callerLineno = callerLineno } @@ -1367,10 +1267,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The model used for this example */ + /** + * The model used for this example + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) - /** The model used for this example */ + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model @JsonAnyGetter @@ -1411,10 +1320,16 @@ private constructor( /** The model used for this example */ fun model(model: String?) = model(JsonField.ofNullable(model)) - /** The model used for this example */ + /** Alias for calling [Builder.model] with `model.orElse(null)`. */ fun model(model: Optional) = model(model.getOrNull()) - /** The model used for this example */ + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun additionalProperties(additionalProperties: Map) = apply { @@ -1508,6 +1423,9 @@ private constructor( /** * The number of tokens in the completion generated by the model (only set if this is an LLM * span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun completionTokens(): Optional = Optional.ofNullable(completionTokens.getNullable("completion_tokens")) @@ -1515,12 +1433,18 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the project logs event * finished + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun end(): Optional = Optional.ofNullable(end.getNullable("end")) /** * The number of tokens in the prompt used to generate the project logs event (only set if * this is an LLM span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun promptTokens(): Optional = Optional.ofNullable(promptTokens.getNullable("prompt_tokens")) @@ -1528,41 +1452,59 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the project logs event * started + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun start(): Optional = Optional.ofNullable(start.getNullable("start")) - /** The total number of tokens in the input and output of the project logs event. */ + /** + * The total number of tokens in the input and output of the project logs event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tokens(): Optional = Optional.ofNullable(tokens.getNullable("tokens")) /** - * The number of tokens in the completion generated by the model (only set if this is an LLM - * span) + * Returns the raw JSON value of [completionTokens]. + * + * Unlike [completionTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("completion_tokens") @ExcludeMissing fun _completionTokens(): JsonField = completionTokens /** - * A unix timestamp recording when the section of code which produced the project logs event - * finished + * Returns the raw JSON value of [end]. + * + * Unlike [end], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("end") @ExcludeMissing fun _end(): JsonField = end /** - * The number of tokens in the prompt used to generate the project logs event (only set if - * this is an LLM span) + * Returns the raw JSON value of [promptTokens]. + * + * Unlike [promptTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("prompt_tokens") @ExcludeMissing fun _promptTokens(): JsonField = promptTokens /** - * A unix timestamp recording when the section of code which produced the project logs event - * started + * Returns the raw JSON value of [start]. + * + * Unlike [start], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("start") @ExcludeMissing fun _start(): JsonField = start - /** The total number of tokens in the input and output of the project logs event. */ + /** + * Returns the raw JSON value of [tokens]. + * + * Unlike [tokens], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tokens") @ExcludeMissing fun _tokens(): JsonField = tokens @JsonAnyGetter @@ -1639,22 +1581,25 @@ private constructor( completionTokens(JsonField.ofNullable(completionTokens)) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for [Builder.completionTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun completionTokens(completionTokens: Long) = completionTokens(completionTokens as Long?) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for calling [Builder.completionTokens] with `completionTokens.orElse(null)`. */ fun completionTokens(completionTokens: Optional) = completionTokens(completionTokens.getOrNull()) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Sets [Builder.completionTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.completionTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun completionTokens(completionTokens: JsonField) = apply { this.completionTokens = completionTokens @@ -1667,20 +1612,21 @@ private constructor( fun end(end: Double?) = end(JsonField.ofNullable(end)) /** - * A unix timestamp recording when the section of code which produced the project logs - * event finished + * Alias for [Builder.end]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun end(end: Double) = end(end as Double?) - /** - * A unix timestamp recording when the section of code which produced the project logs - * event finished - */ + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ fun end(end: Optional) = end(end.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the project logs - * event finished + * Sets [Builder.end] to an arbitrary JSON value. + * + * You should usually call [Builder.end] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun end(end: JsonField) = apply { this.end = end } @@ -1691,20 +1637,21 @@ private constructor( fun promptTokens(promptTokens: Long?) = promptTokens(JsonField.ofNullable(promptTokens)) /** - * The number of tokens in the prompt used to generate the project logs event (only set - * if this is an LLM span) + * Alias for [Builder.promptTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun promptTokens(promptTokens: Long) = promptTokens(promptTokens as Long?) - /** - * The number of tokens in the prompt used to generate the project logs event (only set - * if this is an LLM span) - */ + /** Alias for calling [Builder.promptTokens] with `promptTokens.orElse(null)`. */ fun promptTokens(promptTokens: Optional) = promptTokens(promptTokens.getOrNull()) /** - * The number of tokens in the prompt used to generate the project logs event (only set - * if this is an LLM span) + * Sets [Builder.promptTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.promptTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun promptTokens(promptTokens: JsonField) = apply { this.promptTokens = promptTokens @@ -1717,33 +1664,44 @@ private constructor( fun start(start: Double?) = start(JsonField.ofNullable(start)) /** - * A unix timestamp recording when the section of code which produced the project logs - * event started + * Alias for [Builder.start]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun start(start: Double) = start(start as Double?) - /** - * A unix timestamp recording when the section of code which produced the project logs - * event started - */ + /** Alias for calling [Builder.start] with `start.orElse(null)`. */ fun start(start: Optional) = start(start.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the project logs - * event started + * Sets [Builder.start] to an arbitrary JSON value. + * + * You should usually call [Builder.start] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun start(start: JsonField) = apply { this.start = start } /** The total number of tokens in the input and output of the project logs event. */ fun tokens(tokens: Long?) = tokens(JsonField.ofNullable(tokens)) - /** The total number of tokens in the input and output of the project logs event. */ + /** + * Alias for [Builder.tokens]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun tokens(tokens: Long) = tokens(tokens as Long?) - /** The total number of tokens in the input and output of the project logs event. */ + /** Alias for calling [Builder.tokens] with `tokens.orElse(null)`. */ fun tokens(tokens: Optional) = tokens(tokens.getOrNull()) - /** The total number of tokens in the input and output of the project logs event. */ + /** + * Sets [Builder.tokens] to an arbitrary JSON value. + * + * You should usually call [Builder.tokens] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tokens(tokens: JsonField) = apply { this.tokens = tokens } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/MetricSummary.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/MetricSummary.kt index a7fa4c4d..f9183713 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/MetricSummary.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/MetricSummary.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,42 +38,96 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Number of improvements in the metric */ + /** + * Number of improvements in the metric + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun improvements(): Long = improvements.getRequired("improvements") - /** Average metric across all examples */ + /** + * Average metric across all examples + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun metric(): Double = metric.getRequired("metric") - /** Name of the metric */ + /** + * Name of the metric + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Number of regressions in the metric */ + /** + * Number of regressions in the metric + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun regressions(): Long = regressions.getRequired("regressions") - /** Unit label for the metric */ + /** + * Unit label for the metric + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun unit(): String = unit.getRequired("unit") - /** Difference in metric between the current and comparison experiment */ + /** + * Difference in metric between the current and comparison experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun diff(): Optional = Optional.ofNullable(diff.getNullable("diff")) - /** Number of improvements in the metric */ + /** + * Returns the raw JSON value of [improvements]. + * + * Unlike [improvements], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("improvements") @ExcludeMissing fun _improvements(): JsonField = improvements - /** Average metric across all examples */ + /** + * Returns the raw JSON value of [metric]. + * + * Unlike [metric], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metric") @ExcludeMissing fun _metric(): JsonField = metric - /** Name of the metric */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Number of regressions in the metric */ + /** + * Returns the raw JSON value of [regressions]. + * + * Unlike [regressions], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("regressions") @ExcludeMissing fun _regressions(): JsonField = regressions - /** Unit label for the metric */ + /** + * Returns the raw JSON value of [unit]. + * + * Unlike [unit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit - /** Difference in metric between the current and comparison experiment */ + /** + * Returns the raw JSON value of [diff]. + * + * Unlike [diff], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("diff") @ExcludeMissing fun _diff(): JsonField = diff @JsonAnyGetter @@ -139,37 +194,69 @@ private constructor( /** Number of improvements in the metric */ fun improvements(improvements: Long) = improvements(JsonField.of(improvements)) - /** Number of improvements in the metric */ + /** + * Sets [Builder.improvements] to an arbitrary JSON value. + * + * You should usually call [Builder.improvements] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun improvements(improvements: JsonField) = apply { this.improvements = improvements } /** Average metric across all examples */ fun metric(metric: Double) = metric(JsonField.of(metric)) - /** Average metric across all examples */ + /** + * Sets [Builder.metric] to an arbitrary JSON value. + * + * You should usually call [Builder.metric] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun metric(metric: JsonField) = apply { this.metric = metric } /** Name of the metric */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the metric */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Number of regressions in the metric */ fun regressions(regressions: Long) = regressions(JsonField.of(regressions)) - /** Number of regressions in the metric */ + /** + * Sets [Builder.regressions] to an arbitrary JSON value. + * + * You should usually call [Builder.regressions] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun regressions(regressions: JsonField) = apply { this.regressions = regressions } /** Unit label for the metric */ fun unit(unit: String) = unit(JsonField.of(unit)) - /** Unit label for the metric */ + /** + * Sets [Builder.unit] to an arbitrary JSON value. + * + * You should usually call [Builder.unit] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun unit(unit: JsonField) = apply { this.unit = unit } /** Difference in metric between the current and comparison experiment */ fun diff(diff: Double) = diff(JsonField.of(diff)) - /** Difference in metric between the current and comparison experiment */ + /** + * Sets [Builder.diff] to an arbitrary JSON value. + * + * You should usually call [Builder.diff] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun diff(diff: JsonField) = apply { this.diff = diff } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ObjectReference.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ObjectReference.kt index 9ebd640e..20aaf4ed 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ObjectReference.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ObjectReference.kt @@ -41,36 +41,81 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** ID of the original event. */ + /** + * ID of the original event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Transaction ID of the original event. */ + /** + * Transaction ID of the original event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun _xactId(): String = _xactId.getRequired("_xact_id") - /** ID of the object the event is originating from. */ + /** + * ID of the object the event is originating from. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** Type of the object the event is originating from. */ + /** + * Type of the object the event is originating from. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): ObjectType = objectType.getRequired("object_type") - /** Created timestamp of the original event. Used to help sort in the UI */ + /** + * Created timestamp of the original event. Used to help sort in the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** ID of the original event. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Transaction ID of the original event. */ + /** + * Returns the raw JSON value of [_xactId]. + * + * Unlike [_xactId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("_xact_id") @ExcludeMissing fun __xactId(): JsonField = _xactId - /** ID of the object the event is originating from. */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** Type of the object the event is originating from. */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Created timestamp of the original event. Used to help sort in the UI */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created @JsonAnyGetter @@ -133,34 +178,60 @@ private constructor( /** ID of the original event. */ fun id(id: String) = id(JsonField.of(id)) - /** ID of the original event. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Transaction ID of the original event. */ fun _xactId(_xactId: String) = _xactId(JsonField.of(_xactId)) - /** Transaction ID of the original event. */ + /** + * Sets [Builder._xactId] to an arbitrary JSON value. + * + * You should usually call [Builder._xactId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun _xactId(_xactId: JsonField) = apply { this._xactId = _xactId } /** ID of the object the event is originating from. */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** ID of the object the event is originating from. */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** Type of the object the event is originating from. */ fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) - /** Type of the object the event is originating from. */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [ObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } /** Created timestamp of the original event. Used to help sort in the UI */ fun created(created: String?) = created(JsonField.ofNullable(created)) - /** Created timestamp of the original event. Used to help sort in the UI */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Created timestamp of the original event. Used to help sort in the UI */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun created(created: JsonField) = apply { this.created = created } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OnlineScoreConfig.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OnlineScoreConfig.kt index 6eb781e8..41ee565c 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OnlineScoreConfig.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OnlineScoreConfig.kt @@ -50,34 +50,71 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The sampling rate for online scoring */ + /** + * The sampling rate for online scoring + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun samplingRate(): Double = samplingRate.getRequired("sampling_rate") - /** The list of scorers to use for online scoring */ + /** + * The list of scorers to use for online scoring + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scorers(): List = scorers.getRequired("scorers") - /** Whether to trigger online scoring on the root span of each trace */ + /** + * Whether to trigger online scoring on the root span of each trace + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun applyToRootSpan(): Optional = Optional.ofNullable(applyToRootSpan.getNullable("apply_to_root_span")) - /** Trigger online scoring on any spans with a name in this list */ + /** + * Trigger online scoring on any spans with a name in this list + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun applyToSpanNames(): Optional> = Optional.ofNullable(applyToSpanNames.getNullable("apply_to_span_names")) - /** The sampling rate for online scoring */ + /** + * Returns the raw JSON value of [samplingRate]. + * + * Unlike [samplingRate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("sampling_rate") @ExcludeMissing fun _samplingRate(): JsonField = samplingRate - /** The list of scorers to use for online scoring */ + /** + * Returns the raw JSON value of [scorers]. + * + * Unlike [scorers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("scorers") @ExcludeMissing fun _scorers(): JsonField> = scorers - /** Whether to trigger online scoring on the root span of each trace */ + /** + * Returns the raw JSON value of [applyToRootSpan]. + * + * Unlike [applyToRootSpan], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("apply_to_root_span") @ExcludeMissing fun _applyToRootSpan(): JsonField = applyToRootSpan - /** Trigger online scoring on any spans with a name in this list */ + /** + * Returns the raw JSON value of [applyToSpanNames]. + * + * Unlike [applyToSpanNames], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("apply_to_span_names") @ExcludeMissing fun _applyToSpanNames(): JsonField> = applyToSpanNames @@ -137,7 +174,13 @@ private constructor( /** The sampling rate for online scoring */ fun samplingRate(samplingRate: Double) = samplingRate(JsonField.of(samplingRate)) - /** The sampling rate for online scoring */ + /** + * Sets [Builder.samplingRate] to an arbitrary JSON value. + * + * You should usually call [Builder.samplingRate] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun samplingRate(samplingRate: JsonField) = apply { this.samplingRate = samplingRate } @@ -145,12 +188,22 @@ private constructor( /** The list of scorers to use for online scoring */ fun scorers(scorers: List) = scorers(JsonField.of(scorers)) - /** The list of scorers to use for online scoring */ + /** + * Sets [Builder.scorers] to an arbitrary JSON value. + * + * You should usually call [Builder.scorers] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun scorers(scorers: JsonField>) = apply { this.scorers = scorers.map { it.toMutableList() } } - /** The list of scorers to use for online scoring */ + /** + * Adds a single [Scorer] to [scorers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addScorer(scorer: Scorer) = apply { scorers = (scorers ?: JsonField.of(mutableListOf())).also { @@ -158,24 +211,34 @@ private constructor( } } - /** The list of scorers to use for online scoring */ + /** Alias for calling [addScorer] with `Scorer.ofFunction(function)`. */ fun addScorer(function: Scorer.Function) = addScorer(Scorer.ofFunction(function)) - /** The list of scorers to use for online scoring */ + /** Alias for calling [addScorer] with `Scorer.ofGlobal(global)`. */ fun addScorer(global: Scorer.Global) = addScorer(Scorer.ofGlobal(global)) /** Whether to trigger online scoring on the root span of each trace */ fun applyToRootSpan(applyToRootSpan: Boolean?) = applyToRootSpan(JsonField.ofNullable(applyToRootSpan)) - /** Whether to trigger online scoring on the root span of each trace */ + /** + * Alias for [Builder.applyToRootSpan]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun applyToRootSpan(applyToRootSpan: Boolean) = applyToRootSpan(applyToRootSpan as Boolean?) - /** Whether to trigger online scoring on the root span of each trace */ + /** Alias for calling [Builder.applyToRootSpan] with `applyToRootSpan.orElse(null)`. */ fun applyToRootSpan(applyToRootSpan: Optional) = applyToRootSpan(applyToRootSpan.getOrNull()) - /** Whether to trigger online scoring on the root span of each trace */ + /** + * Sets [Builder.applyToRootSpan] to an arbitrary JSON value. + * + * You should usually call [Builder.applyToRootSpan] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun applyToRootSpan(applyToRootSpan: JsonField) = apply { this.applyToRootSpan = applyToRootSpan } @@ -184,16 +247,26 @@ private constructor( fun applyToSpanNames(applyToSpanNames: List?) = applyToSpanNames(JsonField.ofNullable(applyToSpanNames)) - /** Trigger online scoring on any spans with a name in this list */ + /** Alias for calling [Builder.applyToSpanNames] with `applyToSpanNames.orElse(null)`. */ fun applyToSpanNames(applyToSpanNames: Optional>) = applyToSpanNames(applyToSpanNames.getOrNull()) - /** Trigger online scoring on any spans with a name in this list */ + /** + * Sets [Builder.applyToSpanNames] to an arbitrary JSON value. + * + * You should usually call [Builder.applyToSpanNames] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun applyToSpanNames(applyToSpanNames: JsonField>) = apply { this.applyToSpanNames = applyToSpanNames.map { it.toMutableList() } } - /** Trigger online scoring on any spans with a name in this list */ + /** + * Adds a single [String] to [applyToSpanNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addApplyToSpanName(applyToSpanName: String) = apply { applyToSpanNames = (applyToSpanNames ?: JsonField.of(mutableListOf())).also { @@ -377,12 +450,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -433,10 +526,24 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -598,12 +705,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -654,10 +781,24 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Organization.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Organization.kt index 584931b5..fc1fc26e 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Organization.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Organization.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -43,42 +44,105 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the organization */ + /** + * Unique identifier for the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the organization */ + /** + * Name of the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun apiUrl(): Optional = Optional.ofNullable(apiUrl.getNullable("api_url")) - /** Date of organization creation */ + /** + * Date of organization creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isUniversalApi(): Optional = Optional.ofNullable(isUniversalApi.getNullable("is_universal_api")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun proxyUrl(): Optional = Optional.ofNullable(proxyUrl.getNullable("proxy_url")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun realtimeUrl(): Optional = Optional.ofNullable(realtimeUrl.getNullable("realtime_url")) - /** Unique identifier for the organization */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the organization */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [apiUrl]. + * + * Unlike [apiUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("api_url") @ExcludeMissing fun _apiUrl(): JsonField = apiUrl - /** Date of organization creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + /** + * Returns the raw JSON value of [isUniversalApi]. + * + * Unlike [isUniversalApi], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_universal_api") @ExcludeMissing fun _isUniversalApi(): JsonField = isUniversalApi + /** + * Returns the raw JSON value of [proxyUrl]. + * + * Unlike [proxyUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("proxy_url") @ExcludeMissing fun _proxyUrl(): JsonField = proxyUrl + /** + * Returns the raw JSON value of [realtimeUrl]. + * + * Unlike [realtimeUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("realtime_url") @ExcludeMissing fun _realtimeUrl(): JsonField = realtimeUrl @@ -147,52 +211,103 @@ private constructor( /** Unique identifier for the organization */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the organization */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the organization */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the organization */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun apiUrl(apiUrl: String?) = apiUrl(JsonField.ofNullable(apiUrl)) + /** Alias for calling [Builder.apiUrl] with `apiUrl.orElse(null)`. */ fun apiUrl(apiUrl: Optional) = apiUrl(apiUrl.getOrNull()) + /** + * Sets [Builder.apiUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun apiUrl(apiUrl: JsonField) = apply { this.apiUrl = apiUrl } /** Date of organization creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of organization creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of organization creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } fun isUniversalApi(isUniversalApi: Boolean?) = isUniversalApi(JsonField.ofNullable(isUniversalApi)) + /** + * Alias for [Builder.isUniversalApi]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isUniversalApi(isUniversalApi: Boolean) = isUniversalApi(isUniversalApi as Boolean?) + /** Alias for calling [Builder.isUniversalApi] with `isUniversalApi.orElse(null)`. */ fun isUniversalApi(isUniversalApi: Optional) = isUniversalApi(isUniversalApi.getOrNull()) + /** + * Sets [Builder.isUniversalApi] to an arbitrary JSON value. + * + * You should usually call [Builder.isUniversalApi] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun isUniversalApi(isUniversalApi: JsonField) = apply { this.isUniversalApi = isUniversalApi } fun proxyUrl(proxyUrl: String?) = proxyUrl(JsonField.ofNullable(proxyUrl)) + /** Alias for calling [Builder.proxyUrl] with `proxyUrl.orElse(null)`. */ fun proxyUrl(proxyUrl: Optional) = proxyUrl(proxyUrl.getOrNull()) + /** + * Sets [Builder.proxyUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.proxyUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun proxyUrl(proxyUrl: JsonField) = apply { this.proxyUrl = proxyUrl } fun realtimeUrl(realtimeUrl: String?) = realtimeUrl(JsonField.ofNullable(realtimeUrl)) + /** Alias for calling [Builder.realtimeUrl] with `realtimeUrl.orElse(null)`. */ fun realtimeUrl(realtimeUrl: Optional) = realtimeUrl(realtimeUrl.getOrNull()) + /** + * Sets [Builder.realtimeUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.realtimeUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun realtimeUrl(realtimeUrl: JsonField) = apply { this.realtimeUrl = realtimeUrl } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationListParams.kt index d01ebbf0..fae0f2e8 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationListParams.kt @@ -126,13 +126,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -141,37 +135,32 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** @@ -183,13 +172,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationMemberUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationMemberUpdateParams.kt index f75b1abe..350ff674 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationMemberUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationMemberUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -29,13 +30,21 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Users to invite to the organization */ + /** + * Users to invite to the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun inviteUsers(): Optional = body.inviteUsers() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, or in case you want to explicitly assert the * organization you are modifying, you may specify the id of the organization. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgId(): Optional = body.orgId() @@ -43,30 +52,46 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, or in case you want to explicitly assert the * organization you are modifying, you may specify the name of the organization. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Users to remove from the organization */ + /** + * Users to remove from the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun removeUsers(): Optional = body.removeUsers() - /** Users to invite to the organization */ + /** + * Returns the raw JSON value of [inviteUsers]. + * + * Unlike [inviteUsers], this method doesn't throw if the JSON field has an unexpected type. + */ fun _inviteUsers(): JsonField = body._inviteUsers() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, or in case you want to explicitly assert the - * organization you are modifying, you may specify the id of the organization. + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgId(): JsonField = body._orgId() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, or in case you want to explicitly assert the - * organization you are modifying, you may specify the name of the organization. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() - /** Users to remove from the organization */ + /** + * Returns the raw JSON value of [removeUsers]. + * + * Unlike [removeUsers], this method doesn't throw if the JSON field has an unexpected type. + */ fun _removeUsers(): JsonField = body._removeUsers() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -101,7 +126,12 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Users to invite to the organization */ + /** + * Users to invite to the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun inviteUsers(): Optional = Optional.ofNullable(inviteUsers.getNullable("invite_users")) @@ -109,6 +139,9 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, or in case you want to explicitly assert * the organization you are modifying, you may specify the id of the organization. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgId(): Optional = Optional.ofNullable(orgId.getNullable("org_id")) @@ -116,33 +149,49 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, or in case you want to explicitly assert * the organization you are modifying, you may specify the name of the organization. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Users to remove from the organization */ + /** + * Users to remove from the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun removeUsers(): Optional = Optional.ofNullable(removeUsers.getNullable("remove_users")) - /** Users to invite to the organization */ + /** + * Returns the raw JSON value of [inviteUsers]. + * + * Unlike [inviteUsers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("invite_users") @ExcludeMissing fun _inviteUsers(): JsonField = inviteUsers /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly assert - * the organization you are modifying, you may specify the id of the organization. + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly assert - * the organization you are modifying, you may specify the name of the organization. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName - /** Users to remove from the organization */ + /** + * Returns the raw JSON value of [removeUsers]. + * + * Unlike [removeUsers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("remove_users") @ExcludeMissing fun _removeUsers(): JsonField = removeUsers @@ -195,11 +244,17 @@ private constructor( fun inviteUsers(inviteUsers: InviteUsers?) = inviteUsers(JsonField.ofNullable(inviteUsers)) - /** Users to invite to the organization */ + /** Alias for calling [Builder.inviteUsers] with `inviteUsers.orElse(null)`. */ fun inviteUsers(inviteUsers: Optional) = inviteUsers(inviteUsers.getOrNull()) - /** Users to invite to the organization */ + /** + * Sets [Builder.inviteUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteUsers] with a well-typed [InviteUsers] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteUsers(inviteUsers: JsonField) = apply { this.inviteUsers = inviteUsers } @@ -212,19 +267,15 @@ private constructor( */ fun orgId(orgId: String?) = orgId(JsonField.ofNullable(orgId)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly - * assert the organization you are modifying, you may specify the id of the - * organization. - */ + /** Alias for calling [Builder.orgId] with `orgId.orElse(null)`. */ fun orgId(orgId: Optional) = orgId(orgId.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly - * assert the organization you are modifying, you may specify the id of the - * organization. + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } @@ -236,19 +287,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly - * assert the organization you are modifying, you may specify the name of the - * organization. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly - * assert the organization you are modifying, you may specify the name of the - * organization. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -256,11 +303,17 @@ private constructor( fun removeUsers(removeUsers: RemoveUsers?) = removeUsers(JsonField.ofNullable(removeUsers)) - /** Users to remove from the organization */ + /** Alias for calling [Builder.removeUsers] with `removeUsers.orElse(null)`. */ fun removeUsers(removeUsers: Optional) = removeUsers(removeUsers.getOrNull()) - /** Users to remove from the organization */ + /** + * Sets [Builder.removeUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.removeUsers] with a well-typed [RemoveUsers] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun removeUsers(removeUsers: JsonField) = apply { this.removeUsers = removeUsers } @@ -337,10 +390,16 @@ private constructor( /** Users to invite to the organization */ fun inviteUsers(inviteUsers: InviteUsers?) = apply { body.inviteUsers(inviteUsers) } - /** Users to invite to the organization */ + /** Alias for calling [Builder.inviteUsers] with `inviteUsers.orElse(null)`. */ fun inviteUsers(inviteUsers: Optional) = inviteUsers(inviteUsers.getOrNull()) - /** Users to invite to the organization */ + /** + * Sets [Builder.inviteUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.inviteUsers] with a well-typed [InviteUsers] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun inviteUsers(inviteUsers: JsonField) = apply { body.inviteUsers(inviteUsers) } @@ -352,17 +411,14 @@ private constructor( */ fun orgId(orgId: String?) = apply { body.orgId(orgId) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly assert - * the organization you are modifying, you may specify the id of the organization. - */ + /** Alias for calling [Builder.orgId] with `orgId.orElse(null)`. */ fun orgId(orgId: Optional) = orgId(orgId.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly assert - * the organization you are modifying, you may specify the id of the organization. + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgId(orgId: JsonField) = apply { body.orgId(orgId) } @@ -373,27 +429,30 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly assert - * the organization you are modifying, you may specify the name of the organization. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, or in case you want to explicitly assert - * the organization you are modifying, you may specify the name of the organization. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } /** Users to remove from the organization */ fun removeUsers(removeUsers: RemoveUsers?) = apply { body.removeUsers(removeUsers) } - /** Users to remove from the organization */ + /** Alias for calling [Builder.removeUsers] with `removeUsers.orElse(null)`. */ fun removeUsers(removeUsers: Optional) = removeUsers(removeUsers.getOrNull()) - /** Users to remove from the organization */ + /** + * Sets [Builder.removeUsers] to an arbitrary JSON value. + * + * You should usually call [Builder.removeUsers] with a well-typed [RemoveUsers] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun removeUsers(removeUsers: JsonField) = apply { body.removeUsers(removeUsers) } @@ -553,53 +612,117 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Emails of users to invite */ + /** + * Emails of users to invite + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) - /** Singular form of group_ids */ + /** + * Singular form of group_ids + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun groupId(): Optional = Optional.ofNullable(groupId.getNullable("group_id")) - /** Optional list of group ids to add newly-invited users to. */ + /** + * Optional list of group ids to add newly-invited users to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun groupIds(): Optional> = Optional.ofNullable(groupIds.getNullable("group_ids")) - /** Singular form of group_names */ + /** + * Singular form of group_names + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun groupName(): Optional = Optional.ofNullable(groupName.getNullable("group_name")) - /** Optional list of group names to add newly-invited users to. */ + /** + * Optional list of group names to add newly-invited users to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun groupNames(): Optional> = Optional.ofNullable(groupNames.getNullable("group_names")) - /** Ids of existing users to invite */ + /** + * Ids of existing users to invite + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun ids(): Optional> = Optional.ofNullable(ids.getNullable("ids")) - /** If true, send invite emails to the users who wore actually added */ + /** + * If true, send invite emails to the users who wore actually added + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun sendInviteEmails(): Optional = Optional.ofNullable(sendInviteEmails.getNullable("send_invite_emails")) - /** Emails of users to invite */ + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails - /** Singular form of group_ids */ + /** + * Returns the raw JSON value of [groupId]. + * + * Unlike [groupId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("group_id") @ExcludeMissing fun _groupId(): JsonField = groupId - /** Optional list of group ids to add newly-invited users to. */ + /** + * Returns the raw JSON value of [groupIds]. + * + * Unlike [groupIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("group_ids") @ExcludeMissing fun _groupIds(): JsonField> = groupIds - /** Singular form of group_names */ + /** + * Returns the raw JSON value of [groupName]. + * + * Unlike [groupName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("group_name") @ExcludeMissing fun _groupName(): JsonField = groupName - /** Optional list of group names to add newly-invited users to. */ + /** + * Returns the raw JSON value of [groupNames]. + * + * Unlike [groupNames], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("group_names") @ExcludeMissing fun _groupNames(): JsonField> = groupNames - /** Ids of existing users to invite */ + /** + * Returns the raw JSON value of [ids]. + * + * Unlike [ids], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ids") @ExcludeMissing fun _ids(): JsonField> = ids - /** If true, send invite emails to the users who wore actually added */ + /** + * Returns the raw JSON value of [sendInviteEmails]. + * + * Unlike [sendInviteEmails], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("send_invite_emails") @ExcludeMissing fun _sendInviteEmails(): JsonField = sendInviteEmails @@ -660,15 +783,25 @@ private constructor( /** Emails of users to invite */ fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - /** Emails of users to invite */ + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) - /** Emails of users to invite */ + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } } - /** Emails of users to invite */ + /** + * Adds a single [String] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: String) = apply { emails = (emails ?: JsonField.of(mutableListOf())).also { @@ -679,24 +812,40 @@ private constructor( /** Singular form of group_ids */ fun groupId(groupId: String?) = groupId(JsonField.ofNullable(groupId)) - /** Singular form of group_ids */ + /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */ fun groupId(groupId: Optional) = groupId(groupId.getOrNull()) - /** Singular form of group_ids */ + /** + * Sets [Builder.groupId] to an arbitrary JSON value. + * + * You should usually call [Builder.groupId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun groupId(groupId: JsonField) = apply { this.groupId = groupId } /** Optional list of group ids to add newly-invited users to. */ fun groupIds(groupIds: List?) = groupIds(JsonField.ofNullable(groupIds)) - /** Optional list of group ids to add newly-invited users to. */ + /** Alias for calling [Builder.groupIds] with `groupIds.orElse(null)`. */ fun groupIds(groupIds: Optional>) = groupIds(groupIds.getOrNull()) - /** Optional list of group ids to add newly-invited users to. */ + /** + * Sets [Builder.groupIds] to an arbitrary JSON value. + * + * You should usually call [Builder.groupIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun groupIds(groupIds: JsonField>) = apply { this.groupIds = groupIds.map { it.toMutableList() } } - /** Optional list of group ids to add newly-invited users to. */ + /** + * Adds a single [String] to [groupIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addGroupId(groupId: String) = apply { groupIds = (groupIds ?: JsonField.of(mutableListOf())).also { @@ -707,24 +856,40 @@ private constructor( /** Singular form of group_names */ fun groupName(groupName: String?) = groupName(JsonField.ofNullable(groupName)) - /** Singular form of group_names */ + /** Alias for calling [Builder.groupName] with `groupName.orElse(null)`. */ fun groupName(groupName: Optional) = groupName(groupName.getOrNull()) - /** Singular form of group_names */ + /** + * Sets [Builder.groupName] to an arbitrary JSON value. + * + * You should usually call [Builder.groupName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun groupName(groupName: JsonField) = apply { this.groupName = groupName } /** Optional list of group names to add newly-invited users to. */ fun groupNames(groupNames: List?) = groupNames(JsonField.ofNullable(groupNames)) - /** Optional list of group names to add newly-invited users to. */ + /** Alias for calling [Builder.groupNames] with `groupNames.orElse(null)`. */ fun groupNames(groupNames: Optional>) = groupNames(groupNames.getOrNull()) - /** Optional list of group names to add newly-invited users to. */ + /** + * Sets [Builder.groupNames] to an arbitrary JSON value. + * + * You should usually call [Builder.groupNames] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun groupNames(groupNames: JsonField>) = apply { this.groupNames = groupNames.map { it.toMutableList() } } - /** Optional list of group names to add newly-invited users to. */ + /** + * Adds a single [String] to [groupNames]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addGroupName(groupName: String) = apply { groupNames = (groupNames ?: JsonField.of(mutableListOf())).also { @@ -735,15 +900,25 @@ private constructor( /** Ids of existing users to invite */ fun ids(ids: List?) = ids(JsonField.ofNullable(ids)) - /** Ids of existing users to invite */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional>) = ids(ids.getOrNull()) - /** Ids of existing users to invite */ + /** + * Sets [Builder.ids] to an arbitrary JSON value. + * + * You should usually call [Builder.ids] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun ids(ids: JsonField>) = apply { this.ids = ids.map { it.toMutableList() } } - /** Ids of existing users to invite */ + /** + * Adds a single [String] to [ids]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addId(id: String) = apply { ids = (ids ?: JsonField.of(mutableListOf())).also { checkKnown("ids", it).add(id) } } @@ -752,15 +927,27 @@ private constructor( fun sendInviteEmails(sendInviteEmails: Boolean?) = sendInviteEmails(JsonField.ofNullable(sendInviteEmails)) - /** If true, send invite emails to the users who wore actually added */ + /** + * Alias for [Builder.sendInviteEmails]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun sendInviteEmails(sendInviteEmails: Boolean) = sendInviteEmails(sendInviteEmails as Boolean?) - /** If true, send invite emails to the users who wore actually added */ + /** + * Alias for calling [Builder.sendInviteEmails] with `sendInviteEmails.orElse(null)`. + */ fun sendInviteEmails(sendInviteEmails: Optional) = sendInviteEmails(sendInviteEmails.getOrNull()) - /** If true, send invite emails to the users who wore actually added */ + /** + * Sets [Builder.sendInviteEmails] to an arbitrary JSON value. + * + * You should usually call [Builder.sendInviteEmails] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun sendInviteEmails(sendInviteEmails: JsonField) = apply { this.sendInviteEmails = sendInviteEmails } @@ -830,16 +1017,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Emails of users to remove */ + /** + * Emails of users to remove + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) - /** Ids of users to remove */ + /** + * Ids of users to remove + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun ids(): Optional> = Optional.ofNullable(ids.getNullable("ids")) - /** Emails of users to remove */ + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails - /** Ids of users to remove */ + /** + * Returns the raw JSON value of [ids]. + * + * Unlike [ids], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ids") @ExcludeMissing fun _ids(): JsonField> = ids @JsonAnyGetter @@ -883,15 +1088,25 @@ private constructor( /** Emails of users to remove */ fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - /** Emails of users to remove */ + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) - /** Emails of users to remove */ + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } } - /** Emails of users to remove */ + /** + * Adds a single [String] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: String) = apply { emails = (emails ?: JsonField.of(mutableListOf())).also { @@ -902,15 +1117,25 @@ private constructor( /** Ids of users to remove */ fun ids(ids: List?) = ids(JsonField.ofNullable(ids)) - /** Ids of users to remove */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional>) = ids(ids.getOrNull()) - /** Ids of users to remove */ + /** + * Sets [Builder.ids] to an arbitrary JSON value. + * + * You should usually call [Builder.ids] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun ids(ids: JsonField>) = apply { this.ids = ids.map { it.toMutableList() } } - /** Ids of users to remove */ + /** + * Adds a single [String] to [ids]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addId(id: String) = apply { ids = (ids ?: JsonField.of(mutableListOf())).also { checkKnown("ids", it).add(id) } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationUpdateParams.kt index 83efeac1..21c12848 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/OrganizationUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,26 +38,71 @@ private constructor( /** Organization id */ fun organizationId(): String = organizationId + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun apiUrl(): Optional = body.apiUrl() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isUniversalApi(): Optional = body.isUniversalApi() - /** Name of the organization */ + /** + * Name of the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun proxyUrl(): Optional = body.proxyUrl() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun realtimeUrl(): Optional = body.realtimeUrl() + /** + * Returns the raw JSON value of [apiUrl]. + * + * Unlike [apiUrl], this method doesn't throw if the JSON field has an unexpected type. + */ fun _apiUrl(): JsonField = body._apiUrl() + /** + * Returns the raw JSON value of [isUniversalApi]. + * + * Unlike [isUniversalApi], this method doesn't throw if the JSON field has an unexpected type. + */ fun _isUniversalApi(): JsonField = body._isUniversalApi() - /** Name of the organization */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() + /** + * Returns the raw JSON value of [proxyUrl]. + * + * Unlike [proxyUrl], this method doesn't throw if the JSON field has an unexpected type. + */ fun _proxyUrl(): JsonField = body._proxyUrl() + /** + * Returns the raw JSON value of [realtimeUrl]. + * + * Unlike [realtimeUrl], this method doesn't throw if the JSON field has an unexpected type. + */ fun _realtimeUrl(): JsonField = body._realtimeUrl() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -101,30 +147,76 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun apiUrl(): Optional = Optional.ofNullable(apiUrl.getNullable("api_url")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun isUniversalApi(): Optional = Optional.ofNullable(isUniversalApi.getNullable("is_universal_api")) - /** Name of the organization */ + /** + * Name of the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun proxyUrl(): Optional = Optional.ofNullable(proxyUrl.getNullable("proxy_url")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun realtimeUrl(): Optional = Optional.ofNullable(realtimeUrl.getNullable("realtime_url")) + /** + * Returns the raw JSON value of [apiUrl]. + * + * Unlike [apiUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("api_url") @ExcludeMissing fun _apiUrl(): JsonField = apiUrl + /** + * Returns the raw JSON value of [isUniversalApi]. + * + * Unlike [isUniversalApi], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("is_universal_api") @ExcludeMissing fun _isUniversalApi(): JsonField = isUniversalApi - /** Name of the organization */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [proxyUrl]. + * + * Unlike [proxyUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("proxy_url") @ExcludeMissing fun _proxyUrl(): JsonField = proxyUrl + /** + * Returns the raw JSON value of [realtimeUrl]. + * + * Unlike [realtimeUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("realtime_url") @ExcludeMissing fun _realtimeUrl(): JsonField = realtimeUrl @@ -178,18 +270,39 @@ private constructor( fun apiUrl(apiUrl: String?) = apiUrl(JsonField.ofNullable(apiUrl)) + /** Alias for calling [Builder.apiUrl] with `apiUrl.orElse(null)`. */ fun apiUrl(apiUrl: Optional) = apiUrl(apiUrl.getOrNull()) + /** + * Sets [Builder.apiUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun apiUrl(apiUrl: JsonField) = apply { this.apiUrl = apiUrl } fun isUniversalApi(isUniversalApi: Boolean?) = isUniversalApi(JsonField.ofNullable(isUniversalApi)) + /** + * Alias for [Builder.isUniversalApi]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isUniversalApi(isUniversalApi: Boolean) = isUniversalApi(isUniversalApi as Boolean?) + /** Alias for calling [Builder.isUniversalApi] with `isUniversalApi.orElse(null)`. */ fun isUniversalApi(isUniversalApi: Optional) = isUniversalApi(isUniversalApi.getOrNull()) + /** + * Sets [Builder.isUniversalApi] to an arbitrary JSON value. + * + * You should usually call [Builder.isUniversalApi] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun isUniversalApi(isUniversalApi: JsonField) = apply { this.isUniversalApi = isUniversalApi } @@ -197,22 +310,44 @@ private constructor( /** Name of the organization */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the organization */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the organization */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun proxyUrl(proxyUrl: String?) = proxyUrl(JsonField.ofNullable(proxyUrl)) + /** Alias for calling [Builder.proxyUrl] with `proxyUrl.orElse(null)`. */ fun proxyUrl(proxyUrl: Optional) = proxyUrl(proxyUrl.getOrNull()) + /** + * Sets [Builder.proxyUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.proxyUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun proxyUrl(proxyUrl: JsonField) = apply { this.proxyUrl = proxyUrl } fun realtimeUrl(realtimeUrl: String?) = realtimeUrl(JsonField.ofNullable(realtimeUrl)) + /** Alias for calling [Builder.realtimeUrl] with `realtimeUrl.orElse(null)`. */ fun realtimeUrl(realtimeUrl: Optional) = realtimeUrl(realtimeUrl.getOrNull()) + /** + * Sets [Builder.realtimeUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.realtimeUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun realtimeUrl(realtimeUrl: JsonField) = apply { this.realtimeUrl = realtimeUrl } @@ -302,17 +437,37 @@ private constructor( fun apiUrl(apiUrl: String?) = apply { body.apiUrl(apiUrl) } + /** Alias for calling [Builder.apiUrl] with `apiUrl.orElse(null)`. */ fun apiUrl(apiUrl: Optional) = apiUrl(apiUrl.getOrNull()) + /** + * Sets [Builder.apiUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.apiUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun apiUrl(apiUrl: JsonField) = apply { body.apiUrl(apiUrl) } fun isUniversalApi(isUniversalApi: Boolean?) = apply { body.isUniversalApi(isUniversalApi) } + /** + * Alias for [Builder.isUniversalApi]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isUniversalApi(isUniversalApi: Boolean) = isUniversalApi(isUniversalApi as Boolean?) + /** Alias for calling [Builder.isUniversalApi] with `isUniversalApi.orElse(null)`. */ fun isUniversalApi(isUniversalApi: Optional) = isUniversalApi(isUniversalApi.getOrNull()) + /** + * Sets [Builder.isUniversalApi] to an arbitrary JSON value. + * + * You should usually call [Builder.isUniversalApi] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun isUniversalApi(isUniversalApi: JsonField) = apply { body.isUniversalApi(isUniversalApi) } @@ -320,22 +475,42 @@ private constructor( /** Name of the organization */ fun name(name: String?) = apply { body.name(name) } - /** Name of the organization */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the organization */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } fun proxyUrl(proxyUrl: String?) = apply { body.proxyUrl(proxyUrl) } + /** Alias for calling [Builder.proxyUrl] with `proxyUrl.orElse(null)`. */ fun proxyUrl(proxyUrl: Optional) = proxyUrl(proxyUrl.getOrNull()) + /** + * Sets [Builder.proxyUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.proxyUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun proxyUrl(proxyUrl: JsonField) = apply { body.proxyUrl(proxyUrl) } fun realtimeUrl(realtimeUrl: String?) = apply { body.realtimeUrl(realtimeUrl) } + /** Alias for calling [Builder.realtimeUrl] with `realtimeUrl.orElse(null)`. */ fun realtimeUrl(realtimeUrl: Optional) = realtimeUrl(realtimeUrl.getOrNull()) + /** + * Sets [Builder.realtimeUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.realtimeUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun realtimeUrl(realtimeUrl: JsonField) = apply { body.realtimeUrl(realtimeUrl) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PatchOrganizationMembersOutput.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PatchOrganizationMembersOutput.kt index c1bb28cb..b93608b6 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PatchOrganizationMembersOutput.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PatchOrganizationMembersOutput.kt @@ -34,26 +34,48 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the org that was modified. */ + /** + * The id of the org that was modified. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun orgId(): String = orgId.getRequired("org_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") /** * If invite emails failed to send for some reason, the patch operation will still complete, but * we will return an error message here + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun sendEmailError(): Optional = Optional.ofNullable(sendEmailError.getNullable("send_email_error")) - /** The id of the org that was modified. */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** - * If invite emails failed to send for some reason, the patch operation will still complete, but - * we will return an error message here + * Returns the raw JSON value of [sendEmailError]. + * + * Unlike [sendEmailError], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("send_email_error") @ExcludeMissing @@ -113,11 +135,22 @@ private constructor( /** The id of the org that was modified. */ fun orgId(orgId: String) = orgId(JsonField.of(orgId)) - /** The id of the org that was modified. */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** @@ -127,16 +160,16 @@ private constructor( fun sendEmailError(sendEmailError: String?) = sendEmailError(JsonField.ofNullable(sendEmailError)) - /** - * If invite emails failed to send for some reason, the patch operation will still complete, - * but we will return an error message here - */ + /** Alias for calling [Builder.sendEmailError] with `sendEmailError.orElse(null)`. */ fun sendEmailError(sendEmailError: Optional) = sendEmailError(sendEmailError.getOrNull()) /** - * If invite emails failed to send for some reason, the patch operation will still complete, - * but we will return an error message here + * Sets [Builder.sendEmailError] to an arbitrary JSON value. + * + * You should usually call [Builder.sendEmailError] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun sendEmailError(sendEmailError: JsonField) = apply { this.sendEmailError = sendEmailError diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt index 8da4413e..4c402f51 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -41,48 +42,111 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the project */ + /** + * Unique identifier for the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the project */ + /** + * Name of the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique id for the organization that the project belongs under */ + /** + * Unique id for the organization that the project belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun orgId(): String = orgId.getRequired("org_id") - /** Date of project creation */ + /** + * Date of project creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date of project deletion, or null if the project is still active */ + /** + * Date of project deletion, or null if the project is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun settings(): Optional = Optional.ofNullable(settings.getNullable("settings")) - /** Identifies the user who created the project */ + /** + * Identifies the user who created the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the project */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the project */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique id for the organization that the project belongs under */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Date of project creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date of project deletion, or null if the project is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt + /** + * Returns the raw JSON value of [settings]. + * + * Unlike [settings], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("settings") @ExcludeMissing fun _settings(): JsonField = settings - /** Identifies the user who created the project */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -150,52 +214,92 @@ private constructor( /** Unique identifier for the project */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the project */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the project */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique id for the organization that the project belongs under */ fun orgId(orgId: String) = orgId(JsonField.of(orgId)) - /** Unique id for the organization that the project belongs under */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Date of project creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of project creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of project creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date of project deletion, or null if the project is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of project deletion, or null if the project is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of project deletion, or null if the project is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } fun settings(settings: ProjectSettings?) = settings(JsonField.ofNullable(settings)) + /** Alias for calling [Builder.settings] with `settings.orElse(null)`. */ fun settings(settings: Optional) = settings(settings.getOrNull()) + /** + * Sets [Builder.settings] to an arbitrary JSON value. + * + * You should usually call [Builder.settings] with a well-typed [ProjectSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun settings(settings: JsonField) = apply { this.settings = settings } /** Identifies the user who created the project */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the project */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the project */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectCreateParams.kt index 6d92a603..7a08ff1b 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,23 +33,35 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the project */ + /** + * Name of the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() /** * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * project belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the project */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * project belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -78,23 +91,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the project */ + /** + * Name of the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the project belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the project */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the project belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -146,7 +171,13 @@ private constructor( /** Name of the project */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -156,17 +187,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the project belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the project belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -244,7 +273,12 @@ private constructor( /** Name of the project */ fun name(name: String) = apply { body.name(name) } - /** Name of the project */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -254,17 +288,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the project belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the project belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListParams.kt index c011f50b..e28ba4aa 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListParams.kt @@ -133,13 +133,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -148,43 +142,38 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** @@ -196,13 +185,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFeedbackParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFeedbackParams.kt index ea2b6b82..2ca20280 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFeedbackParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFeedbackParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,10 +33,19 @@ private constructor( /** Project id */ fun projectId(): String = projectId - /** A list of project logs feedback items */ + /** + * A list of project logs feedback items + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun feedback(): List = body.feedback() - /** A list of project logs feedback items */ + /** + * Returns the raw JSON value of [feedback]. + * + * Unlike [feedback], this method doesn't throw if the JSON field has an unexpected type. + */ fun _feedback(): JsonField> = body._feedback() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,10 +78,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of project logs feedback items */ + /** + * A list of project logs feedback items + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun feedback(): List = feedback.getRequired("feedback") - /** A list of project logs feedback items */ + /** + * Returns the raw JSON value of [feedback]. + * + * Unlike [feedback], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("feedback") @ExcludeMissing fun _feedback(): JsonField> = feedback @@ -121,12 +140,22 @@ private constructor( /** A list of project logs feedback items */ fun feedback(feedback: List) = feedback(JsonField.of(feedback)) - /** A list of project logs feedback items */ + /** + * Sets [Builder.feedback] to an arbitrary JSON value. + * + * You should usually call [Builder.feedback] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun feedback(feedback: JsonField>) = apply { this.feedback = feedback.map { it.toMutableList() } } - /** A list of project logs feedback items */ + /** + * Adds a single [FeedbackProjectLogsItem] to [Builder.feedback]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeedback(feedback: FeedbackProjectLogsItem) = apply { this.feedback = (this.feedback ?: JsonField.of(mutableListOf())).also { @@ -217,12 +246,22 @@ private constructor( /** A list of project logs feedback items */ fun feedback(feedback: List) = apply { body.feedback(feedback) } - /** A list of project logs feedback items */ + /** + * Sets [Builder.feedback] to an arbitrary JSON value. + * + * You should usually call [Builder.feedback] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun feedback(feedback: JsonField>) = apply { body.feedback(feedback) } - /** A list of project logs feedback items */ + /** + * Adds a single [FeedbackProjectLogsItem] to [Builder.feedback]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFeedback(feedback: FeedbackProjectLogsItem) = apply { body.addFeedback(feedback) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchParams.kt index 1d82f560..5d240328 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchParams.kt @@ -164,37 +164,13 @@ private constructor( fun limit(limit: Long?) = apply { this.limit = limit } /** - * limit the number of traces fetched + * Alias for [Builder.limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** @@ -211,18 +187,7 @@ private constructor( */ fun maxRootSpanId(maxRootSpanId: String?) = apply { this.maxRootSpanId = maxRootSpanId } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) @@ -240,18 +205,7 @@ private constructor( */ fun maxXactId(maxXactId: String?) = apply { this.maxXactId = maxXactId } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** @@ -262,12 +216,7 @@ private constructor( */ fun version(version: String?) = apply { this.version = version } - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchPostParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchPostParams.kt index 4eb11877..bb400c64 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchPostParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogFetchPostParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -42,6 +43,9 @@ private constructor( * earliest. * * The string can be obtained directly from the `cursor` property of the previous fetch query + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun cursor(): Optional = body.cursor() @@ -58,6 +62,9 @@ private constructor( * * The `limit` parameter controls the number of full traces to return. So you may end up with * more individual rows than the specified limit if you are fetching events containing traces. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun limit(): Optional = body.limit() @@ -72,6 +79,9 @@ private constructor( * for the next page can be found as the row with the minimum (earliest) value of the tuple * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating * fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxRootSpanId(): Optional = body.maxRootSpanId() @@ -86,6 +96,9 @@ private constructor( * for the next page can be found as the row with the minimum (earliest) value of the tuple * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating * fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun maxXactId(): Optional = body.maxXactId() @@ -94,66 +107,44 @@ private constructor( * * The version id is essentially a filter on the latest event transaction id. You can use the * `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun version(): Optional = body.version() /** - * An opaque string to be used as a cursor for the next page of results, in order from latest to - * earliest. + * Returns the raw JSON value of [cursor]. * - * The string can be obtained directly from the `cursor` property of the previous fetch query + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ fun _cursor(): JsonField = body._cursor() /** - * limit the number of traces fetched + * Returns the raw JSON value of [limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later - * pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. - * This happens because pagination occurs over the whole version history of the event log. You - * will most likely want to exclude any such duplicate, outdated rows (by `id`) from your - * combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up with - * more individual rows than the specified limit if you are fetching events containing traces. + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. */ fun _limit(): JsonField = body._limit() /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the - * explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument - * going forwards. + * Returns the raw JSON value of [maxRootSpanId]. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the cursor - * for the next page can be found as the row with the minimum (earliest) value of the tuple - * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating - * fetch queries. + * Unlike [maxRootSpanId], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxRootSpanId(): JsonField = body._maxRootSpanId() /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the - * explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument - * going forwards. + * Returns the raw JSON value of [maxXactId]. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the cursor - * for the next page can be found as the row with the minimum (earliest) value of the tuple - * `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating - * fetch queries. + * Unlike [maxXactId], this method doesn't throw if the JSON field has an unexpected type. */ fun _maxXactId(): JsonField = body._maxXactId() /** - * Retrieve a snapshot of events from a past time + * Returns the raw JSON value of [version]. * - * The version id is essentially a filter on the latest event transaction id. You can use the - * `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. */ fun _version(): JsonField = body._version() @@ -205,6 +196,9 @@ private constructor( * * The string can be obtained directly from the `cursor` property of the previous fetch * query + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun cursor(): Optional = Optional.ofNullable(cursor.getNullable("cursor")) @@ -222,6 +216,9 @@ private constructor( * The `limit` parameter controls the number of full traces to return. So you may end up * with more individual rows than the specified limit if you are fetching events containing * traces. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun limit(): Optional = Optional.ofNullable(limit.getNullable("limit")) @@ -236,6 +233,9 @@ private constructor( * cursor for the next page can be found as the row with the minimum (earliest) value of the * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of * paginating fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxRootSpanId(): Optional = Optional.ofNullable(maxRootSpanId.getNullable("max_root_span_id")) @@ -251,6 +251,9 @@ private constructor( * cursor for the next page can be found as the row with the minimum (earliest) value of the * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of * paginating fetch queries. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun maxXactId(): Optional = Optional.ofNullable(maxXactId.getNullable("max_xact_id")) @@ -260,70 +263,47 @@ private constructor( * * The version id is essentially a filter on the latest event transaction id. You can use * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun version(): Optional = Optional.ofNullable(version.getNullable("version")) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Returns the raw JSON value of [cursor]. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * Unlike [cursor], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("cursor") @ExcludeMissing fun _cursor(): JsonField = cursor /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. + * Returns the raw JSON value of [limit]. * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Returns the raw JSON value of [maxRootSpanId]. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * Unlike [maxRootSpanId], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("max_root_span_id") @ExcludeMissing fun _maxRootSpanId(): JsonField = maxRootSpanId /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Returns the raw JSON value of [maxXactId]. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * Unlike [maxXactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("max_xact_id") @ExcludeMissing fun _maxXactId(): JsonField = maxXactId /** - * Retrieve a snapshot of events from a past time + * Returns the raw JSON value of [version]. * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version @@ -383,21 +363,15 @@ private constructor( */ fun cursor(cursor: String?) = cursor(JsonField.ofNullable(cursor)) - /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. - * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Sets [Builder.cursor] to an arbitrary JSON value. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * You should usually call [Builder.cursor] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun cursor(cursor: JsonField) = apply { this.cursor = cursor } @@ -419,53 +393,21 @@ private constructor( fun limit(limit: Long?) = limit(JsonField.ofNullable(limit)) /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. + * Alias for [Builder.limit]. * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** - * limit the number of traces fetched + * Sets [Builder.limit] to an arbitrary JSON value. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of - * the event log. You will most likely want to exclude any such duplicate, outdated rows - * (by `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events - * containing traces. + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun limit(limit: JsonField) = apply { this.limit = limit } @@ -484,32 +426,16 @@ private constructor( fun maxRootSpanId(maxRootSpanId: String?) = maxRootSpanId(JsonField.ofNullable(maxRootSpanId)) - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. + * Sets [Builder.maxRootSpanId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. + * You should usually call [Builder.maxRootSpanId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxRootSpanId(maxRootSpanId: JsonField) = apply { this.maxRootSpanId = maxRootSpanId @@ -529,31 +455,15 @@ private constructor( */ fun maxXactId(maxXactId: String?) = maxXactId(JsonField.ofNullable(maxXactId)) - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor - * of the explicit 'cursor' returned by object fetch requests. Please prefer the - * 'cursor' argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor + * Sets [Builder.maxXactId] to an arbitrary JSON value. * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of - * the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an - * overview of paginating fetch queries. + * You should usually call [Builder.maxXactId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun maxXactId(maxXactId: JsonField) = apply { this.maxXactId = maxXactId } @@ -566,21 +476,15 @@ private constructor( */ fun version(version: String?) = version(JsonField.ofNullable(version)) - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can - * use the `max_xact_id` returned by a past fetch as the version to reproduce that exact - * fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) /** - * Retrieve a snapshot of events from a past time + * Sets [Builder.version] to an arbitrary JSON value. * - * The version id is essentially a filter on the latest event transaction id. You can - * use the `max_xact_id` returned by a past fetch as the version to reproduce that exact - * fetch. + * You should usually call [Builder.version] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun version(version: JsonField) = apply { this.version = version } @@ -676,21 +580,14 @@ private constructor( */ fun cursor(cursor: String?) = apply { body.cursor(cursor) } - /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. - * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query - */ + /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) /** - * An opaque string to be used as a cursor for the next page of results, in order from - * latest to earliest. + * Sets [Builder.cursor] to an arbitrary JSON value. * - * The string can be obtained directly from the `cursor` property of the previous fetch - * query + * You should usually call [Builder.cursor] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun cursor(cursor: JsonField) = apply { body.cursor(cursor) } @@ -712,53 +609,20 @@ private constructor( fun limit(limit: Long?) = apply { body.limit(limit) } /** - * limit the number of traces fetched + * Alias for [Builder.limit]. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * This unboxed primitive overload exists for backwards compatibility. */ fun limit(limit: Long) = limit(limit as Long?) - /** - * limit the number of traces fetched - * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. - */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** - * limit the number of traces fetched + * Sets [Builder.limit] to an arbitrary JSON value. * - * Fetch queries may be paginated if the total result size is expected to be large (e.g. - * project_logs which accumulate over a long time). Note that fetch queries only support - * pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, - * later pages may return rows which showed up in earlier pages, except with an earlier - * `_xact_id`. This happens because pagination occurs over the whole version history of the - * event log. You will most likely want to exclude any such duplicate, outdated rows (by - * `id`) from your combined result set. - * - * The `limit` parameter controls the number of full traces to return. So you may end up - * with more individual rows than the specified limit if you are fetching events containing - * traces. + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun limit(limit: JsonField) = apply { body.limit(limit) } @@ -776,32 +640,16 @@ private constructor( */ fun maxRootSpanId(maxRootSpanId: String?) = apply { body.maxRootSpanId(maxRootSpanId) } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxRootSpanId] with `maxRootSpanId.orElse(null)`. */ fun maxRootSpanId(maxRootSpanId: Optional) = maxRootSpanId(maxRootSpanId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. + * Sets [Builder.maxRootSpanId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * You should usually call [Builder.maxRootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun maxRootSpanId(maxRootSpanId: JsonField) = apply { body.maxRootSpanId(maxRootSpanId) @@ -821,31 +669,15 @@ private constructor( */ fun maxXactId(maxXactId: String?) = apply { body.maxXactId(maxXactId) } - /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. - * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. - */ + /** Alias for calling [Builder.maxXactId] with `maxXactId.orElse(null)`. */ fun maxXactId(maxXactId: Optional) = maxXactId(maxXactId.getOrNull()) /** - * DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of - * the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' - * argument going forwards. + * Sets [Builder.maxXactId] to an arbitrary JSON value. * - * Together, `max_xact_id` and `max_root_span_id` form a pagination cursor - * - * Since a paginated fetch query returns results in order from latest to earliest, the - * cursor for the next page can be found as the row with the minimum (earliest) value of the - * tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of - * paginating fetch queries. + * You should usually call [Builder.maxXactId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun maxXactId(maxXactId: JsonField) = apply { body.maxXactId(maxXactId) } @@ -857,19 +689,14 @@ private constructor( */ fun version(version: String?) = apply { body.version(version) } - /** - * Retrieve a snapshot of events from a past time - * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) /** - * Retrieve a snapshot of events from a past time + * Sets [Builder.version] to an arbitrary JSON value. * - * The version id is essentially a filter on the latest event transaction id. You can use - * the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch. + * You should usually call [Builder.version] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun version(version: JsonField) = apply { body.version(version) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogInsertParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogInsertParams.kt index 00032977..040efe5b 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogInsertParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogInsertParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,10 +33,19 @@ private constructor( /** Project id */ fun projectId(): String = projectId - /** A list of project logs events to insert */ + /** + * A list of project logs events to insert + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = body.events() - /** A list of project logs events to insert */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ fun _events(): JsonField> = body._events() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,10 +78,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of project logs events to insert */ + /** + * A list of project logs events to insert + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun events(): List = events.getRequired("events") - /** A list of project logs events to insert */ + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events @@ -121,12 +140,22 @@ private constructor( /** A list of project logs events to insert */ fun events(events: List) = events(JsonField.of(events)) - /** A list of project logs events to insert */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun events(events: JsonField>) = apply { this.events = events.map { it.toMutableList() } } - /** A list of project logs events to insert */ + /** + * Adds a single [InsertProjectLogsEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: InsertProjectLogsEvent) = apply { events = (events ?: JsonField.of(mutableListOf())).also { @@ -216,10 +245,20 @@ private constructor( /** A list of project logs events to insert */ fun events(events: List) = apply { body.events(events) } - /** A list of project logs events to insert */ + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun events(events: JsonField>) = apply { body.events(events) } - /** A list of project logs events to insert */ + /** + * Adds a single [InsertProjectLogsEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEvent(event: InsertProjectLogsEvent) = apply { body.addEvent(event) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogsEvent.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogsEvent.kt index 760777fa..c45131c8 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogsEvent.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectLogsEvent.kt @@ -81,6 +81,9 @@ private constructor( /** * A unique identifier for the project logs event. If you don't provide one, BrainTrust will * generate one for you + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun id(): String = id.getRequired("id") @@ -88,28 +91,59 @@ private constructor( * The transaction id of an event is unique to the network operation that processed the event * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve * a versioned snapshot of the project logs (see the `version` parameter) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun _xactId(): String = _xactId.getRequired("_xact_id") - /** The timestamp the project logs event was created */ + /** + * The timestamp the project logs event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun created(): OffsetDateTime = created.getRequired("created") - /** A literal 'g' which identifies the log as a project log */ + /** + * A literal 'g' which identifies the log as a project log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun logId(): LogId = logId.getRequired("log_id") - /** Unique id for the organization that the project belongs under */ + /** + * Unique id for the organization that the project belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun orgId(): String = orgId.getRequired("org_id") - /** Unique identifier for the project */ + /** + * Unique identifier for the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** A unique identifier for the trace this project logs event belongs to */ + /** + * A unique identifier for the trace this project logs event belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun rootSpanId(): String = rootSpanId.getRequired("root_span_id") /** * A unique identifier used to link different project logs events together as part of a full * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full * details on tracing + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun spanId(): String = spanId.getRequired("span_id") @@ -117,6 +151,9 @@ private constructor( * Context is additional information about the code that produced the project logs event. It is * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the * location in code which produced the project logs event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun context(): Optional = Optional.ofNullable(context.getNullable("context")) @@ -136,7 +173,12 @@ private constructor( /** The arguments that uniquely define a user input (an arbitrary, JSON serializable object). */ @JsonProperty("input") @ExcludeMissing fun _input(): JsonValue = input - /** Whether this span is a root span */ + /** + * Whether this span is a root span + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isRoot(): Optional = Optional.ofNullable(isRoot.getNullable("is_root")) /** @@ -145,6 +187,9 @@ private constructor( * example, you could log the `prompt`, example's `id`, or anything else that would be useful to * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys * must be strings + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) @@ -152,10 +197,18 @@ private constructor( * Metrics are numerical measurements tracking the execution of the code that produced the * project logs event. Use "start" and "end" to track the time span over which the project logs * event was produced + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun metrics(): Optional = Optional.ofNullable(metrics.getNullable("metrics")) - /** Indicates the event was copied from another object. */ + /** + * Indicates the event was copied from another object. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) /** @@ -175,112 +228,160 @@ private constructor( * generated and grouth truth summary. The word similarity score could help you determine * whether the summarization was covering similar concepts or not. You can use these scores to * help you sort, filter, and compare logs. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Human-identifying attributes of the span, such as name, type, etc. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun spanAttributes(): Optional = Optional.ofNullable(spanAttributes.getNullable("span_attributes")) /** * An array of the parent `span_ids` of this project logs event. This should be empty for the * root span of a trace, and should most often contain just one parent element for subspans + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun spanParents(): Optional> = Optional.ofNullable(spanParents.getNullable("span_parents")) - /** A list of tags to log */ + /** + * A list of tags to log + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) /** - * A unique identifier for the project logs event. If you don't provide one, BrainTrust will - * generate one for you + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The transaction id of an event is unique to the network operation that processed the event - * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve - * a versioned snapshot of the project logs (see the `version` parameter) + * Returns the raw JSON value of [_xactId]. + * + * Unlike [_xactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_xact_id") @ExcludeMissing fun __xactId(): JsonField = _xactId - /** The timestamp the project logs event was created */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** A literal 'g' which identifies the log as a project log */ + /** + * Returns the raw JSON value of [logId]. + * + * Unlike [logId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("log_id") @ExcludeMissing fun _logId(): JsonField = logId - /** Unique id for the organization that the project belongs under */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Unique identifier for the project */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** A unique identifier for the trace this project logs event belongs to */ + /** + * Returns the raw JSON value of [rootSpanId]. + * + * Unlike [rootSpanId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId(): JsonField = rootSpanId /** - * A unique identifier used to link different project logs events together as part of a full - * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full - * details on tracing + * Returns the raw JSON value of [spanId]. + * + * Unlike [spanId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_id") @ExcludeMissing fun _spanId(): JsonField = spanId /** - * Context is additional information about the code that produced the project logs event. It is - * essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the - * location in code which produced the project logs event + * Returns the raw JSON value of [context]. + * + * Unlike [context], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("context") @ExcludeMissing fun _context(): JsonField = context - /** Whether this span is a root span */ + /** + * Returns the raw JSON value of [isRoot]. + * + * Unlike [isRoot], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_root") @ExcludeMissing fun _isRoot(): JsonField = isRoot /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. For - * example, you could log the `prompt`, example's `id`, or anything else that would be useful to - * slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys - * must be strings + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * project logs event. Use "start" and "end" to track the time span over which the project logs - * event was produced + * Returns the raw JSON value of [metrics]. + * + * Unlike [metrics], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("metrics") @ExcludeMissing fun _metrics(): JsonField = metrics - /** Indicates the event was copied from another object. */ + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety - * of signals that help you determine how accurate the outputs are compared to what you expect - * and diagnose failures. For example, a summarization app might have one score that tells you - * how accurate the summary is, and another that measures the word similarity between the - * generated and grouth truth summary. The word similarity score could help you determine - * whether the summarization was covering similar concepts or not. You can use these scores to - * help you sort, filter, and compare logs. + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Returns the raw JSON value of [spanAttributes]. + * + * Unlike [spanAttributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("span_attributes") @ExcludeMissing fun _spanAttributes(): JsonField = spanAttributes /** - * An array of the parent `span_ids` of this project logs event. This should be empty for the - * root span of a trace, and should most often contain just one parent element for subspans + * Returns the raw JSON value of [spanParents]. + * + * Unlike [spanParents], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("span_parents") @ExcludeMissing fun _spanParents(): JsonField> = spanParents - /** A list of tags to log */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -395,8 +496,10 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) /** - * A unique identifier for the project logs event. If you don't provide one, BrainTrust will - * generate one for you + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun id(id: JsonField) = apply { this.id = id } @@ -408,40 +511,69 @@ private constructor( fun _xactId(_xactId: String) = _xactId(JsonField.of(_xactId)) /** - * The transaction id of an event is unique to the network operation that processed the - * event insertion. Transaction ids are monotonically increasing over time and can be used - * to retrieve a versioned snapshot of the project logs (see the `version` parameter) + * Sets [Builder._xactId] to an arbitrary JSON value. + * + * You should usually call [Builder._xactId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun _xactId(_xactId: JsonField) = apply { this._xactId = _xactId } /** The timestamp the project logs event was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) - /** The timestamp the project logs event was created */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** A literal 'g' which identifies the log as a project log */ fun logId(logId: LogId) = logId(JsonField.of(logId)) - /** A literal 'g' which identifies the log as a project log */ + /** + * Sets [Builder.logId] to an arbitrary JSON value. + * + * You should usually call [Builder.logId] with a well-typed [LogId] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun logId(logId: JsonField) = apply { this.logId = logId } /** Unique id for the organization that the project belongs under */ fun orgId(orgId: String) = orgId(JsonField.of(orgId)) - /** Unique id for the organization that the project belongs under */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Unique identifier for the project */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** A unique identifier for the trace this project logs event belongs to */ fun rootSpanId(rootSpanId: String) = rootSpanId(JsonField.of(rootSpanId)) - /** A unique identifier for the trace this project logs event belongs to */ + /** + * Sets [Builder.rootSpanId] to an arbitrary JSON value. + * + * You should usually call [Builder.rootSpanId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun rootSpanId(rootSpanId: JsonField) = apply { this.rootSpanId = rootSpanId } /** @@ -452,9 +584,10 @@ private constructor( fun spanId(spanId: String) = spanId(JsonField.of(spanId)) /** - * A unique identifier used to link different project logs events together as part of a full - * trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full - * details on tracing + * Sets [Builder.spanId] to an arbitrary JSON value. + * + * You should usually call [Builder.spanId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun spanId(spanId: JsonField) = apply { this.spanId = spanId } @@ -465,17 +598,14 @@ private constructor( */ fun context(context: Context?) = context(JsonField.ofNullable(context)) - /** - * Context is additional information about the code that produced the project logs event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the project logs event - */ + /** Alias for calling [Builder.context] with `context.orElse(null)`. */ fun context(context: Optional) = context(context.getOrNull()) /** - * Context is additional information about the code that produced the project logs event. It - * is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to - * track the location in code which produced the project logs event + * Sets [Builder.context] to an arbitrary JSON value. + * + * You should usually call [Builder.context] with a well-typed [Context] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun context(context: JsonField) = apply { this.context = context } @@ -500,13 +630,22 @@ private constructor( /** Whether this span is a root span */ fun isRoot(isRoot: Boolean?) = isRoot(JsonField.ofNullable(isRoot)) - /** Whether this span is a root span */ + /** + * Alias for [Builder.isRoot]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isRoot(isRoot: Boolean) = isRoot(isRoot as Boolean?) - /** Whether this span is a root span */ + /** Alias for calling [Builder.isRoot] with `isRoot.orElse(null)`. */ fun isRoot(isRoot: Optional) = isRoot(isRoot.getOrNull()) - /** Whether this span is a root span */ + /** + * Sets [Builder.isRoot] to an arbitrary JSON value. + * + * You should usually call [Builder.isRoot] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun isRoot(isRoot: JsonField) = apply { this.isRoot = isRoot } /** @@ -518,21 +657,15 @@ private constructor( */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings - */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** - * A dictionary with additional data about the test example, model outputs, or just about - * anything else that's relevant, that you can use to help find and analyze examples later. - * For example, you could log the `prompt`, example's `id`, or anything else that would be - * useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, - * but its keys must be strings + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } @@ -543,27 +676,30 @@ private constructor( */ fun metrics(metrics: Metrics?) = metrics(JsonField.ofNullable(metrics)) - /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * project logs event. Use "start" and "end" to track the time span over which the project - * logs event was produced - */ + /** Alias for calling [Builder.metrics] with `metrics.orElse(null)`. */ fun metrics(metrics: Optional) = metrics(metrics.getOrNull()) /** - * Metrics are numerical measurements tracking the execution of the code that produced the - * project logs event. Use "start" and "end" to track the time span over which the project - * logs event was produced + * Sets [Builder.metrics] to an arbitrary JSON value. + * + * You should usually call [Builder.metrics] with a well-typed [Metrics] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun metrics(metrics: JsonField) = apply { this.metrics = metrics } /** Indicates the event was copied from another object. */ fun origin(origin: ObjectReference?) = origin(JsonField.ofNullable(origin)) - /** Indicates the event was copied from another object. */ + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) - /** Indicates the event was copied from another object. */ + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [ObjectReference] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } /** @@ -586,25 +722,14 @@ private constructor( */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare logs. - */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) /** - * A dictionary of numeric values (between 0 and 1) to log. The scores should give you a - * variety of signals that help you determine how accurate the outputs are compared to what - * you expect and diagnose failures. For example, a summarization app might have one score - * that tells you how accurate the summary is, and another that measures the word similarity - * between the generated and grouth truth summary. The word similarity score could help you - * determine whether the summarization was covering similar concepts or not. You can use - * these scores to help you sort, filter, and compare logs. + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun scores(scores: JsonField) = apply { this.scores = scores } @@ -612,11 +737,17 @@ private constructor( fun spanAttributes(spanAttributes: SpanAttributes?) = spanAttributes(JsonField.ofNullable(spanAttributes)) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** Alias for calling [Builder.spanAttributes] with `spanAttributes.orElse(null)`. */ fun spanAttributes(spanAttributes: Optional) = spanAttributes(spanAttributes.getOrNull()) - /** Human-identifying attributes of the span, such as name, type, etc. */ + /** + * Sets [Builder.spanAttributes] to an arbitrary JSON value. + * + * You should usually call [Builder.spanAttributes] with a well-typed [SpanAttributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun spanAttributes(spanAttributes: JsonField) = apply { this.spanAttributes = spanAttributes } @@ -628,26 +759,24 @@ private constructor( */ fun spanParents(spanParents: List?) = spanParents(JsonField.ofNullable(spanParents)) - /** - * An array of the parent `span_ids` of this project logs event. This should be empty for - * the root span of a trace, and should most often contain just one parent element for - * subspans - */ + /** Alias for calling [Builder.spanParents] with `spanParents.orElse(null)`. */ fun spanParents(spanParents: Optional>) = spanParents(spanParents.getOrNull()) /** - * An array of the parent `span_ids` of this project logs event. This should be empty for - * the root span of a trace, and should most often contain just one parent element for - * subspans + * Sets [Builder.spanParents] to an arbitrary JSON value. + * + * You should usually call [Builder.spanParents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun spanParents(spanParents: JsonField>) = apply { this.spanParents = spanParents.map { it.toMutableList() } } /** - * An array of the parent `span_ids` of this project logs event. This should be empty for - * the root span of a trace, and should most often contain just one parent element for - * subspans + * Adds a single [String] to [spanParents]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addSpanParent(spanParent: String) = apply { spanParents = @@ -659,15 +788,25 @@ private constructor( /** A list of tags to log */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags to log */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags to log */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags to log */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } @@ -835,29 +974,59 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the file in code where the project logs event was created */ + /** + * Name of the file in code where the project logs event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFilename(): Optional = Optional.ofNullable(callerFilename.getNullable("caller_filename")) - /** The function in code which created the project logs event */ + /** + * The function in code which created the project logs event + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerFunctionname(): Optional = Optional.ofNullable(callerFunctionname.getNullable("caller_functionname")) - /** Line of code where the project logs event was created */ + /** + * Line of code where the project logs event was created + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun callerLineno(): Optional = Optional.ofNullable(callerLineno.getNullable("caller_lineno")) - /** Name of the file in code where the project logs event was created */ + /** + * Returns the raw JSON value of [callerFilename]. + * + * Unlike [callerFilename], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_filename") @ExcludeMissing fun _callerFilename(): JsonField = callerFilename - /** The function in code which created the project logs event */ + /** + * Returns the raw JSON value of [callerFunctionname]. + * + * Unlike [callerFunctionname], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("caller_functionname") @ExcludeMissing fun _callerFunctionname(): JsonField = callerFunctionname - /** Line of code where the project logs event was created */ + /** + * Returns the raw JSON value of [callerLineno]. + * + * Unlike [callerLineno], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("caller_lineno") @ExcludeMissing fun _callerLineno(): JsonField = callerLineno @@ -907,11 +1076,17 @@ private constructor( fun callerFilename(callerFilename: String?) = callerFilename(JsonField.ofNullable(callerFilename)) - /** Name of the file in code where the project logs event was created */ + /** Alias for calling [Builder.callerFilename] with `callerFilename.orElse(null)`. */ fun callerFilename(callerFilename: Optional) = callerFilename(callerFilename.getOrNull()) - /** Name of the file in code where the project logs event was created */ + /** + * Sets [Builder.callerFilename] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFilename] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFilename(callerFilename: JsonField) = apply { this.callerFilename = callerFilename } @@ -920,11 +1095,20 @@ private constructor( fun callerFunctionname(callerFunctionname: String?) = callerFunctionname(JsonField.ofNullable(callerFunctionname)) - /** The function in code which created the project logs event */ + /** + * Alias for calling [Builder.callerFunctionname] with + * `callerFunctionname.orElse(null)`. + */ fun callerFunctionname(callerFunctionname: Optional) = callerFunctionname(callerFunctionname.getOrNull()) - /** The function in code which created the project logs event */ + /** + * Sets [Builder.callerFunctionname] to an arbitrary JSON value. + * + * You should usually call [Builder.callerFunctionname] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerFunctionname(callerFunctionname: JsonField) = apply { this.callerFunctionname = callerFunctionname } @@ -932,13 +1116,23 @@ private constructor( /** Line of code where the project logs event was created */ fun callerLineno(callerLineno: Long?) = callerLineno(JsonField.ofNullable(callerLineno)) - /** Line of code where the project logs event was created */ + /** + * Alias for [Builder.callerLineno]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun callerLineno(callerLineno: Long) = callerLineno(callerLineno as Long?) - /** Line of code where the project logs event was created */ + /** Alias for calling [Builder.callerLineno] with `callerLineno.orElse(null)`. */ fun callerLineno(callerLineno: Optional) = callerLineno(callerLineno.getOrNull()) - /** Line of code where the project logs event was created */ + /** + * Sets [Builder.callerLineno] to an arbitrary JSON value. + * + * You should usually call [Builder.callerLineno] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun callerLineno(callerLineno: JsonField) = apply { this.callerLineno = callerLineno } @@ -1007,10 +1201,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The model used for this example */ + /** + * The model used for this example + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) - /** The model used for this example */ + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model @JsonAnyGetter @@ -1051,10 +1254,16 @@ private constructor( /** The model used for this example */ fun model(model: String?) = model(JsonField.ofNullable(model)) - /** The model used for this example */ + /** Alias for calling [Builder.model] with `model.orElse(null)`. */ fun model(model: Optional) = model(model.getOrNull()) - /** The model used for this example */ + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun additionalProperties(additionalProperties: Map) = apply { @@ -1148,6 +1357,9 @@ private constructor( /** * The number of tokens in the completion generated by the model (only set if this is an LLM * span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun completionTokens(): Optional = Optional.ofNullable(completionTokens.getNullable("completion_tokens")) @@ -1155,12 +1367,18 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the project logs event * finished + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun end(): Optional = Optional.ofNullable(end.getNullable("end")) /** * The number of tokens in the prompt used to generate the project logs event (only set if * this is an LLM span) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun promptTokens(): Optional = Optional.ofNullable(promptTokens.getNullable("prompt_tokens")) @@ -1168,41 +1386,59 @@ private constructor( /** * A unix timestamp recording when the section of code which produced the project logs event * started + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun start(): Optional = Optional.ofNullable(start.getNullable("start")) - /** The total number of tokens in the input and output of the project logs event. */ + /** + * The total number of tokens in the input and output of the project logs event. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tokens(): Optional = Optional.ofNullable(tokens.getNullable("tokens")) /** - * The number of tokens in the completion generated by the model (only set if this is an LLM - * span) + * Returns the raw JSON value of [completionTokens]. + * + * Unlike [completionTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("completion_tokens") @ExcludeMissing fun _completionTokens(): JsonField = completionTokens /** - * A unix timestamp recording when the section of code which produced the project logs event - * finished + * Returns the raw JSON value of [end]. + * + * Unlike [end], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("end") @ExcludeMissing fun _end(): JsonField = end /** - * The number of tokens in the prompt used to generate the project logs event (only set if - * this is an LLM span) + * Returns the raw JSON value of [promptTokens]. + * + * Unlike [promptTokens], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("prompt_tokens") @ExcludeMissing fun _promptTokens(): JsonField = promptTokens /** - * A unix timestamp recording when the section of code which produced the project logs event - * started + * Returns the raw JSON value of [start]. + * + * Unlike [start], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("start") @ExcludeMissing fun _start(): JsonField = start - /** The total number of tokens in the input and output of the project logs event. */ + /** + * Returns the raw JSON value of [tokens]. + * + * Unlike [tokens], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tokens") @ExcludeMissing fun _tokens(): JsonField = tokens @JsonAnyGetter @@ -1279,22 +1515,25 @@ private constructor( completionTokens(JsonField.ofNullable(completionTokens)) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for [Builder.completionTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun completionTokens(completionTokens: Long) = completionTokens(completionTokens as Long?) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Alias for calling [Builder.completionTokens] with `completionTokens.orElse(null)`. */ fun completionTokens(completionTokens: Optional) = completionTokens(completionTokens.getOrNull()) /** - * The number of tokens in the completion generated by the model (only set if this is an - * LLM span) + * Sets [Builder.completionTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.completionTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun completionTokens(completionTokens: JsonField) = apply { this.completionTokens = completionTokens @@ -1307,20 +1546,21 @@ private constructor( fun end(end: Double?) = end(JsonField.ofNullable(end)) /** - * A unix timestamp recording when the section of code which produced the project logs - * event finished + * Alias for [Builder.end]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun end(end: Double) = end(end as Double?) - /** - * A unix timestamp recording when the section of code which produced the project logs - * event finished - */ + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ fun end(end: Optional) = end(end.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the project logs - * event finished + * Sets [Builder.end] to an arbitrary JSON value. + * + * You should usually call [Builder.end] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun end(end: JsonField) = apply { this.end = end } @@ -1331,20 +1571,21 @@ private constructor( fun promptTokens(promptTokens: Long?) = promptTokens(JsonField.ofNullable(promptTokens)) /** - * The number of tokens in the prompt used to generate the project logs event (only set - * if this is an LLM span) + * Alias for [Builder.promptTokens]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun promptTokens(promptTokens: Long) = promptTokens(promptTokens as Long?) - /** - * The number of tokens in the prompt used to generate the project logs event (only set - * if this is an LLM span) - */ + /** Alias for calling [Builder.promptTokens] with `promptTokens.orElse(null)`. */ fun promptTokens(promptTokens: Optional) = promptTokens(promptTokens.getOrNull()) /** - * The number of tokens in the prompt used to generate the project logs event (only set - * if this is an LLM span) + * Sets [Builder.promptTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.promptTokens] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun promptTokens(promptTokens: JsonField) = apply { this.promptTokens = promptTokens @@ -1357,33 +1598,44 @@ private constructor( fun start(start: Double?) = start(JsonField.ofNullable(start)) /** - * A unix timestamp recording when the section of code which produced the project logs - * event started + * Alias for [Builder.start]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun start(start: Double) = start(start as Double?) - /** - * A unix timestamp recording when the section of code which produced the project logs - * event started - */ + /** Alias for calling [Builder.start] with `start.orElse(null)`. */ fun start(start: Optional) = start(start.getOrNull()) /** - * A unix timestamp recording when the section of code which produced the project logs - * event started + * Sets [Builder.start] to an arbitrary JSON value. + * + * You should usually call [Builder.start] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun start(start: JsonField) = apply { this.start = start } /** The total number of tokens in the input and output of the project logs event. */ fun tokens(tokens: Long?) = tokens(JsonField.ofNullable(tokens)) - /** The total number of tokens in the input and output of the project logs event. */ + /** + * Alias for [Builder.tokens]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun tokens(tokens: Long) = tokens(tokens as Long?) - /** The total number of tokens in the input and output of the project logs event. */ + /** Alias for calling [Builder.tokens] with `tokens.orElse(null)`. */ fun tokens(tokens: Optional) = tokens(tokens.getOrNull()) - /** The total number of tokens in the input and output of the project logs event. */ + /** + * Sets [Builder.tokens] to an arbitrary JSON value. + * + * You should usually call [Builder.tokens] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tokens(tokens: JsonField) = apply { this.tokens = tokens } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScore.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScore.kt index 21c79f2d..83e93aa0 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScore.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScore.kt @@ -64,66 +64,156 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the project score */ + /** + * Unique identifier for the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the project score belongs under */ + /** + * Unique identifier for the project that the project score belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scoreType(): ProjectScoreType = scoreType.getRequired("score_type") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun userId(): String = userId.getRequired("user_id") - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun categories(): Optional = Optional.ofNullable(categories.getNullable("categories")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun config(): Optional = Optional.ofNullable(config.getNullable("config")) - /** Date of project score creation */ + /** + * Date of project score creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** An optional LexoRank-based string that sets the sort position for the score in the UI */ + /** + * An optional LexoRank-based string that sets the sort position for the score in the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun position(): Optional = Optional.ofNullable(position.getNullable("position")) - /** Unique identifier for the project score */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the project score belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("score_type") @ExcludeMissing fun _scoreType(): JsonField = scoreType + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("categories") @ExcludeMissing fun _categories(): JsonField = categories + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - /** Date of project score creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** An optional LexoRank-based string that sets the sort position for the score in the UI */ + /** + * Returns the raw JSON value of [position]. + * + * Unlike [position], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("position") @ExcludeMissing fun _position(): JsonField = position @JsonAnyGetter @@ -202,81 +292,140 @@ private constructor( /** Unique identifier for the project score */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the project score */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the project score */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the project score belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the project score belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType) = scoreType(JsonField.of(scoreType)) - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun scoreType(scoreType: JsonField) = apply { this.scoreType = scoreType } fun userId(userId: String) = userId(JsonField.of(userId)) + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = categories(JsonField.ofNullable(categories)) - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { this.categories = categories } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = categories(Categories.ofCategorical(categorical)) - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = categories(Categories.ofWeighted(weighted)) - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = categories(Categories.ofMinimum(minimum)) fun config(config: ProjectScoreConfig?) = config(JsonField.ofNullable(config)) + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { this.config = config } /** Date of project score creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of project score creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of project score creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Textual description of the project score */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** An optional LexoRank-based string that sets the sort position for the score in the UI */ fun position(position: String?) = position(JsonField.ofNullable(position)) - /** An optional LexoRank-based string that sets the sort position for the score in the UI */ + /** Alias for calling [Builder.position] with `position.orElse(null)`. */ fun position(position: Optional) = position(position.getOrNull()) - /** An optional LexoRank-based string that sets the sort position for the score in the UI */ + /** + * Sets [Builder.position] to an arbitrary JSON value. + * + * You should usually call [Builder.position] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun position(position: JsonField) = apply { this.position = position } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCategory.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCategory.kt index 9637cd01..6536e6c0 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCategory.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCategory.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -26,16 +27,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the category */ + /** + * Name of the category + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Numerical value of the category. Must be between 0 and 1, inclusive */ + /** + * Numerical value of the category. Must be between 0 and 1, inclusive + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun value(): Double = value.getRequired("value") - /** Name of the category */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Numerical value of the category. Must be between 0 and 1, inclusive */ + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnyGetter @@ -87,13 +106,23 @@ private constructor( /** Name of the category */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the category */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Numerical value of the category. Must be between 0 and 1, inclusive */ fun value(value: Double) = value(JsonField.of(value)) - /** Numerical value of the category. Must be between 0 and 1, inclusive */ + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreConfig.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreConfig.kt index c612a666..7351c2fb 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreConfig.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreConfig.kt @@ -9,6 +9,7 @@ import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,20 +34,47 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun destination(): Optional = Optional.ofNullable(destination.getNullable("destination")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun multiSelect(): Optional = Optional.ofNullable(multiSelect.getNullable("multi_select")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun online(): Optional = Optional.ofNullable(online.getNullable("online")) + /** + * Returns the raw JSON value of [destination]. + * + * Unlike [destination], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("destination") @ExcludeMissing fun _destination(): JsonField = destination + /** + * Returns the raw JSON value of [multiSelect]. + * + * Unlike [multiSelect], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("multi_select") @ExcludeMissing fun _multiSelect(): JsonField = multiSelect + /** + * Returns the raw JSON value of [online]. + * + * Unlike [online], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("online") @ExcludeMissing fun _online(): JsonField = online @JsonAnyGetter @@ -92,22 +120,51 @@ private constructor( fun destination(destination: String?) = destination(JsonField.ofNullable(destination)) + /** Alias for calling [Builder.destination] with `destination.orElse(null)`. */ fun destination(destination: Optional) = destination(destination.getOrNull()) + /** + * Sets [Builder.destination] to an arbitrary JSON value. + * + * You should usually call [Builder.destination] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun destination(destination: JsonField) = apply { this.destination = destination } fun multiSelect(multiSelect: Boolean?) = multiSelect(JsonField.ofNullable(multiSelect)) + /** + * Alias for [Builder.multiSelect]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun multiSelect(multiSelect: Boolean) = multiSelect(multiSelect as Boolean?) + /** Alias for calling [Builder.multiSelect] with `multiSelect.orElse(null)`. */ fun multiSelect(multiSelect: Optional) = multiSelect(multiSelect.getOrNull()) + /** + * Sets [Builder.multiSelect] to an arbitrary JSON value. + * + * You should usually call [Builder.multiSelect] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun multiSelect(multiSelect: JsonField) = apply { this.multiSelect = multiSelect } fun online(online: OnlineScoreConfig?) = online(JsonField.ofNullable(online)) + /** Alias for calling [Builder.online] with `online.orElse(null)`. */ fun online(online: Optional) = online(online.getOrNull()) + /** + * Sets [Builder.online] to an arbitrary JSON value. + * + * You should usually call [Builder.online] with a well-typed [OnlineScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun online(online: JsonField) = apply { this.online = online } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCreateParams.kt index 3a475043..606810a8 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreCreateParams.kt @@ -43,38 +43,92 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the project score belongs under */ + /** + * Unique identifier for the project that the project score belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scoreType(): ProjectScoreType = body.scoreType() - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun categories(): Optional = body.categories() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun config(): Optional = body.config() - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the project score belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _scoreType(): JsonField = body._scoreType() - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ fun _categories(): JsonField = body._categories() + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ fun _config(): JsonField = body._config() - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -116,47 +170,101 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the project score belongs under */ + /** + * Unique identifier for the project that the project score belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scoreType(): ProjectScoreType = scoreType.getRequired("score_type") - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun categories(): Optional = Optional.ofNullable(categories.getNullable("categories")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun config(): Optional = Optional.ofNullable(config.getNullable("config")) - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the project score belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("score_type") @ExcludeMissing fun _scoreType(): JsonField = scoreType - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("categories") @ExcludeMissing fun _categories(): JsonField = categories + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description @@ -223,19 +331,37 @@ private constructor( /** Name of the project score */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the project score belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the project score belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType) = scoreType(JsonField.of(scoreType)) - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun scoreType(scoreType: JsonField) = apply { this.scoreType = scoreType } @@ -243,39 +369,59 @@ private constructor( /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = categories(JsonField.ofNullable(categories)) - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { this.categories = categories } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = categories(Categories.ofCategorical(categorical)) - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = categories(Categories.ofWeighted(weighted)) - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = categories(Categories.ofMinimum(minimum)) fun config(config: ProjectScoreConfig?) = config(JsonField.ofNullable(config)) + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { this.config = config } /** Textual description of the project score */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -364,54 +510,91 @@ private constructor( /** Name of the project score */ fun name(name: String) = apply { body.name(name) } - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the project score belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the project score belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType) = apply { body.scoreType(scoreType) } - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun scoreType(scoreType: JsonField) = apply { body.scoreType(scoreType) } /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = apply { body.categories(categories) } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { body.categories(categories) } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = apply { body.categoriesOfCategorical(categorical) } - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = apply { body.categories(weighted) } - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = apply { body.categoriesOfMinimum(minimum) } fun config(config: ProjectScoreConfig?) = apply { body.config(config) } + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { body.config(config) } /** Textual description of the project score */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreListParams.kt index 18c456c6..29356a33 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreListParams.kt @@ -154,13 +154,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -169,49 +163,44 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Project id */ fun projectId(projectId: String?) = apply { this.projectId = projectId } - /** Project id */ + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** Name of the project_score to search for */ @@ -219,20 +208,22 @@ private constructor( this.projectScoreName = projectScoreName } - /** Name of the project_score to search for */ + /** Alias for calling [Builder.projectScoreName] with `projectScoreName.orElse(null)`. */ fun projectScoreName(projectScoreName: Optional) = projectScoreName(projectScoreName.getOrNull()) /** The type of the configured score */ fun scoreType(scoreType: ScoreType?) = apply { this.scoreType = scoreType } - /** The type of the configured score */ + /** Alias for calling [Builder.scoreType] with `scoreType.orElse(null)`. */ fun scoreType(scoreType: Optional) = scoreType(scoreType.getOrNull()) - /** The type of the configured score */ + /** Alias for calling [scoreType] with `ScoreType.ofProject(project)`. */ fun scoreType(project: ProjectScoreType) = scoreType(ScoreType.ofProject(project)) - /** The type of the configured score */ + /** + * Alias for calling [scoreType] with `ScoreType.ofProjectScoreTypes(projectScoreTypes)`. + */ fun scoreTypeOfProjectScoreTypes(projectScoreTypes: List) = scoreType(ScoreType.ofProjectScoreTypes(projectScoreTypes)) @@ -245,13 +236,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreReplaceParams.kt index 3c35ed4a..88048533 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreReplaceParams.kt @@ -44,38 +44,92 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the project score belongs under */ + /** + * Unique identifier for the project that the project score belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scoreType(): ProjectScoreType = body.scoreType() - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun categories(): Optional = body.categories() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun config(): Optional = body.config() - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the project score belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _scoreType(): JsonField = body._scoreType() - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ fun _categories(): JsonField = body._categories() + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ fun _config(): JsonField = body._config() - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -117,47 +171,101 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the project score belongs under */ + /** + * Unique identifier for the project that the project score belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun scoreType(): ProjectScoreType = scoreType.getRequired("score_type") - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun categories(): Optional = Optional.ofNullable(categories.getNullable("categories")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun config(): Optional = Optional.ofNullable(config.getNullable("config")) - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the project score belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("score_type") @ExcludeMissing fun _scoreType(): JsonField = scoreType - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("categories") @ExcludeMissing fun _categories(): JsonField = categories + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description @@ -224,19 +332,37 @@ private constructor( /** Name of the project score */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the project score belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the project score belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType) = scoreType(JsonField.of(scoreType)) - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun scoreType(scoreType: JsonField) = apply { this.scoreType = scoreType } @@ -244,39 +370,59 @@ private constructor( /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = categories(JsonField.ofNullable(categories)) - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { this.categories = categories } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = categories(Categories.ofCategorical(categorical)) - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = categories(Categories.ofWeighted(weighted)) - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = categories(Categories.ofMinimum(minimum)) fun config(config: ProjectScoreConfig?) = config(JsonField.ofNullable(config)) + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { this.config = config } /** Textual description of the project score */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -365,54 +511,91 @@ private constructor( /** Name of the project score */ fun name(name: String) = apply { body.name(name) } - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the project score belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the project score belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType) = apply { body.scoreType(scoreType) } - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun scoreType(scoreType: JsonField) = apply { body.scoreType(scoreType) } /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = apply { body.categories(categories) } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { body.categories(categories) } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = apply { body.categoriesOfCategorical(categorical) } - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = apply { body.categories(weighted) } - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = apply { body.categoriesOfMinimum(minimum) } fun config(config: ProjectScoreConfig?) = apply { body.config(config) } + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { body.config(config) } /** Textual description of the project score */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreUpdateParams.kt index 402cb014..ad921421 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectScoreUpdateParams.kt @@ -48,32 +48,77 @@ private constructor( /** ProjectScore id */ fun projectScoreId(): String = projectScoreId - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun categories(): Optional = body.categories() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun config(): Optional = body.config() - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun scoreType(): Optional = body.scoreType() - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ fun _categories(): JsonField = body._categories() + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ fun _config(): JsonField = body._config() - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _scoreType(): JsonField = body._scoreType() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -119,42 +164,87 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** For categorical-type project scores, the list of all categories */ + /** + * For categorical-type project scores, the list of all categories + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun categories(): Optional = Optional.ofNullable(categories.getNullable("categories")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun config(): Optional = Optional.ofNullable(config.getNullable("config")) - /** Textual description of the project score */ + /** + * Textual description of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the project score */ + /** + * Name of the project score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The type of the configured score */ + /** + * The type of the configured score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun scoreType(): Optional = Optional.ofNullable(scoreType.getNullable("score_type")) - /** For categorical-type project scores, the list of all categories */ + /** + * Returns the raw JSON value of [categories]. + * + * Unlike [categories], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("categories") @ExcludeMissing fun _categories(): JsonField = categories + /** + * Returns the raw JSON value of [config]. + * + * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - /** Textual description of the project score */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** Name of the project score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The type of the configured score */ + /** + * Returns the raw JSON value of [scoreType]. + * + * Unlike [scoreType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("score_type") @ExcludeMissing fun _scoreType(): JsonField = scoreType @@ -209,39 +299,59 @@ private constructor( /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = categories(JsonField.ofNullable(categories)) - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { this.categories = categories } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = categories(Categories.ofCategorical(categorical)) - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = categories(Categories.ofWeighted(weighted)) - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = categories(Categories.ofMinimum(minimum)) fun config(config: ProjectScoreConfig?) = config(JsonField.ofNullable(config)) + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { this.config = config } /** Textual description of the project score */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -249,19 +359,31 @@ private constructor( /** Name of the project score */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the project score */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType?) = scoreType(JsonField.ofNullable(scoreType)) - /** The type of the configured score */ + /** Alias for calling [Builder.scoreType] with `scoreType.orElse(null)`. */ fun scoreType(scoreType: Optional) = scoreType(scoreType.getOrNull()) - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun scoreType(scoreType: JsonField) = apply { this.scoreType = scoreType } @@ -352,54 +474,85 @@ private constructor( /** For categorical-type project scores, the list of all categories */ fun categories(categories: Categories?) = apply { body.categories(categories) } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ fun categories(categories: Optional) = categories(categories.getOrNull()) - /** For categorical-type project scores, the list of all categories */ + /** + * Sets [Builder.categories] to an arbitrary JSON value. + * + * You should usually call [Builder.categories] with a well-typed [Categories] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun categories(categories: JsonField) = apply { body.categories(categories) } - /** For categorical-type project scores, the list of all categories */ + /** Alias for calling [categories] with `Categories.ofCategorical(categorical)`. */ fun categoriesOfCategorical(categorical: List) = apply { body.categoriesOfCategorical(categorical) } - /** For weighted-type project scores, the weights of each score */ + /** Alias for calling [categories] with `Categories.ofWeighted(weighted)`. */ fun categories(weighted: Categories.Weighted) = apply { body.categories(weighted) } - /** For minimum-type project scores, the list of included scores */ + /** Alias for calling [categories] with `Categories.ofMinimum(minimum)`. */ fun categoriesOfMinimum(minimum: List) = apply { body.categoriesOfMinimum(minimum) } fun config(config: ProjectScoreConfig?) = apply { body.config(config) } + /** Alias for calling [Builder.config] with `config.orElse(null)`. */ fun config(config: Optional) = config(config.getOrNull()) + /** + * Sets [Builder.config] to an arbitrary JSON value. + * + * You should usually call [Builder.config] with a well-typed [ProjectScoreConfig] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun config(config: JsonField) = apply { body.config(config) } /** Textual description of the project score */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the project score */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project score */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** Name of the project score */ fun name(name: String?) = apply { body.name(name) } - /** Name of the project score */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the project score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The type of the configured score */ fun scoreType(scoreType: ProjectScoreType?) = apply { body.scoreType(scoreType) } - /** The type of the configured score */ + /** Alias for calling [Builder.scoreType] with `scoreType.orElse(null)`. */ fun scoreType(scoreType: Optional) = scoreType(scoreType.getOrNull()) - /** The type of the configured score */ + /** + * Sets [Builder.scoreType] to an arbitrary JSON value. + * + * You should usually call [Builder.scoreType] with a well-typed [ProjectScoreType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun scoreType(scoreType: JsonField) = apply { body.scoreType(scoreType) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectSettings.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectSettings.kt index 6a1912e4..dec2d996 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectSettings.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectSettings.kt @@ -37,29 +37,57 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the experiment to use as the default baseline for comparisons */ + /** + * The id of the experiment to use as the default baseline for comparisons + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun baselineExperimentId(): Optional = Optional.ofNullable(baselineExperimentId.getNullable("baseline_experiment_id")) - /** The key used to join two experiments (defaults to `input`) */ + /** + * The key used to join two experiments (defaults to `input`) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun comparisonKey(): Optional = Optional.ofNullable(comparisonKey.getNullable("comparison_key")) - /** The order of the fields to display in the trace view */ + /** + * The order of the fields to display in the trace view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun spanFieldOrder(): Optional> = Optional.ofNullable(spanFieldOrder.getNullable("spanFieldOrder")) - /** The id of the experiment to use as the default baseline for comparisons */ + /** + * Returns the raw JSON value of [baselineExperimentId]. + * + * Unlike [baselineExperimentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("baseline_experiment_id") @ExcludeMissing fun _baselineExperimentId(): JsonField = baselineExperimentId - /** The key used to join two experiments (defaults to `input`) */ + /** + * Returns the raw JSON value of [comparisonKey]. + * + * Unlike [comparisonKey], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("comparison_key") @ExcludeMissing fun _comparisonKey(): JsonField = comparisonKey - /** The order of the fields to display in the trace view */ + /** + * Returns the raw JSON value of [spanFieldOrder]. + * + * Unlike [spanFieldOrder], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("spanFieldOrder") @ExcludeMissing fun _spanFieldOrder(): JsonField> = spanFieldOrder @@ -109,11 +137,20 @@ private constructor( fun baselineExperimentId(baselineExperimentId: String?) = baselineExperimentId(JsonField.ofNullable(baselineExperimentId)) - /** The id of the experiment to use as the default baseline for comparisons */ + /** + * Alias for calling [Builder.baselineExperimentId] with + * `baselineExperimentId.orElse(null)`. + */ fun baselineExperimentId(baselineExperimentId: Optional) = baselineExperimentId(baselineExperimentId.getOrNull()) - /** The id of the experiment to use as the default baseline for comparisons */ + /** + * Sets [Builder.baselineExperimentId] to an arbitrary JSON value. + * + * You should usually call [Builder.baselineExperimentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun baselineExperimentId(baselineExperimentId: JsonField) = apply { this.baselineExperimentId = baselineExperimentId } @@ -122,11 +159,17 @@ private constructor( fun comparisonKey(comparisonKey: String?) = comparisonKey(JsonField.ofNullable(comparisonKey)) - /** The key used to join two experiments (defaults to `input`) */ + /** Alias for calling [Builder.comparisonKey] with `comparisonKey.orElse(null)`. */ fun comparisonKey(comparisonKey: Optional) = comparisonKey(comparisonKey.getOrNull()) - /** The key used to join two experiments (defaults to `input`) */ + /** + * Sets [Builder.comparisonKey] to an arbitrary JSON value. + * + * You should usually call [Builder.comparisonKey] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun comparisonKey(comparisonKey: JsonField) = apply { this.comparisonKey = comparisonKey } @@ -135,16 +178,26 @@ private constructor( fun spanFieldOrder(spanFieldOrder: List?) = spanFieldOrder(JsonField.ofNullable(spanFieldOrder)) - /** The order of the fields to display in the trace view */ + /** Alias for calling [Builder.spanFieldOrder] with `spanFieldOrder.orElse(null)`. */ fun spanFieldOrder(spanFieldOrder: Optional>) = spanFieldOrder(spanFieldOrder.getOrNull()) - /** The order of the fields to display in the trace view */ + /** + * Sets [Builder.spanFieldOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.spanFieldOrder] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun spanFieldOrder(spanFieldOrder: JsonField>) = apply { this.spanFieldOrder = spanFieldOrder.map { it.toMutableList() } } - /** The order of the fields to display in the trace view */ + /** + * Adds a single [SpanFieldOrder] to [Builder.spanFieldOrder]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addSpanFieldOrder(spanFieldOrder: SpanFieldOrder) = apply { this.spanFieldOrder = (this.spanFieldOrder ?: JsonField.of(mutableListOf())).also { @@ -200,22 +253,58 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun columnId(): String = columnId.getRequired("column_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): String = objectType.getRequired("object_type") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun position(): String = position.getRequired("position") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun layout(): Optional = Optional.ofNullable(layout.getNullable("layout")) + /** + * Returns the raw JSON value of [columnId]. + * + * Unlike [columnId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("column_id") @ExcludeMissing fun _columnId(): JsonField = columnId + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType + /** + * Returns the raw JSON value of [position]. + * + * Unlike [position], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("position") @ExcludeMissing fun _position(): JsonField = position + /** + * Returns the raw JSON value of [layout]. + * + * Unlike [layout], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("layout") @ExcludeMissing fun _layout(): JsonField = layout @JsonAnyGetter @@ -273,20 +362,49 @@ private constructor( fun columnId(columnId: String) = columnId(JsonField.of(columnId)) + /** + * Sets [Builder.columnId] to an arbitrary JSON value. + * + * You should usually call [Builder.columnId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun columnId(columnId: JsonField) = apply { this.columnId = columnId } fun objectType(objectType: String) = objectType(JsonField.of(objectType)) + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } fun position(position: String) = position(JsonField.of(position)) + /** + * Sets [Builder.position] to an arbitrary JSON value. + * + * You should usually call [Builder.position] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun position(position: JsonField) = apply { this.position = position } fun layout(layout: Layout?) = layout(JsonField.ofNullable(layout)) + /** Alias for calling [Builder.layout] with `layout.orElse(null)`. */ fun layout(layout: Optional) = layout(layout.getOrNull()) + /** + * Sets [Builder.layout] to an arbitrary JSON value. + * + * You should usually call [Builder.layout] with a well-typed [Layout] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun layout(layout: JsonField) = apply { this.layout = layout } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTag.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTag.kt index 69a309f6..13fd21d3 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTag.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTag.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -45,45 +46,108 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the project tag */ + /** + * Unique identifier for the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the project tag belongs under */ + /** + * Unique identifier for the project that the project tag belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun userId(): String = userId.getRequired("user_id") - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun color(): Optional = Optional.ofNullable(color.getNullable("color")) - /** Date of project tag creation */ + /** + * Date of project tag creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Unique identifier for the project tag */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the project tag belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color - /** Date of project tag creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description @JsonAnyGetter @@ -152,50 +216,89 @@ private constructor( /** Unique identifier for the project tag */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the project tag */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the project tag */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the project tag belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the project tag belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun userId(userId: String) = userId(JsonField.of(userId)) + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } /** Color of the tag for the UI */ fun color(color: String?) = color(JsonField.ofNullable(color)) - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun color(color: JsonField) = apply { this.color = color } /** Date of project tag creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of project tag creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of project tag creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Textual description of the project tag */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagCreateParams.kt index 1944b66e..2535deb8 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,28 +33,64 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the project tag belongs under */ + /** + * Unique identifier for the project that the project tag belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun color(): Optional = body.color() - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the project tag belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ fun _color(): JsonField = body._color() - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -88,29 +125,65 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the project tag belongs under */ + /** + * Unique identifier for the project that the project tag belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun color(): Optional = Optional.ofNullable(color.getNullable("color")) - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the project tag belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description @@ -170,31 +243,55 @@ private constructor( /** Name of the project tag */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the project tag belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the project tag belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Color of the tag for the UI */ fun color(color: String?) = color(JsonField.ofNullable(color)) - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun color(color: JsonField) = apply { this.color = color } /** Textual description of the project tag */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -280,31 +377,53 @@ private constructor( /** Name of the project tag */ fun name(name: String) = apply { body.name(name) } - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the project tag belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the project tag belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Color of the tag for the UI */ fun color(color: String?) = apply { body.color(color) } - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun color(color: JsonField) = apply { body.color(color) } /** Textual description of the project tag */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagListParams.kt index 431a8583..7141cfde 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagListParams.kt @@ -147,13 +147,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -162,55 +156,50 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Project id */ fun projectId(projectId: String?) = apply { this.projectId = projectId } - /** Project id */ + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** Name of the project_tag to search for */ fun projectTagName(projectTagName: String?) = apply { this.projectTagName = projectTagName } - /** Name of the project_tag to search for */ + /** Alias for calling [Builder.projectTagName] with `projectTagName.orElse(null)`. */ fun projectTagName(projectTagName: Optional) = projectTagName(projectTagName.getOrNull()) @@ -223,13 +212,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagReplaceParams.kt index ab167ca1..19ffe1ef 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagReplaceParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,28 +34,64 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the project tag belongs under */ + /** + * Unique identifier for the project that the project tag belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun color(): Optional = body.color() - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the project tag belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ fun _color(): JsonField = body._color() - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -89,29 +126,65 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the project tag belongs under */ + /** + * Unique identifier for the project that the project tag belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun color(): Optional = Optional.ofNullable(color.getNullable("color")) - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the project tag belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description @@ -171,31 +244,55 @@ private constructor( /** Name of the project tag */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the project tag belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the project tag belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Color of the tag for the UI */ fun color(color: String?) = color(JsonField.ofNullable(color)) - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun color(color: JsonField) = apply { this.color = color } /** Textual description of the project tag */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -281,31 +378,53 @@ private constructor( /** Name of the project tag */ fun name(name: String) = apply { body.name(name) } - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the project tag belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the project tag belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Color of the tag for the UI */ fun color(color: String?) = apply { body.color(color) } - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun color(color: JsonField) = apply { body.color(color) } /** Textual description of the project tag */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagUpdateParams.kt index 8a93825d..79216682 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectTagUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,22 +38,49 @@ private constructor( /** ProjectTag id */ fun projectTagId(): String = projectTagId - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun color(): Optional = body.color() - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ fun _color(): JsonField = body._color() - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -91,25 +119,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Color of the tag for the UI */ + /** + * Color of the tag for the UI + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun color(): Optional = Optional.ofNullable(color.getNullable("color")) - /** Textual description of the project tag */ + /** + * Textual description of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the project tag */ + /** + * Name of the project tag + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Color of the tag for the UI */ + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color - /** Textual description of the project tag */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** Name of the project tag */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -156,19 +211,31 @@ private constructor( /** Color of the tag for the UI */ fun color(color: String?) = color(JsonField.ofNullable(color)) - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun color(color: JsonField) = apply { this.color = color } /** Textual description of the project tag */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -176,10 +243,16 @@ private constructor( /** Name of the project tag */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the project tag */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { @@ -260,28 +333,44 @@ private constructor( /** Color of the tag for the UI */ fun color(color: String?) = apply { body.color(color) } - /** Color of the tag for the UI */ + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ fun color(color: Optional) = color(color.getOrNull()) - /** Color of the tag for the UI */ + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun color(color: JsonField) = apply { body.color(color) } /** Textual description of the project tag */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the project tag */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the project tag */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** Name of the project tag */ fun name(name: String?) = apply { body.name(name) } - /** Name of the project tag */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the project tag */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectUpdateParams.kt index f47cf5da..beb5ed84 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,21 +38,34 @@ private constructor( /** Project id */ fun projectId(): String = projectId - /** Name of the project */ + /** + * Name of the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() /** * Project settings. Patch operations replace all settings, so make sure you include all * settings you want to keep. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun settings(): Optional = body.settings() - /** Name of the project */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * Project settings. Patch operations replace all settings, so make sure you include all - * settings you want to keep. + * Returns the raw JSON value of [settings]. + * + * Unlike [settings], this method doesn't throw if the JSON field has an unexpected type. */ fun _settings(): JsonField = body._settings() @@ -88,22 +102,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the project */ + /** + * Name of the project + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** * Project settings. Patch operations replace all settings, so make sure you include all * settings you want to keep. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun settings(): Optional = Optional.ofNullable(settings.getNullable("settings")) - /** Name of the project */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Project settings. Patch operations replace all settings, so make sure you include all - * settings you want to keep. + * Returns the raw JSON value of [settings]. + * + * Unlike [settings], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("settings") @ExcludeMissing @@ -150,10 +177,16 @@ private constructor( /** Name of the project */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the project */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the project */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -162,15 +195,15 @@ private constructor( */ fun settings(settings: ProjectSettings?) = settings(JsonField.ofNullable(settings)) - /** - * Project settings. Patch operations replace all settings, so make sure you include all - * settings you want to keep. - */ + /** Alias for calling [Builder.settings] with `settings.orElse(null)`. */ fun settings(settings: Optional) = settings(settings.getOrNull()) /** - * Project settings. Patch operations replace all settings, so make sure you include all - * settings you want to keep. + * Sets [Builder.settings] to an arbitrary JSON value. + * + * You should usually call [Builder.settings] with a well-typed [ProjectSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun settings(settings: JsonField) = apply { this.settings = settings } @@ -252,10 +285,15 @@ private constructor( /** Name of the project */ fun name(name: String?) = apply { body.name(name) } - /** Name of the project */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the project */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -264,15 +302,15 @@ private constructor( */ fun settings(settings: ProjectSettings?) = apply { body.settings(settings) } - /** - * Project settings. Patch operations replace all settings, so make sure you include all - * settings you want to keep. - */ + /** Alias for calling [Builder.settings] with `settings.orElse(null)`. */ fun settings(settings: Optional) = settings(settings.getOrNull()) /** - * Project settings. Patch operations replace all settings, so make sure you include all - * settings you want to keep. + * Sets [Builder.settings] to an arbitrary JSON value. + * + * You should usually call [Builder.settings] with a well-typed [ProjectSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun settings(settings: JsonField) = apply { body.settings(settings) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Prompt.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Prompt.kt index 5e093784..a55bbce4 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Prompt.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Prompt.kt @@ -58,95 +58,206 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") /** * The transaction id of an event is unique to the network operation that processed the event * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve * a versioned snapshot of the prompt (see the `version` parameter) + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun _xactId(): String = _xactId.getRequired("_xact_id") - /** A literal 'p' which identifies the object as a project prompt */ + /** + * A literal 'p' which identifies the object as a project prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun logId(): LogId = logId.getRequired("log_id") - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the organization */ + /** + * Unique identifier for the organization + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun orgId(): String = orgId.getRequired("org_id") - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") - /** Date of prompt creation */ + /** + * Date of prompt creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionType(): Optional = Optional.ofNullable(functionType.getNullable("function_type")) - /** User-controlled metadata about the prompt */ + /** + * User-controlled metadata about the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The transaction id of an event is unique to the network operation that processed the event - * insertion. Transaction ids are monotonically increasing over time and can be used to retrieve - * a versioned snapshot of the prompt (see the `version` parameter) + * Returns the raw JSON value of [_xactId]. + * + * Unlike [_xactId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("_xact_id") @ExcludeMissing fun __xactId(): JsonField = _xactId - /** A literal 'p' which identifies the object as a project prompt */ + /** + * Returns the raw JSON value of [logId]. + * + * Unlike [logId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("log_id") @ExcludeMissing fun _logId(): JsonField = logId - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the organization */ + /** + * Returns the raw JSON value of [orgId]. + * + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** Date of prompt creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("function_type") @ExcludeMissing fun _functionType(): JsonField = functionType - /** User-controlled metadata about the prompt */ + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -236,7 +347,12 @@ private constructor( /** Unique identifier for the prompt */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** @@ -247,66 +363,113 @@ private constructor( fun _xactId(_xactId: String) = _xactId(JsonField.of(_xactId)) /** - * The transaction id of an event is unique to the network operation that processed the - * event insertion. Transaction ids are monotonically increasing over time and can be used - * to retrieve a versioned snapshot of the prompt (see the `version` parameter) + * Sets [Builder._xactId] to an arbitrary JSON value. + * + * You should usually call [Builder._xactId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun _xactId(_xactId: JsonField) = apply { this._xactId = _xactId } /** A literal 'p' which identifies the object as a project prompt */ fun logId(logId: LogId) = logId(JsonField.of(logId)) - /** A literal 'p' which identifies the object as a project prompt */ + /** + * Sets [Builder.logId] to an arbitrary JSON value. + * + * You should usually call [Builder.logId] with a well-typed [LogId] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun logId(logId: JsonField) = apply { this.logId = logId } /** Name of the prompt */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the organization */ fun orgId(orgId: String) = orgId(JsonField.of(orgId)) - /** Unique identifier for the organization */ + /** + * Sets [Builder.orgId] to an arbitrary JSON value. + * + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Unique identifier for the prompt */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** Date of prompt creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of prompt creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of prompt creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } fun functionType(functionType: FunctionType?) = functionType(JsonField.ofNullable(functionType)) + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { this.functionType = functionType } @@ -314,33 +477,55 @@ private constructor( /** User-controlled metadata about the prompt */ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** User-controlled metadata about the prompt */ + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) - /** User-controlled metadata about the prompt */ + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptCreateParams.kt index 3eee9b8f..74098627 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptCreateParams.kt @@ -35,44 +35,107 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = body.slug() - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionType(): Optional = body.functionType() - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = body.promptData() - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = body.tags() - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ fun _slug(): JsonField = body._slug() - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionType(): JsonField = body._functionType() - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _promptData(): JsonField = body._promptData() - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ fun _tags(): JsonField> = body._tags() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -116,53 +179,117 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionType(): Optional = Optional.ofNullable(functionType.getNullable("function_type")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_type") @ExcludeMissing fun _functionType(): JsonField = functionType - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -230,28 +357,52 @@ private constructor( /** Name of the prompt */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Unique identifier for the prompt */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -259,9 +410,17 @@ private constructor( fun functionType(functionType: FunctionType?) = functionType(JsonField.ofNullable(functionType)) + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { this.functionType = functionType } @@ -269,10 +428,16 @@ private constructor( /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } @@ -280,15 +445,25 @@ private constructor( /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } @@ -379,35 +554,65 @@ private constructor( /** Name of the prompt */ fun name(name: String) = apply { body.name(name) } - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Unique identifier for the prompt */ fun slug(slug: String) = apply { body.slug(slug) } - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { body.slug(slug) } /** Textual description of the prompt */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun functionType(functionType: FunctionType?) = apply { body.functionType(functionType) } + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { body.functionType(functionType) } @@ -415,22 +620,38 @@ private constructor( /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = apply { body.promptData(promptData) } - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { body.promptData(promptData) } /** A list of tags for the prompt */ fun tags(tags: List?) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { body.addTag(tag) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptData.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptData.kt index cd072c2a..3df455f9 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptData.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptData.kt @@ -54,25 +54,70 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = Optional.ofNullable(options.getNullable("options")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun origin(): Optional = Optional.ofNullable(origin.getNullable("origin")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun parser(): Optional = Optional.ofNullable(parser.getNullable("parser")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun prompt(): Optional = Optional.ofNullable(prompt.getNullable("prompt")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun toolFunctions(): Optional> = Optional.ofNullable(toolFunctions.getNullable("tool_functions")) + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options + /** + * Returns the raw JSON value of [origin]. + * + * Unlike [origin], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("origin") @ExcludeMissing fun _origin(): JsonField = origin + /** + * Returns the raw JSON value of [parser]. + * + * Unlike [parser], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("parser") @ExcludeMissing fun _parser(): JsonField = parser + /** + * Returns the raw JSON value of [prompt]. + * + * Unlike [prompt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt") @ExcludeMissing fun _prompt(): JsonField = prompt + /** + * Returns the raw JSON value of [toolFunctions]. + * + * Unlike [toolFunctions], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tool_functions") @ExcludeMissing fun _toolFunctions(): JsonField> = toolFunctions @@ -126,42 +171,86 @@ private constructor( fun options(options: PromptOptions?) = options(JsonField.ofNullable(options)) + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [PromptOptions] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun options(options: JsonField) = apply { this.options = options } fun origin(origin: Origin?) = origin(JsonField.ofNullable(origin)) + /** Alias for calling [Builder.origin] with `origin.orElse(null)`. */ fun origin(origin: Optional) = origin(origin.getOrNull()) + /** + * Sets [Builder.origin] to an arbitrary JSON value. + * + * You should usually call [Builder.origin] with a well-typed [Origin] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun origin(origin: JsonField) = apply { this.origin = origin } fun parser(parser: Parser?) = parser(JsonField.ofNullable(parser)) + /** Alias for calling [Builder.parser] with `parser.orElse(null)`. */ fun parser(parser: Optional) = parser(parser.getOrNull()) + /** + * Sets [Builder.parser] to an arbitrary JSON value. + * + * You should usually call [Builder.parser] with a well-typed [Parser] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun parser(parser: JsonField) = apply { this.parser = parser } fun prompt(prompt: Prompt?) = prompt(JsonField.ofNullable(prompt)) + /** Alias for calling [Builder.prompt] with `prompt.orElse(null)`. */ fun prompt(prompt: Optional) = prompt(prompt.getOrNull()) + /** + * Sets [Builder.prompt] to an arbitrary JSON value. + * + * You should usually call [Builder.prompt] with a well-typed [Prompt] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun prompt(prompt: JsonField) = apply { this.prompt = prompt } + /** Alias for calling [prompt] with `Prompt.ofCompletion(completion)`. */ fun prompt(completion: Prompt.Completion) = prompt(Prompt.ofCompletion(completion)) + /** Alias for calling [prompt] with `Prompt.ofChat(chat)`. */ fun prompt(chat: Prompt.Chat) = prompt(Prompt.ofChat(chat)) fun toolFunctions(toolFunctions: List?) = toolFunctions(JsonField.ofNullable(toolFunctions)) + /** Alias for calling [Builder.toolFunctions] with `toolFunctions.orElse(null)`. */ fun toolFunctions(toolFunctions: Optional>) = toolFunctions(toolFunctions.getOrNull()) + /** + * Sets [Builder.toolFunctions] to an arbitrary JSON value. + * + * You should usually call [Builder.toolFunctions] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun toolFunctions(toolFunctions: JsonField>) = apply { this.toolFunctions = toolFunctions.map { it.toMutableList() } } + /** + * Adds a single [ToolFunction] to [toolFunctions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addToolFunction(toolFunction: ToolFunction) = apply { toolFunctions = (toolFunctions ?: JsonField.of(mutableListOf())).also { @@ -169,9 +258,11 @@ private constructor( } } + /** Alias for calling [addToolFunction] with `ToolFunction.ofFunction(function)`. */ fun addToolFunction(function: ToolFunction.Function) = addToolFunction(ToolFunction.ofFunction(function)) + /** Alias for calling [addToolFunction] with `ToolFunction.ofGlobal(global)`. */ fun addToolFunction(global: ToolFunction.Global) = addToolFunction(ToolFunction.ofGlobal(global)) @@ -222,17 +313,45 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun projectId(): Optional = Optional.ofNullable(projectId.getNullable("project_id")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptId(): Optional = Optional.ofNullable(promptId.getNullable("prompt_id")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptVersion(): Optional = Optional.ofNullable(promptVersion.getNullable("prompt_version")) + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId + /** + * Returns the raw JSON value of [promptId]. + * + * Unlike [promptId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_id") @ExcludeMissing fun _promptId(): JsonField = promptId + /** + * Returns the raw JSON value of [promptVersion]. + * + * Unlike [promptVersion], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("prompt_version") @ExcludeMissing fun _promptVersion(): JsonField = promptVersion @@ -280,14 +399,35 @@ private constructor( fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun promptId(promptId: String) = promptId(JsonField.of(promptId)) + /** + * Sets [Builder.promptId] to an arbitrary JSON value. + * + * You should usually call [Builder.promptId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptId(promptId: JsonField) = apply { this.promptId = promptId } fun promptVersion(promptVersion: String) = promptVersion(JsonField.of(promptVersion)) + /** + * Sets [Builder.promptVersion] to an arbitrary JSON value. + * + * You should usually call [Builder.promptVersion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptVersion(promptVersion: JsonField) = apply { this.promptVersion = promptVersion } @@ -348,18 +488,46 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun choiceScores(): ChoiceScores = choiceScores.getRequired("choice_scores") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun useCot(): Boolean = useCot.getRequired("use_cot") + /** + * Returns the raw JSON value of [choiceScores]. + * + * Unlike [choiceScores], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("choice_scores") @ExcludeMissing fun _choiceScores(): JsonField = choiceScores + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [useCot]. + * + * Unlike [useCot], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("use_cot") @ExcludeMissing fun _useCot(): JsonField = useCot @JsonAnyGetter @@ -414,16 +582,37 @@ private constructor( fun choiceScores(choiceScores: ChoiceScores) = choiceScores(JsonField.of(choiceScores)) + /** + * Sets [Builder.choiceScores] to an arbitrary JSON value. + * + * You should usually call [Builder.choiceScores] with a well-typed [ChoiceScores] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun choiceScores(choiceScores: JsonField) = apply { this.choiceScores = choiceScores } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun useCot(useCot: Boolean) = useCot(JsonField.of(useCot)) + /** + * Sets [Builder.useCot] to an arbitrary JSON value. + * + * You should usually call [Builder.useCot] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun useCot(useCot: JsonField) = apply { this.useCot = useCot } fun additionalProperties(additionalProperties: Map) = apply { @@ -795,12 +984,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun content(): String = content.getRequired("content") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -851,10 +1060,24 @@ private constructor( fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1019,18 +1242,48 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun messages(): List = messages.getRequired("messages") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun tools(): Optional = Optional.ofNullable(tools.getNullable("tools")) + /** + * Returns the raw JSON value of [messages]. + * + * Unlike [messages], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("messages") @ExcludeMissing fun _messages(): JsonField> = messages + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [tools]. + * + * Unlike [tools], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tools") @ExcludeMissing fun _tools(): JsonField = tools @JsonAnyGetter @@ -1084,10 +1337,22 @@ private constructor( fun messages(messages: List) = messages(JsonField.of(messages)) + /** + * Sets [Builder.messages] to an arbitrary JSON value. + * + * You should usually call [Builder.messages] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun messages(messages: JsonField>) = apply { this.messages = messages.map { it.toMutableList() } } + /** + * Adds a single [Message] to [messages]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMessage(message: Message) = apply { messages = (messages ?: JsonField.of(mutableListOf())).also { @@ -1095,27 +1360,47 @@ private constructor( } } + /** Alias for calling [addMessage] with `Message.ofSystem(system)`. */ fun addMessage(system: Message.System) = addMessage(Message.ofSystem(system)) + /** Alias for calling [addMessage] with `Message.ofUser(user)`. */ fun addMessage(user: Message.User) = addMessage(Message.ofUser(user)) + /** Alias for calling [addMessage] with `Message.ofAssistant(assistant)`. */ fun addMessage(assistant: Message.Assistant) = addMessage(Message.ofAssistant(assistant)) + /** Alias for calling [addMessage] with `Message.ofTool(tool)`. */ fun addMessage(tool: Message.Tool) = addMessage(Message.ofTool(tool)) + /** Alias for calling [addMessage] with `Message.ofFunction(function)`. */ fun addMessage(function: Message.Function) = addMessage(Message.ofFunction(function)) + /** Alias for calling [addMessage] with `Message.ofFallback(fallback)`. */ fun addMessage(fallback: Message.Fallback) = addMessage(Message.ofFallback(fallback)) fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun tools(tools: String) = tools(JsonField.of(tools)) + /** + * Sets [Builder.tools] to an arbitrary JSON value. + * + * You should usually call [Builder.tools] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tools(tools: JsonField) = apply { this.tools = tools } fun additionalProperties(additionalProperties: Map) = apply { @@ -1391,19 +1676,50 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -1457,14 +1773,35 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = @@ -1634,19 +1971,50 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -1700,19 +2068,42 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: Content) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [Content] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } + /** Alias for calling [content] with `Content.ofText(text)`. */ fun content(text: String) = content(Content.ofText(text)) + /** Alias for calling [content] with `Content.ofArray(array)`. */ fun contentOfArray(array: List) = content(Content.ofArray(array)) fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = @@ -2216,31 +2607,82 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun functionCall(): Optional = Optional.ofNullable(functionCall.getNullable("function_call")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun toolCalls(): Optional> = Optional.ofNullable(toolCalls.getNullable("tool_calls")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [functionCall]. + * + * Unlike [functionCall], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("function_call") @ExcludeMissing fun _functionCall(): JsonField = functionCall + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [toolCalls]. + * + * Unlike [toolCalls], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("tool_calls") @ExcludeMissing fun _toolCalls(): JsonField> = toolCalls @@ -2304,41 +2746,90 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String?) = content(JsonField.ofNullable(content)) + /** Alias for calling [Builder.content] with `content.orElse(null)`. */ fun content(content: Optional) = content(content.getOrNull()) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun functionCall(functionCall: FunctionCall?) = functionCall(JsonField.ofNullable(functionCall)) + /** + * Alias for calling [Builder.functionCall] with + * `functionCall.orElse(null)`. + */ fun functionCall(functionCall: Optional) = functionCall(functionCall.getOrNull()) + /** + * Sets [Builder.functionCall] to an arbitrary JSON value. + * + * You should usually call [Builder.functionCall] with a well-typed + * [FunctionCall] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun functionCall(functionCall: JsonField) = apply { this.functionCall = functionCall } fun name(name: String?) = name(JsonField.ofNullable(name)) + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun toolCalls(toolCalls: List?) = toolCalls(JsonField.ofNullable(toolCalls)) + /** Alias for calling [Builder.toolCalls] with `toolCalls.orElse(null)`. */ fun toolCalls(toolCalls: Optional>) = toolCalls(toolCalls.getOrNull()) + /** + * Sets [Builder.toolCalls] to an arbitrary JSON value. + * + * You should usually call [Builder.toolCalls] with a well-typed + * `List` value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ fun toolCalls(toolCalls: JsonField>) = apply { this.toolCalls = toolCalls.map { it.toMutableList() } } + /** + * Adds a single [ChatCompletionMessageToolCall] to [toolCalls]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ fun addToolCall(toolCall: ChatCompletionMessageToolCall) = apply { toolCalls = (toolCalls ?: JsonField.of(mutableListOf())).also { @@ -2495,14 +2986,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun arguments(): String = arguments.getRequired("arguments") + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * Returns the raw JSON value of [arguments]. + * + * Unlike [arguments], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("arguments") @ExcludeMissing fun _arguments(): JsonField = arguments + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -2556,12 +3069,26 @@ private constructor( fun arguments(arguments: String) = arguments(JsonField.of(arguments)) + /** + * Sets [Builder.arguments] to an arbitrary JSON value. + * + * You should usually call [Builder.arguments] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun arguments(arguments: JsonField) = apply { this.arguments = arguments } fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = @@ -2647,20 +3174,51 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun toolCallId(): Optional = Optional.ofNullable(toolCallId.getNullable("tool_call_id")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content + /** + * Returns the raw JSON value of [toolCallId]. + * + * Unlike [toolCallId], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("tool_call_id") @ExcludeMissing fun _toolCallId(): JsonField = toolCallId @@ -2716,14 +3274,35 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun toolCallId(toolCallId: String) = toolCallId(JsonField.of(toolCallId)) + /** + * Sets [Builder.toolCallId] to an arbitrary JSON value. + * + * You should usually call [Builder.toolCallId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun toolCallId(toolCallId: JsonField) = apply { this.toolCallId = toolCallId } @@ -2895,17 +3474,49 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content @@ -2962,14 +3573,35 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String) = content(JsonField.of(content)) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun additionalProperties(additionalProperties: Map) = @@ -3136,13 +3768,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun role(): Role = role.getRequired("role") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + /** + * Returns the raw JSON value of [role]. + * + * Unlike [role], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("role") @ExcludeMissing fun _role(): JsonField = role + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("content") @ExcludeMissing fun _content(): JsonField = content @@ -3195,12 +3848,27 @@ private constructor( fun role(role: Role) = role(JsonField.of(role)) + /** + * Sets [Builder.role] to an arbitrary JSON value. + * + * You should usually call [Builder.role] with a well-typed [Role] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun role(role: JsonField) = apply { this.role = role } fun content(content: String?) = content(JsonField.ofNullable(content)) + /** Alias for calling [Builder.content] with `content.orElse(null)`. */ fun content(content: Optional) = content(content.getOrNull()) + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun content(content: JsonField) = apply { this.content = content } fun additionalProperties(additionalProperties: Map) = @@ -3619,12 +4287,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun id(): String = id.getRequired("id") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -3675,10 +4363,24 @@ private constructor( fun id(id: String) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -3840,12 +4542,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -3896,10 +4618,24 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptListParams.kt index ab888cab..d9c17853 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptListParams.kt @@ -166,13 +166,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -181,61 +175,56 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Project id */ fun projectId(projectId: String?) = apply { this.projectId = projectId } - /** Project id */ + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) /** Name of the project to search for */ fun projectName(projectName: String?) = apply { this.projectName = projectName } - /** Name of the project to search for */ + /** Alias for calling [Builder.projectName] with `projectName.orElse(null)`. */ fun projectName(projectName: Optional) = projectName(projectName.getOrNull()) /** Name of the prompt to search for */ fun promptName(promptName: String?) = apply { this.promptName = promptName } - /** Name of the prompt to search for */ + /** Alias for calling [Builder.promptName] with `promptName.orElse(null)`. */ fun promptName(promptName: Optional) = promptName(promptName.getOrNull()) /** Retrieve prompt with a specific slug */ fun slug(slug: String?) = apply { this.slug = slug } - /** Retrieve prompt with a specific slug */ + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ fun slug(slug: Optional) = slug(slug.getOrNull()) /** @@ -247,13 +236,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) @@ -265,12 +248,7 @@ private constructor( */ fun version(version: String?) = apply { this.version = version } - /** - * Retrieve prompt at a specific version. - * - * The version id can either be a transaction id (e.g. '1000192656880881099') or a version - * identifier (e.g. '81cd05ee665fdfb3'). - */ + /** Alias for calling [Builder.version] with `version.orElse(null)`. */ fun version(version: Optional) = version(version.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptOptions.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptOptions.kt index 4680666c..2b833a99 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptOptions.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptOptions.kt @@ -45,16 +45,43 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun model(): Optional = Optional.ofNullable(model.getNullable("model")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun params(): Optional = Optional.ofNullable(params.getNullable("params")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun position(): Optional = Optional.ofNullable(position.getNullable("position")) + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model + /** + * Returns the raw JSON value of [params]. + * + * Unlike [params], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("params") @ExcludeMissing fun _params(): JsonField = params + /** + * Returns the raw JSON value of [position]. + * + * Unlike [position], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("position") @ExcludeMissing fun _position(): JsonField = position @JsonAnyGetter @@ -100,29 +127,52 @@ private constructor( fun model(model: String) = model(JsonField.of(model)) + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun model(model: JsonField) = apply { this.model = model } fun params(params: Params) = params(JsonField.of(params)) + /** + * Sets [Builder.params] to an arbitrary JSON value. + * + * You should usually call [Builder.params] with a well-typed [Params] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun params(params: JsonField) = apply { this.params = params } + /** Alias for calling [params] with `Params.ofOpenAIModel(openaiModel)`. */ fun params(openaiModel: Params.OpenAIModelParams) = params(Params.ofOpenAIModel(openaiModel)) + /** Alias for calling [params] with `Params.ofAnthropicModel(anthropicModel)`. */ fun params(anthropicModel: Params.AnthropicModelParams) = params(Params.ofAnthropicModel(anthropicModel)) + /** Alias for calling [params] with `Params.ofGoogleModel(googleModel)`. */ fun params(googleModel: Params.GoogleModelParams) = params(Params.ofGoogleModel(googleModel)) + /** Alias for calling [params] with `Params.ofWindowAiModel(windowAiModel)`. */ fun params(windowAiModel: Params.WindowAiModelParams) = params(Params.ofWindowAiModel(windowAiModel)) + /** Alias for calling [params] with `Params.ofJsCompletion(jsCompletion)`. */ fun params(jsCompletion: Params.JsCompletionParams) = params(Params.ofJsCompletion(jsCompletion)) fun position(position: String) = position(JsonField.of(position)) + /** + * Sets [Builder.position] to an arbitrary JSON value. + * + * You should usually call [Builder.position] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun position(position: JsonField) = apply { this.position = position } fun additionalProperties(additionalProperties: Map) = apply { @@ -400,86 +450,213 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun frequencyPenalty(): Optional = Optional.ofNullable(frequencyPenalty.getNullable("frequency_penalty")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun functionCall(): Optional = Optional.ofNullable(functionCall.getNullable("function_call")) - /** The successor to max_tokens */ + /** + * The successor to max_tokens + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun maxCompletionTokens(): Optional = Optional.ofNullable(maxCompletionTokens.getNullable("max_completion_tokens")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun maxTokens(): Optional = Optional.ofNullable(maxTokens.getNullable("max_tokens")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun n(): Optional = Optional.ofNullable(n.getNullable("n")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun presencePenalty(): Optional = Optional.ofNullable(presencePenalty.getNullable("presence_penalty")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun reasoningEffort(): Optional = Optional.ofNullable(reasoningEffort.getNullable("reasoning_effort")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun responseFormat(): Optional = Optional.ofNullable(responseFormat.getNullable("response_format")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun stop(): Optional> = Optional.ofNullable(stop.getNullable("stop")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun temperature(): Optional = Optional.ofNullable(temperature.getNullable("temperature")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun toolChoice(): Optional = Optional.ofNullable(toolChoice.getNullable("tool_choice")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun topP(): Optional = Optional.ofNullable(topP.getNullable("top_p")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun useCache(): Optional = Optional.ofNullable(useCache.getNullable("use_cache")) + /** + * Returns the raw JSON value of [frequencyPenalty]. + * + * Unlike [frequencyPenalty], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("frequency_penalty") @ExcludeMissing fun _frequencyPenalty(): JsonField = frequencyPenalty + /** + * Returns the raw JSON value of [functionCall]. + * + * Unlike [functionCall], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_call") @ExcludeMissing fun _functionCall(): JsonField = functionCall - /** The successor to max_tokens */ + /** + * Returns the raw JSON value of [maxCompletionTokens]. + * + * Unlike [maxCompletionTokens], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("max_completion_tokens") @ExcludeMissing fun _maxCompletionTokens(): JsonField = maxCompletionTokens + /** + * Returns the raw JSON value of [maxTokens]. + * + * Unlike [maxTokens], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("max_tokens") @ExcludeMissing fun _maxTokens(): JsonField = maxTokens + /** + * Returns the raw JSON value of [n]. + * + * Unlike [n], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("n") @ExcludeMissing fun _n(): JsonField = n + /** + * Returns the raw JSON value of [presencePenalty]. + * + * Unlike [presencePenalty], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("presence_penalty") @ExcludeMissing fun _presencePenalty(): JsonField = presencePenalty + /** + * Returns the raw JSON value of [reasoningEffort]. + * + * Unlike [reasoningEffort], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("reasoning_effort") @ExcludeMissing fun _reasoningEffort(): JsonField = reasoningEffort + /** + * Returns the raw JSON value of [responseFormat]. + * + * Unlike [responseFormat], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("response_format") @ExcludeMissing fun _responseFormat(): JsonField = responseFormat + /** + * Returns the raw JSON value of [stop]. + * + * Unlike [stop], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("stop") @ExcludeMissing fun _stop(): JsonField> = stop + /** + * Returns the raw JSON value of [temperature]. + * + * Unlike [temperature], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("temperature") @ExcludeMissing fun _temperature(): JsonField = temperature + /** + * Returns the raw JSON value of [toolChoice]. + * + * Unlike [toolChoice], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("tool_choice") @ExcludeMissing fun _toolChoice(): JsonField = toolChoice + /** + * Returns the raw JSON value of [topP]. + * + * Unlike [topP], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("top_p") @ExcludeMissing fun _topP(): JsonField = topP + /** + * Returns the raw JSON value of [useCache]. + * + * Unlike [useCache], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("use_cache") @ExcludeMissing fun _useCache(): JsonField = useCache @@ -560,6 +737,13 @@ private constructor( fun frequencyPenalty(frequencyPenalty: Double) = frequencyPenalty(JsonField.of(frequencyPenalty)) + /** + * Sets [Builder.frequencyPenalty] to an arbitrary JSON value. + * + * You should usually call [Builder.frequencyPenalty] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun frequencyPenalty(frequencyPenalty: JsonField) = apply { this.frequencyPenalty = frequencyPenalty } @@ -567,13 +751,25 @@ private constructor( fun functionCall(functionCall: FunctionCall) = functionCall(JsonField.of(functionCall)) + /** + * Sets [Builder.functionCall] to an arbitrary JSON value. + * + * You should usually call [Builder.functionCall] with a well-typed [FunctionCall] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun functionCall(functionCall: JsonField) = apply { this.functionCall = functionCall } + /** + * Alias for calling [functionCall] with + * `FunctionCall.ofUnionMember0(unionMember0)`. + */ fun functionCall(unionMember0: FunctionCall.UnionMember0) = functionCall(FunctionCall.ofUnionMember0(unionMember0)) + /** Alias for calling [functionCall] with `FunctionCall.ofFunction(function)`. */ fun functionCall(function: FunctionCall.Function) = functionCall(FunctionCall.ofFunction(function)) @@ -581,22 +777,49 @@ private constructor( fun maxCompletionTokens(maxCompletionTokens: Double) = maxCompletionTokens(JsonField.of(maxCompletionTokens)) - /** The successor to max_tokens */ + /** + * Sets [Builder.maxCompletionTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.maxCompletionTokens] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun maxCompletionTokens(maxCompletionTokens: JsonField) = apply { this.maxCompletionTokens = maxCompletionTokens } fun maxTokens(maxTokens: Double) = maxTokens(JsonField.of(maxTokens)) + /** + * Sets [Builder.maxTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.maxTokens] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun maxTokens(maxTokens: JsonField) = apply { this.maxTokens = maxTokens } fun n(n: Double) = n(JsonField.of(n)) + /** + * Sets [Builder.n] to an arbitrary JSON value. + * + * You should usually call [Builder.n] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun n(n: JsonField) = apply { this.n = n } fun presencePenalty(presencePenalty: Double) = presencePenalty(JsonField.of(presencePenalty)) + /** + * Sets [Builder.presencePenalty] to an arbitrary JSON value. + * + * You should usually call [Builder.presencePenalty] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun presencePenalty(presencePenalty: JsonField) = apply { this.presencePenalty = presencePenalty } @@ -604,6 +827,13 @@ private constructor( fun reasoningEffort(reasoningEffort: ReasoningEffort) = reasoningEffort(JsonField.of(reasoningEffort)) + /** + * Sets [Builder.reasoningEffort] to an arbitrary JSON value. + * + * You should usually call [Builder.reasoningEffort] with a well-typed + * [ReasoningEffort] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun reasoningEffort(reasoningEffort: JsonField) = apply { this.reasoningEffort = reasoningEffort } @@ -611,28 +841,59 @@ private constructor( fun responseFormat(responseFormat: ResponseFormat?) = responseFormat(JsonField.ofNullable(responseFormat)) + /** + * Alias for calling [Builder.responseFormat] with `responseFormat.orElse(null)`. + */ fun responseFormat(responseFormat: Optional) = responseFormat(responseFormat.getOrNull()) + /** + * Sets [Builder.responseFormat] to an arbitrary JSON value. + * + * You should usually call [Builder.responseFormat] with a well-typed + * [ResponseFormat] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun responseFormat(responseFormat: JsonField) = apply { this.responseFormat = responseFormat } + /** + * Alias for calling [responseFormat] with + * `ResponseFormat.ofJsonObject(jsonObject)`. + */ fun responseFormat(jsonObject: ResponseFormat.JsonObject) = responseFormat(ResponseFormat.ofJsonObject(jsonObject)) + /** + * Alias for calling [responseFormat] with + * `ResponseFormat.ofJsonSchema(jsonSchema)`. + */ fun responseFormat(jsonSchema: ResponseFormat.JsonSchema) = responseFormat(ResponseFormat.ofJsonSchema(jsonSchema)) + /** Alias for calling [responseFormat] with `ResponseFormat.ofText(text)`. */ fun responseFormat(text: ResponseFormat.Text) = responseFormat(ResponseFormat.ofText(text)) fun stop(stop: List) = stop(JsonField.of(stop)) + /** + * Sets [Builder.stop] to an arbitrary JSON value. + * + * You should usually call [Builder.stop] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun stop(stop: JsonField>) = apply { this.stop = stop.map { it.toMutableList() } } + /** + * Adds a single [String] to [Builder.stop]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addStop(stop: String) = apply { this.stop = (this.stop ?: JsonField.of(mutableListOf())).also { @@ -642,28 +903,60 @@ private constructor( fun temperature(temperature: Double) = temperature(JsonField.of(temperature)) + /** + * Sets [Builder.temperature] to an arbitrary JSON value. + * + * You should usually call [Builder.temperature] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun temperature(temperature: JsonField) = apply { this.temperature = temperature } fun toolChoice(toolChoice: ToolChoice) = toolChoice(JsonField.of(toolChoice)) + /** + * Sets [Builder.toolChoice] to an arbitrary JSON value. + * + * You should usually call [Builder.toolChoice] with a well-typed [ToolChoice] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun toolChoice(toolChoice: JsonField) = apply { this.toolChoice = toolChoice } + /** + * Alias for calling [toolChoice] with `ToolChoice.ofUnionMember0(unionMember0)`. + */ fun toolChoice(unionMember0: ToolChoice.UnionMember0) = toolChoice(ToolChoice.ofUnionMember0(unionMember0)) + /** Alias for calling [toolChoice] with `ToolChoice.ofFunction(function)`. */ fun toolChoice(function: ToolChoice.Function) = toolChoice(ToolChoice.ofFunction(function)) fun topP(topP: Double) = topP(JsonField.of(topP)) + /** + * Sets [Builder.topP] to an arbitrary JSON value. + * + * You should usually call [Builder.topP] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun topP(topP: JsonField) = apply { this.topP = topP } fun useCache(useCache: Boolean) = useCache(JsonField.of(useCache)) + /** + * Sets [Builder.useCache] to an arbitrary JSON value. + * + * You should usually call [Builder.useCache] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun useCache(useCache: JsonField) = apply { this.useCache = useCache } fun additionalProperties(additionalProperties: Map) = apply { @@ -963,8 +1256,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -1012,6 +1316,13 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = @@ -1350,8 +1661,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1399,6 +1721,13 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1563,14 +1892,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun jsonSchema(): InnerJsonSchema = jsonSchema.getRequired("json_schema") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [jsonSchema]. + * + * Unlike [jsonSchema], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("json_schema") @ExcludeMissing fun _jsonSchema(): JsonField = jsonSchema + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1623,12 +1974,26 @@ private constructor( fun jsonSchema(jsonSchema: InnerJsonSchema) = jsonSchema(JsonField.of(jsonSchema)) + /** + * Sets [Builder.jsonSchema] to an arbitrary JSON value. + * + * You should usually call [Builder.jsonSchema] with a well-typed + * [InnerJsonSchema] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun jsonSchema(jsonSchema: JsonField) = apply { this.jsonSchema = jsonSchema } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1682,27 +2047,71 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ fun schema(): Optional = Optional.ofNullable(schema.getNullable("schema")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ fun strict(): Optional = Optional.ofNullable(strict.getNullable("strict")) + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [schema]. + * + * Unlike [schema], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("schema") @ExcludeMissing fun _schema(): JsonField = schema + /** + * Returns the raw JSON value of [strict]. + * + * Unlike [strict], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("strict") @ExcludeMissing fun _strict(): JsonField = strict @@ -1763,29 +2172,65 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun description(description: String) = description(JsonField.of(description)) + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun description(description: JsonField) = apply { this.description = description } fun schema(schema: Schema) = schema(JsonField.of(schema)) + /** + * Sets [Builder.schema] to an arbitrary JSON value. + * + * You should usually call [Builder.schema] with a well-typed [Schema] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun schema(schema: JsonField) = apply { this.schema = schema } + /** Alias for calling [schema] with `Schema.ofObject(object_)`. */ fun schema(object_: Schema.Object) = schema(Schema.ofObject(object_)) + /** Alias for calling [schema] with `Schema.ofString(string)`. */ fun schema(string: String) = schema(Schema.ofString(string)) fun strict(strict: Boolean?) = strict(JsonField.ofNullable(strict)) + /** + * Alias for [Builder.strict]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun strict(strict: Boolean) = strict(strict as Boolean?) + /** Alias for calling [Builder.strict] with `strict.orElse(null)`. */ fun strict(strict: Optional) = strict(strict.getOrNull()) + /** + * Sets [Builder.strict] to an arbitrary JSON value. + * + * You should usually call [Builder.strict] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun strict(strict: JsonField) = apply { this.strict = strict } fun additionalProperties(additionalProperties: Map) = @@ -2199,8 +2644,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2248,6 +2704,13 @@ private constructor( fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -2660,14 +3123,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun function(): InnerFunction = function.getRequired("function") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [function]. + * + * Unlike [function], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("function") @ExcludeMissing fun _function(): JsonField = function + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2719,12 +3204,26 @@ private constructor( fun function(function: InnerFunction) = function(JsonField.of(function)) + /** + * Sets [Builder.function] to an arbitrary JSON value. + * + * You should usually call [Builder.function] with a well-typed + * [InnerFunction] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun function(function: JsonField) = apply { this.function = function } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -2769,8 +3268,19 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an + * unexpected type or is unexpectedly missing or null (e.g. if the server + * responded with an unexpected value). + */ fun name(): String = name.getRequired("name") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -2820,6 +3330,13 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = @@ -3036,45 +3553,115 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun maxTokens(): Double = maxTokens.getRequired("max_tokens") + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ fun temperature(): Double = temperature.getRequired("temperature") - /** This is a legacy parameter that should not be used. */ + /** + * This is a legacy parameter that should not be used. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun maxTokensToSample(): Optional = Optional.ofNullable(maxTokensToSample.getNullable("max_tokens_to_sample")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun stopSequences(): Optional> = Optional.ofNullable(stopSequences.getNullable("stop_sequences")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun topK(): Optional = Optional.ofNullable(topK.getNullable("top_k")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun topP(): Optional = Optional.ofNullable(topP.getNullable("top_p")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun useCache(): Optional = Optional.ofNullable(useCache.getNullable("use_cache")) + /** + * Returns the raw JSON value of [maxTokens]. + * + * Unlike [maxTokens], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("max_tokens") @ExcludeMissing fun _maxTokens(): JsonField = maxTokens + /** + * Returns the raw JSON value of [temperature]. + * + * Unlike [temperature], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("temperature") @ExcludeMissing fun _temperature(): JsonField = temperature - /** This is a legacy parameter that should not be used. */ + /** + * Returns the raw JSON value of [maxTokensToSample]. + * + * Unlike [maxTokensToSample], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("max_tokens_to_sample") @ExcludeMissing fun _maxTokensToSample(): JsonField = maxTokensToSample + /** + * Returns the raw JSON value of [stopSequences]. + * + * Unlike [stopSequences], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("stop_sequences") @ExcludeMissing fun _stopSequences(): JsonField> = stopSequences + /** + * Returns the raw JSON value of [topK]. + * + * Unlike [topK], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("top_k") @ExcludeMissing fun _topK(): JsonField = topK + /** + * Returns the raw JSON value of [topP]. + * + * Unlike [topP], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("top_p") @ExcludeMissing fun _topP(): JsonField = topP + /** + * Returns the raw JSON value of [useCache]. + * + * Unlike [useCache], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("use_cache") @ExcludeMissing fun _useCache(): JsonField = useCache @@ -3142,10 +3729,24 @@ private constructor( fun maxTokens(maxTokens: Double) = maxTokens(JsonField.of(maxTokens)) + /** + * Sets [Builder.maxTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.maxTokens] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun maxTokens(maxTokens: JsonField) = apply { this.maxTokens = maxTokens } fun temperature(temperature: Double) = temperature(JsonField.of(temperature)) + /** + * Sets [Builder.temperature] to an arbitrary JSON value. + * + * You should usually call [Builder.temperature] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun temperature(temperature: JsonField) = apply { this.temperature = temperature } @@ -3154,7 +3755,13 @@ private constructor( fun maxTokensToSample(maxTokensToSample: Double) = maxTokensToSample(JsonField.of(maxTokensToSample)) - /** This is a legacy parameter that should not be used. */ + /** + * Sets [Builder.maxTokensToSample] to an arbitrary JSON value. + * + * You should usually call [Builder.maxTokensToSample] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun maxTokensToSample(maxTokensToSample: JsonField) = apply { this.maxTokensToSample = maxTokensToSample } @@ -3162,10 +3769,22 @@ private constructor( fun stopSequences(stopSequences: List) = stopSequences(JsonField.of(stopSequences)) + /** + * Sets [Builder.stopSequences] to an arbitrary JSON value. + * + * You should usually call [Builder.stopSequences] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun stopSequences(stopSequences: JsonField>) = apply { this.stopSequences = stopSequences.map { it.toMutableList() } } + /** + * Adds a single [String] to [stopSequences]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addStopSequence(stopSequence: String) = apply { stopSequences = (stopSequences ?: JsonField.of(mutableListOf())).also { @@ -3175,14 +3794,35 @@ private constructor( fun topK(topK: Double) = topK(JsonField.of(topK)) + /** + * Sets [Builder.topK] to an arbitrary JSON value. + * + * You should usually call [Builder.topK] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun topK(topK: JsonField) = apply { this.topK = topK } fun topP(topP: Double) = topP(JsonField.of(topP)) + /** + * Sets [Builder.topP] to an arbitrary JSON value. + * + * You should usually call [Builder.topP] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun topP(topP: JsonField) = apply { this.topP = topP } fun useCache(useCache: Boolean) = useCache(JsonField.of(useCache)) + /** + * Sets [Builder.useCache] to an arbitrary JSON value. + * + * You should usually call [Builder.useCache] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun useCache(useCache: JsonField) = apply { this.useCache = useCache } fun additionalProperties(additionalProperties: Map) = apply { @@ -3261,31 +3901,79 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun maxOutputTokens(): Optional = Optional.ofNullable(maxOutputTokens.getNullable("maxOutputTokens")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun temperature(): Optional = Optional.ofNullable(temperature.getNullable("temperature")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun topK(): Optional = Optional.ofNullable(topK.getNullable("topK")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun topP(): Optional = Optional.ofNullable(topP.getNullable("topP")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun useCache(): Optional = Optional.ofNullable(useCache.getNullable("use_cache")) + /** + * Returns the raw JSON value of [maxOutputTokens]. + * + * Unlike [maxOutputTokens], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("maxOutputTokens") @ExcludeMissing fun _maxOutputTokens(): JsonField = maxOutputTokens + /** + * Returns the raw JSON value of [temperature]. + * + * Unlike [temperature], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("temperature") @ExcludeMissing fun _temperature(): JsonField = temperature + /** + * Returns the raw JSON value of [topK]. + * + * Unlike [topK], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("topK") @ExcludeMissing fun _topK(): JsonField = topK + /** + * Returns the raw JSON value of [topP]. + * + * Unlike [topP], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("topP") @ExcludeMissing fun _topP(): JsonField = topP + /** + * Returns the raw JSON value of [useCache]. + * + * Unlike [useCache], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("use_cache") @ExcludeMissing fun _useCache(): JsonField = useCache @@ -3342,26 +4030,61 @@ private constructor( fun maxOutputTokens(maxOutputTokens: Double) = maxOutputTokens(JsonField.of(maxOutputTokens)) + /** + * Sets [Builder.maxOutputTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.maxOutputTokens] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun maxOutputTokens(maxOutputTokens: JsonField) = apply { this.maxOutputTokens = maxOutputTokens } fun temperature(temperature: Double) = temperature(JsonField.of(temperature)) + /** + * Sets [Builder.temperature] to an arbitrary JSON value. + * + * You should usually call [Builder.temperature] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun temperature(temperature: JsonField) = apply { this.temperature = temperature } fun topK(topK: Double) = topK(JsonField.of(topK)) + /** + * Sets [Builder.topK] to an arbitrary JSON value. + * + * You should usually call [Builder.topK] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun topK(topK: JsonField) = apply { this.topK = topK } fun topP(topP: Double) = topP(JsonField.of(topP)) + /** + * Sets [Builder.topP] to an arbitrary JSON value. + * + * You should usually call [Builder.topP] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun topP(topP: JsonField) = apply { this.topP = topP } fun useCache(useCache: Boolean) = useCache(JsonField.of(useCache)) + /** + * Sets [Builder.useCache] to an arbitrary JSON value. + * + * You should usually call [Builder.useCache] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun useCache(useCache: JsonField) = apply { this.useCache = useCache } fun additionalProperties(additionalProperties: Map) = apply { @@ -3432,20 +4155,49 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun temperature(): Optional = Optional.ofNullable(temperature.getNullable("temperature")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun topK(): Optional = Optional.ofNullable(topK.getNullable("topK")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun useCache(): Optional = Optional.ofNullable(useCache.getNullable("use_cache")) + /** + * Returns the raw JSON value of [temperature]. + * + * Unlike [temperature], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("temperature") @ExcludeMissing fun _temperature(): JsonField = temperature + /** + * Returns the raw JSON value of [topK]. + * + * Unlike [topK], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("topK") @ExcludeMissing fun _topK(): JsonField = topK + /** + * Returns the raw JSON value of [useCache]. + * + * Unlike [useCache], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("use_cache") @ExcludeMissing fun _useCache(): JsonField = useCache @@ -3495,16 +4247,37 @@ private constructor( fun temperature(temperature: Double) = temperature(JsonField.of(temperature)) + /** + * Sets [Builder.temperature] to an arbitrary JSON value. + * + * You should usually call [Builder.temperature] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun temperature(temperature: JsonField) = apply { this.temperature = temperature } fun topK(topK: Double) = topK(JsonField.of(topK)) + /** + * Sets [Builder.topK] to an arbitrary JSON value. + * + * You should usually call [Builder.topK] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun topK(topK: JsonField) = apply { this.topK = topK } fun useCache(useCache: Boolean) = useCache(JsonField.of(useCache)) + /** + * Sets [Builder.useCache] to an arbitrary JSON value. + * + * You should usually call [Builder.useCache] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun useCache(useCache: JsonField) = apply { this.useCache = useCache } fun additionalProperties(additionalProperties: Map) = apply { @@ -3567,9 +4340,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun useCache(): Optional = Optional.ofNullable(useCache.getNullable("use_cache")) + /** + * Returns the raw JSON value of [useCache]. + * + * Unlike [useCache], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("use_cache") @ExcludeMissing fun _useCache(): JsonField = useCache @@ -3613,6 +4396,13 @@ private constructor( fun useCache(useCache: Boolean) = useCache(JsonField.of(useCache)) + /** + * Sets [Builder.useCache] to an arbitrary JSON value. + * + * You should usually call [Builder.useCache] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun useCache(useCache: JsonField) = apply { this.useCache = useCache } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptReplaceParams.kt index cf0797b3..5ab67b6c 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptReplaceParams.kt @@ -35,44 +35,107 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = body.slug() - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun functionType(): Optional = body.functionType() - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = body.promptData() - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = body.tags() - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ fun _slug(): JsonField = body._slug() - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _functionType(): JsonField = body._functionType() - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _promptData(): JsonField = body._promptData() - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ fun _tags(): JsonField> = body._tags() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -116,53 +179,117 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the prompt belongs under */ + /** + * Unique identifier for the project that the prompt belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun slug(): String = slug.getRequired("slug") - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun functionType(): Optional = Optional.ofNullable(functionType.getNullable("function_type")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the prompt belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [functionType]. + * + * Unlike [functionType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("function_type") @ExcludeMissing fun _functionType(): JsonField = functionType - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -230,28 +357,52 @@ private constructor( /** Name of the prompt */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** Unique identifier for the prompt */ fun slug(slug: String) = slug(JsonField.of(slug)) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -259,9 +410,17 @@ private constructor( fun functionType(functionType: FunctionType?) = functionType(JsonField.ofNullable(functionType)) + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { this.functionType = functionType } @@ -269,10 +428,16 @@ private constructor( /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } @@ -280,15 +445,25 @@ private constructor( /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } @@ -379,35 +554,65 @@ private constructor( /** Name of the prompt */ fun name(name: String) = apply { body.name(name) } - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the prompt belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the prompt belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** Unique identifier for the prompt */ fun slug(slug: String) = apply { body.slug(slug) } - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { body.slug(slug) } /** Textual description of the prompt */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun functionType(functionType: FunctionType?) = apply { body.functionType(functionType) } + /** Alias for calling [Builder.functionType] with `functionType.orElse(null)`. */ fun functionType(functionType: Optional) = functionType(functionType.getOrNull()) + /** + * Sets [Builder.functionType] to an arbitrary JSON value. + * + * You should usually call [Builder.functionType] with a well-typed [FunctionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun functionType(functionType: JsonField) = apply { body.functionType(functionType) } @@ -415,22 +620,38 @@ private constructor( /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = apply { body.promptData(promptData) } - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { body.promptData(promptData) } /** A list of tags for the prompt */ fun tags(tags: List?) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { body.addTag(tag) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptUpdateParams.kt index d8447483..c4f6f117 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/PromptUpdateParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -38,34 +39,79 @@ private constructor( /** Prompt id */ fun promptId(): String = promptId - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun promptData(): Optional = body.promptData() - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun slug(): Optional = body.slug() - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tags(): Optional> = body.tags() - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _promptData(): JsonField = body._promptData() - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ fun _slug(): JsonField = body._slug() - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ fun _tags(): JsonField> = body._tags() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -110,40 +156,85 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Textual description of the prompt */ + /** + * Textual description of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the prompt */ + /** + * Name of the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The prompt, model, and its parameters */ + /** + * The prompt, model, and its parameters + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun promptData(): Optional = Optional.ofNullable(promptData.getNullable("prompt_data")) - /** Unique identifier for the prompt */ + /** + * Unique identifier for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun slug(): Optional = Optional.ofNullable(slug.getNullable("slug")) - /** A list of tags for the prompt */ + /** + * A list of tags for the prompt + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun tags(): Optional> = Optional.ofNullable(tags.getNullable("tags")) - /** Textual description of the prompt */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** Name of the prompt */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The prompt, model, and its parameters */ + /** + * Returns the raw JSON value of [promptData]. + * + * Unlike [promptData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("prompt_data") @ExcludeMissing fun _promptData(): JsonField = promptData - /** Unique identifier for the prompt */ + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug - /** A list of tags for the prompt */ + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags @JsonAnyGetter @@ -196,10 +287,16 @@ private constructor( /** Textual description of the prompt */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -207,19 +304,31 @@ private constructor( /** Name of the prompt */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the prompt */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = promptData(JsonField.ofNullable(promptData)) - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { this.promptData = promptData } @@ -227,24 +336,40 @@ private constructor( /** Unique identifier for the prompt */ fun slug(slug: String?) = slug(JsonField.ofNullable(slug)) - /** Unique identifier for the prompt */ + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ fun slug(slug: Optional) = slug(slug.getOrNull()) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun slug(slug: JsonField) = apply { this.slug = slug } /** A list of tags for the prompt */ fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } @@ -336,49 +461,81 @@ private constructor( /** Textual description of the prompt */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the prompt */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the prompt */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** Name of the prompt */ fun name(name: String?) = apply { body.name(name) } - /** Name of the prompt */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the prompt */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The prompt, model, and its parameters */ fun promptData(promptData: PromptData?) = apply { body.promptData(promptData) } - /** The prompt, model, and its parameters */ + /** Alias for calling [Builder.promptData] with `promptData.orElse(null)`. */ fun promptData(promptData: Optional) = promptData(promptData.getOrNull()) - /** The prompt, model, and its parameters */ + /** + * Sets [Builder.promptData] to an arbitrary JSON value. + * + * You should usually call [Builder.promptData] with a well-typed [PromptData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun promptData(promptData: JsonField) = apply { body.promptData(promptData) } /** Unique identifier for the prompt */ fun slug(slug: String?) = apply { body.slug(slug) } - /** Unique identifier for the prompt */ + /** Alias for calling [Builder.slug] with `slug.orElse(null)`. */ fun slug(slug: Optional) = slug(slug.getOrNull()) - /** Unique identifier for the prompt */ + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun slug(slug: JsonField) = apply { body.slug(slug) } /** A list of tags for the prompt */ fun tags(tags: List?) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ fun tags(tags: Optional>) = tags(tags.getOrNull()) - /** A list of tags for the prompt */ + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tags(tags: JsonField>) = apply { body.tags(tags) } - /** A list of tags for the prompt */ + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: String) = apply { body.addTag(tag) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RepoInfo.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RepoInfo.kt index a938b801..3a1bb0be 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RepoInfo.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RepoInfo.kt @@ -9,6 +9,7 @@ import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -48,70 +49,146 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Email of the author of the most recent commit */ + /** + * Email of the author of the most recent commit + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authorEmail(): Optional = Optional.ofNullable(authorEmail.getNullable("author_email")) - /** Name of the author of the most recent commit */ + /** + * Name of the author of the most recent commit + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authorName(): Optional = Optional.ofNullable(authorName.getNullable("author_name")) - /** Name of the branch the most recent commit belongs to */ + /** + * Name of the branch the most recent commit belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun branch(): Optional = Optional.ofNullable(branch.getNullable("branch")) - /** SHA of most recent commit */ + /** + * SHA of most recent commit + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun commit(): Optional = Optional.ofNullable(commit.getNullable("commit")) - /** Most recent commit message */ + /** + * Most recent commit message + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun commitMessage(): Optional = Optional.ofNullable(commitMessage.getNullable("commit_message")) - /** Time of the most recent commit */ + /** + * Time of the most recent commit + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun commitTime(): Optional = Optional.ofNullable(commitTime.getNullable("commit_time")) - /** Whether or not the repo had uncommitted changes when snapshotted */ + /** + * Whether or not the repo had uncommitted changes when snapshotted + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dirty(): Optional = Optional.ofNullable(dirty.getNullable("dirty")) /** * If the repo was dirty when run, this includes the diff between the current state of the repo * and the most recent commit. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun gitDiff(): Optional = Optional.ofNullable(gitDiff.getNullable("git_diff")) - /** Name of the tag on the most recent commit */ + /** + * Name of the tag on the most recent commit + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tag(): Optional = Optional.ofNullable(tag.getNullable("tag")) - /** Email of the author of the most recent commit */ + /** + * Returns the raw JSON value of [authorEmail]. + * + * Unlike [authorEmail], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("author_email") @ExcludeMissing fun _authorEmail(): JsonField = authorEmail - /** Name of the author of the most recent commit */ + /** + * Returns the raw JSON value of [authorName]. + * + * Unlike [authorName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("author_name") @ExcludeMissing fun _authorName(): JsonField = authorName - /** Name of the branch the most recent commit belongs to */ + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch - /** SHA of most recent commit */ + /** + * Returns the raw JSON value of [commit]. + * + * Unlike [commit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit") @ExcludeMissing fun _commit(): JsonField = commit - /** Most recent commit message */ + /** + * Returns the raw JSON value of [commitMessage]. + * + * Unlike [commitMessage], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit_message") @ExcludeMissing fun _commitMessage(): JsonField = commitMessage - /** Time of the most recent commit */ + /** + * Returns the raw JSON value of [commitTime]. + * + * Unlike [commitTime], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commit_time") @ExcludeMissing fun _commitTime(): JsonField = commitTime - /** Whether or not the repo had uncommitted changes when snapshotted */ + /** + * Returns the raw JSON value of [dirty]. + * + * Unlike [dirty], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dirty") @ExcludeMissing fun _dirty(): JsonField = dirty /** - * If the repo was dirty when run, this includes the diff between the current state of the repo - * and the most recent commit. + * Returns the raw JSON value of [gitDiff]. + * + * Unlike [gitDiff], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("git_diff") @ExcludeMissing fun _gitDiff(): JsonField = gitDiff - /** Name of the tag on the most recent commit */ + /** + * Returns the raw JSON value of [tag]. + * + * Unlike [tag], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tag") @ExcludeMissing fun _tag(): JsonField = tag @JsonAnyGetter @@ -176,48 +253,76 @@ private constructor( /** Email of the author of the most recent commit */ fun authorEmail(authorEmail: String?) = authorEmail(JsonField.ofNullable(authorEmail)) - /** Email of the author of the most recent commit */ + /** Alias for calling [Builder.authorEmail] with `authorEmail.orElse(null)`. */ fun authorEmail(authorEmail: Optional) = authorEmail(authorEmail.getOrNull()) - /** Email of the author of the most recent commit */ + /** + * Sets [Builder.authorEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.authorEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun authorEmail(authorEmail: JsonField) = apply { this.authorEmail = authorEmail } /** Name of the author of the most recent commit */ fun authorName(authorName: String?) = authorName(JsonField.ofNullable(authorName)) - /** Name of the author of the most recent commit */ + /** Alias for calling [Builder.authorName] with `authorName.orElse(null)`. */ fun authorName(authorName: Optional) = authorName(authorName.getOrNull()) - /** Name of the author of the most recent commit */ + /** + * Sets [Builder.authorName] to an arbitrary JSON value. + * + * You should usually call [Builder.authorName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun authorName(authorName: JsonField) = apply { this.authorName = authorName } /** Name of the branch the most recent commit belongs to */ fun branch(branch: String?) = branch(JsonField.ofNullable(branch)) - /** Name of the branch the most recent commit belongs to */ + /** Alias for calling [Builder.branch] with `branch.orElse(null)`. */ fun branch(branch: Optional) = branch(branch.getOrNull()) - /** Name of the branch the most recent commit belongs to */ + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun branch(branch: JsonField) = apply { this.branch = branch } /** SHA of most recent commit */ fun commit(commit: String?) = commit(JsonField.ofNullable(commit)) - /** SHA of most recent commit */ + /** Alias for calling [Builder.commit] with `commit.orElse(null)`. */ fun commit(commit: Optional) = commit(commit.getOrNull()) - /** SHA of most recent commit */ + /** + * Sets [Builder.commit] to an arbitrary JSON value. + * + * You should usually call [Builder.commit] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun commit(commit: JsonField) = apply { this.commit = commit } /** Most recent commit message */ fun commitMessage(commitMessage: String?) = commitMessage(JsonField.ofNullable(commitMessage)) - /** Most recent commit message */ + /** Alias for calling [Builder.commitMessage] with `commitMessage.orElse(null)`. */ fun commitMessage(commitMessage: Optional) = commitMessage(commitMessage.getOrNull()) - /** Most recent commit message */ + /** + * Sets [Builder.commitMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.commitMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun commitMessage(commitMessage: JsonField) = apply { this.commitMessage = commitMessage } @@ -225,22 +330,37 @@ private constructor( /** Time of the most recent commit */ fun commitTime(commitTime: String?) = commitTime(JsonField.ofNullable(commitTime)) - /** Time of the most recent commit */ + /** Alias for calling [Builder.commitTime] with `commitTime.orElse(null)`. */ fun commitTime(commitTime: Optional) = commitTime(commitTime.getOrNull()) - /** Time of the most recent commit */ + /** + * Sets [Builder.commitTime] to an arbitrary JSON value. + * + * You should usually call [Builder.commitTime] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun commitTime(commitTime: JsonField) = apply { this.commitTime = commitTime } /** Whether or not the repo had uncommitted changes when snapshotted */ fun dirty(dirty: Boolean?) = dirty(JsonField.ofNullable(dirty)) - /** Whether or not the repo had uncommitted changes when snapshotted */ + /** + * Alias for [Builder.dirty]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun dirty(dirty: Boolean) = dirty(dirty as Boolean?) - /** Whether or not the repo had uncommitted changes when snapshotted */ + /** Alias for calling [Builder.dirty] with `dirty.orElse(null)`. */ fun dirty(dirty: Optional) = dirty(dirty.getOrNull()) - /** Whether or not the repo had uncommitted changes when snapshotted */ + /** + * Sets [Builder.dirty] to an arbitrary JSON value. + * + * You should usually call [Builder.dirty] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun dirty(dirty: JsonField) = apply { this.dirty = dirty } /** @@ -249,25 +369,29 @@ private constructor( */ fun gitDiff(gitDiff: String?) = gitDiff(JsonField.ofNullable(gitDiff)) - /** - * If the repo was dirty when run, this includes the diff between the current state of the - * repo and the most recent commit. - */ + /** Alias for calling [Builder.gitDiff] with `gitDiff.orElse(null)`. */ fun gitDiff(gitDiff: Optional) = gitDiff(gitDiff.getOrNull()) /** - * If the repo was dirty when run, this includes the diff between the current state of the - * repo and the most recent commit. + * Sets [Builder.gitDiff] to an arbitrary JSON value. + * + * You should usually call [Builder.gitDiff] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun gitDiff(gitDiff: JsonField) = apply { this.gitDiff = gitDiff } /** Name of the tag on the most recent commit */ fun tag(tag: String?) = tag(JsonField.ofNullable(tag)) - /** Name of the tag on the most recent commit */ + /** Alias for calling [Builder.tag] with `tag.orElse(null)`. */ fun tag(tag: Optional) = tag(tag.getOrNull()) - /** Name of the tag on the most recent commit */ + /** + * Sets [Builder.tag] to an arbitrary JSON value. + * + * You should usually call [Builder.tag] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun tag(tag: JsonField) = apply { this.tag = tag } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Role.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Role.kt index 73603212..a01c4d2e 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Role.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Role.kt @@ -11,6 +11,7 @@ import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -53,24 +54,54 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the role */ + /** + * Unique identifier for the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Date of role creation */ + /** + * Date of role creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date of role deletion, or null if the role is still active */ + /** + * Date of role deletion, or null if the role is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * (permission, restrict_object_type) tuples which belong to this role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun memberPermissions(): Optional> = Optional.ofNullable(memberPermissions.getNullable("member_permissions")) @@ -79,6 +110,9 @@ private constructor( * * An inheriting role has all the permissions contained in its member roles, as well as all of * their inherited permissions + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun memberRoles(): Optional> = Optional.ofNullable(memberRoles.getNullable("member_roles")) @@ -90,55 +124,88 @@ private constructor( * other role, but cannot be edited. * * It is forbidden to change the org after creating a role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgId(): Optional = Optional.ofNullable(orgId.getNullable("org_id")) - /** Identifies the user who created the role */ + /** + * Identifies the user who created the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the role */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Date of role creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date of role deletion, or null if the role is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Returns the raw JSON value of [memberPermissions]. + * + * Unlike [memberPermissions], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("member_permissions") @ExcludeMissing fun _memberPermissions(): JsonField> = memberPermissions /** - * Ids of the roles this role inherits from + * Returns the raw JSON value of [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all of - * their inherited permissions + * Unlike [memberRoles], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("member_roles") @ExcludeMissing fun _memberRoles(): JsonField> = memberRoles /** - * Unique id for the organization that the role belongs under - * - * A null org_id indicates a system role, which may be assigned to anybody and inherited by any - * other role, but cannot be edited. + * Returns the raw JSON value of [orgId]. * - * It is forbidden to change the org after creating a role + * Unlike [orgId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_id") @ExcludeMissing fun _orgId(): JsonField = orgId - /** Identifies the user who created the role */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -211,56 +278,94 @@ private constructor( /** Unique identifier for the role */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the role */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the role */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Date of role creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of role creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of role creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date of role deletion, or null if the role is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of role deletion, or null if the role is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of role deletion, or null if the role is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } /** Textual description of the role */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** (permission, restrict_object_type) tuples which belong to this role */ fun memberPermissions(memberPermissions: List?) = memberPermissions(JsonField.ofNullable(memberPermissions)) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** Alias for calling [Builder.memberPermissions] with `memberPermissions.orElse(null)`. */ fun memberPermissions(memberPermissions: Optional>) = memberPermissions(memberPermissions.getOrNull()) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Sets [Builder.memberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.memberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun memberPermissions(memberPermissions: JsonField>) = apply { this.memberPermissions = memberPermissions.map { it.toMutableList() } } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Adds a single [MemberPermission] to [memberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberPermission(memberPermission: MemberPermission) = apply { memberPermissions = (memberPermissions ?: JsonField.of(mutableListOf())).also { @@ -276,29 +381,24 @@ private constructor( */ fun memberRoles(memberRoles: List?) = memberRoles(JsonField.ofNullable(memberRoles)) - /** - * Ids of the roles this role inherits from - * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions - */ + /** Alias for calling [Builder.memberRoles] with `memberRoles.orElse(null)`. */ fun memberRoles(memberRoles: Optional>) = memberRoles(memberRoles.getOrNull()) /** - * Ids of the roles this role inherits from + * Sets [Builder.memberRoles] to an arbitrary JSON value. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * You should usually call [Builder.memberRoles] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberRoles(memberRoles: JsonField>) = apply { this.memberRoles = memberRoles.map { it.toMutableList() } } /** - * Ids of the roles this role inherits from + * Adds a single [String] to [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberRole(memberRole: String) = apply { memberRoles = @@ -317,33 +417,29 @@ private constructor( */ fun orgId(orgId: String?) = orgId(JsonField.ofNullable(orgId)) - /** - * Unique id for the organization that the role belongs under - * - * A null org_id indicates a system role, which may be assigned to anybody and inherited by - * any other role, but cannot be edited. - * - * It is forbidden to change the org after creating a role - */ + /** Alias for calling [Builder.orgId] with `orgId.orElse(null)`. */ fun orgId(orgId: Optional) = orgId(orgId.getOrNull()) /** - * Unique id for the organization that the role belongs under + * Sets [Builder.orgId] to an arbitrary JSON value. * - * A null org_id indicates a system role, which may be assigned to anybody and inherited by - * any other role, but cannot be edited. - * - * It is forbidden to change the org after creating a role + * You should usually call [Builder.orgId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgId(orgId: JsonField) = apply { this.orgId = orgId } /** Identifies the user who created the role */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the role */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the role */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { @@ -398,23 +494,36 @@ private constructor( * 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 + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun permission(): Permission = permission.getRequired("permission") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** - * Each permission permits a certain type of operation on an object in the system + * Returns the raw JSON value of [permission]. * - * Permissions can be assigned to to objects on an individual basis, or grouped into roles + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType @@ -473,10 +582,11 @@ private constructor( fun permission(permission: Permission) = permission(JsonField.of(permission)) /** - * Each permission permits a certain type of operation on an object in the system + * Sets [Builder.permission] to an arbitrary JSON value. * - * Permissions can be assigned to to objects on an individual basis, or grouped into - * roles + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -486,11 +596,20 @@ private constructor( fun restrictObjectType(restrictObjectType: AclObjectType?) = restrictObjectType(JsonField.ofNullable(restrictObjectType)) - /** The object type that the ACL applies to */ + /** + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. + */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleCreateParams.kt index 28abbef7..747af4d0 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleCreateParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,13 +34,28 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * (permission, restrict_object_type) tuples which belong to this role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun memberPermissions(): Optional> = body.memberPermissions() /** @@ -47,6 +63,9 @@ private constructor( * * An inheriting role has all the permissions contained in its member roles, as well as all of * their inherited permissions + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun memberRoles(): Optional> = body.memberRoles() @@ -54,30 +73,45 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * role belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Returns the raw JSON value of [memberPermissions]. + * + * Unlike [memberPermissions], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _memberPermissions(): JsonField> = body._memberPermissions() /** - * Ids of the roles this role inherits from + * Returns the raw JSON value of [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all of - * their inherited permissions + * Unlike [memberRoles], this method doesn't throw if the JSON field has an unexpected type. */ fun _memberRoles(): JsonField> = body._memberRoles() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * role belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -116,14 +150,29 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * (permission, restrict_object_type) tuples which belong to this role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun memberPermissions(): Optional> = Optional.ofNullable(memberPermissions.getNullable("member_permissions")) @@ -132,6 +181,9 @@ private constructor( * * An inheriting role has all the permissions contained in its member roles, as well as all * of their inherited permissions + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun memberRoles(): Optional> = Optional.ofNullable(memberRoles.getNullable("member_roles")) @@ -140,36 +192,51 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the role belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Returns the raw JSON value of [memberPermissions]. + * + * Unlike [memberPermissions], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("member_permissions") @ExcludeMissing fun _memberPermissions(): JsonField> = memberPermissions /** - * Ids of the roles this role inherits from + * Returns the raw JSON value of [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * Unlike [memberRoles], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("member_roles") @ExcludeMissing fun _memberRoles(): JsonField> = memberRoles /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -230,16 +297,28 @@ private constructor( /** Name of the role */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Textual description of the role */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -248,16 +327,28 @@ private constructor( fun memberPermissions(memberPermissions: List?) = memberPermissions(JsonField.ofNullable(memberPermissions)) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Alias for calling [Builder.memberPermissions] with `memberPermissions.orElse(null)`. + */ fun memberPermissions(memberPermissions: Optional>) = memberPermissions(memberPermissions.getOrNull()) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Sets [Builder.memberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.memberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun memberPermissions(memberPermissions: JsonField>) = apply { this.memberPermissions = memberPermissions.map { it.toMutableList() } } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Adds a single [MemberPermission] to [memberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberPermission(memberPermission: MemberPermission) = apply { memberPermissions = (memberPermissions ?: JsonField.of(mutableListOf())).also { @@ -274,30 +365,25 @@ private constructor( fun memberRoles(memberRoles: List?) = memberRoles(JsonField.ofNullable(memberRoles)) - /** - * Ids of the roles this role inherits from - * - * An inheriting role has all the permissions contained in its member roles, as well as - * all of their inherited permissions - */ + /** Alias for calling [Builder.memberRoles] with `memberRoles.orElse(null)`. */ fun memberRoles(memberRoles: Optional>) = memberRoles(memberRoles.getOrNull()) /** - * Ids of the roles this role inherits from + * Sets [Builder.memberRoles] to an arbitrary JSON value. * - * An inheriting role has all the permissions contained in its member roles, as well as - * all of their inherited permissions + * You should usually call [Builder.memberRoles] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberRoles(memberRoles: JsonField>) = apply { this.memberRoles = memberRoles.map { it.toMutableList() } } /** - * Ids of the roles this role inherits from + * Adds a single [String] to [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as - * all of their inherited permissions + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberRole(memberRole: String) = apply { memberRoles = @@ -313,17 +399,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -408,16 +492,27 @@ private constructor( /** Name of the role */ fun name(name: String) = apply { body.name(name) } - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Textual description of the role */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** (permission, restrict_object_type) tuples which belong to this role */ @@ -425,16 +520,26 @@ private constructor( body.memberPermissions(memberPermissions) } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** Alias for calling [Builder.memberPermissions] with `memberPermissions.orElse(null)`. */ fun memberPermissions(memberPermissions: Optional>) = memberPermissions(memberPermissions.getOrNull()) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Sets [Builder.memberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.memberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun memberPermissions(memberPermissions: JsonField>) = apply { body.memberPermissions(memberPermissions) } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Adds a single [MemberPermission] to [memberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberPermission(memberPermission: MemberPermission) = apply { body.addMemberPermission(memberPermission) } @@ -447,29 +552,24 @@ private constructor( */ fun memberRoles(memberRoles: List?) = apply { body.memberRoles(memberRoles) } - /** - * Ids of the roles this role inherits from - * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions - */ + /** Alias for calling [Builder.memberRoles] with `memberRoles.orElse(null)`. */ fun memberRoles(memberRoles: Optional>) = memberRoles(memberRoles.getOrNull()) /** - * Ids of the roles this role inherits from + * Sets [Builder.memberRoles] to an arbitrary JSON value. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * You should usually call [Builder.memberRoles] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberRoles(memberRoles: JsonField>) = apply { body.memberRoles(memberRoles) } /** - * Ids of the roles this role inherits from + * Adds a single [String] to [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberRole(memberRole: String) = apply { body.addMemberRole(memberRole) } @@ -480,17 +580,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } @@ -633,23 +730,36 @@ private constructor( * 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 + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun permission(): Permission = permission.getRequired("permission") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** - * Each permission permits a certain type of operation on an object in the system + * Returns the raw JSON value of [permission]. * - * Permissions can be assigned to to objects on an individual basis, or grouped into roles + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType @@ -708,10 +818,11 @@ private constructor( fun permission(permission: Permission) = permission(JsonField.of(permission)) /** - * Each permission permits a certain type of operation on an object in the system + * Sets [Builder.permission] to an arbitrary JSON value. * - * Permissions can be assigned to to objects on an individual basis, or grouped into - * roles + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -721,11 +832,20 @@ private constructor( fun restrictObjectType(restrictObjectType: AclObjectType?) = restrictObjectType(JsonField.ofNullable(restrictObjectType)) - /** The object type that the ACL applies to */ + /** + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. + */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleListParams.kt index df21940e..167baa72 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleListParams.kt @@ -133,13 +133,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -148,43 +142,38 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Name of the role to search for */ fun roleName(roleName: String?) = apply { this.roleName = roleName } - /** Name of the role to search for */ + /** Alias for calling [Builder.roleName] with `roleName.orElse(null)`. */ fun roleName(roleName: Optional) = roleName(roleName.getOrNull()) /** @@ -196,13 +185,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleReplaceParams.kt index cfb06936..f5fa9c8c 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleReplaceParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -33,13 +34,28 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * (permission, restrict_object_type) tuples which belong to this role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun memberPermissions(): Optional> = body.memberPermissions() /** @@ -47,6 +63,9 @@ private constructor( * * An inheriting role has all the permissions contained in its member roles, as well as all of * their inherited permissions + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun memberRoles(): Optional> = body.memberRoles() @@ -54,30 +73,45 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that your * API key belongs to multiple organizations, you may specify the name of the organization the * role belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun orgName(): Optional = body.orgName() - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Returns the raw JSON value of [memberPermissions]. + * + * Unlike [memberPermissions], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _memberPermissions(): JsonField> = body._memberPermissions() /** - * Ids of the roles this role inherits from + * Returns the raw JSON value of [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all of - * their inherited permissions + * Unlike [memberRoles], this method doesn't throw if the JSON field has an unexpected type. */ fun _memberRoles(): JsonField> = body._memberRoles() /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that your - * API key belongs to multiple organizations, you may specify the name of the organization the - * role belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ fun _orgName(): JsonField = body._orgName() @@ -116,14 +150,29 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * (permission, restrict_object_type) tuples which belong to this role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun memberPermissions(): Optional> = Optional.ofNullable(memberPermissions.getNullable("member_permissions")) @@ -132,6 +181,9 @@ private constructor( * * An inheriting role has all the permissions contained in its member roles, as well as all * of their inherited permissions + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun memberRoles(): Optional> = Optional.ofNullable(memberRoles.getNullable("member_roles")) @@ -140,36 +192,51 @@ private constructor( * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the * organization the role belongs in. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun orgName(): Optional = Optional.ofNullable(orgName.getNullable("org_name")) - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Returns the raw JSON value of [memberPermissions]. + * + * Unlike [memberPermissions], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("member_permissions") @ExcludeMissing fun _memberPermissions(): JsonField> = memberPermissions /** - * Ids of the roles this role inherits from + * Returns the raw JSON value of [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * Unlike [memberRoles], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("member_roles") @ExcludeMissing fun _memberRoles(): JsonField> = memberRoles /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. + * Returns the raw JSON value of [orgName]. + * + * Unlike [orgName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("org_name") @ExcludeMissing fun _orgName(): JsonField = orgName @@ -230,16 +297,28 @@ private constructor( /** Name of the role */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Textual description of the role */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -248,16 +327,28 @@ private constructor( fun memberPermissions(memberPermissions: List?) = memberPermissions(JsonField.ofNullable(memberPermissions)) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Alias for calling [Builder.memberPermissions] with `memberPermissions.orElse(null)`. + */ fun memberPermissions(memberPermissions: Optional>) = memberPermissions(memberPermissions.getOrNull()) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Sets [Builder.memberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.memberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun memberPermissions(memberPermissions: JsonField>) = apply { this.memberPermissions = memberPermissions.map { it.toMutableList() } } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Adds a single [MemberPermission] to [memberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberPermission(memberPermission: MemberPermission) = apply { memberPermissions = (memberPermissions ?: JsonField.of(mutableListOf())).also { @@ -274,30 +365,25 @@ private constructor( fun memberRoles(memberRoles: List?) = memberRoles(JsonField.ofNullable(memberRoles)) - /** - * Ids of the roles this role inherits from - * - * An inheriting role has all the permissions contained in its member roles, as well as - * all of their inherited permissions - */ + /** Alias for calling [Builder.memberRoles] with `memberRoles.orElse(null)`. */ fun memberRoles(memberRoles: Optional>) = memberRoles(memberRoles.getOrNull()) /** - * Ids of the roles this role inherits from + * Sets [Builder.memberRoles] to an arbitrary JSON value. * - * An inheriting role has all the permissions contained in its member roles, as well as - * all of their inherited permissions + * You should usually call [Builder.memberRoles] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberRoles(memberRoles: JsonField>) = apply { this.memberRoles = memberRoles.map { it.toMutableList() } } /** - * Ids of the roles this role inherits from + * Adds a single [String] to [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as - * all of their inherited permissions + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberRole(memberRole: String) = apply { memberRoles = @@ -313,17 +399,15 @@ private constructor( */ fun orgName(orgName: String?) = orgName(JsonField.ofNullable(orgName)) - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun orgName(orgName: JsonField) = apply { this.orgName = orgName } @@ -408,16 +492,27 @@ private constructor( /** Name of the role */ fun name(name: String) = apply { body.name(name) } - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Textual description of the role */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** (permission, restrict_object_type) tuples which belong to this role */ @@ -425,16 +520,26 @@ private constructor( body.memberPermissions(memberPermissions) } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** Alias for calling [Builder.memberPermissions] with `memberPermissions.orElse(null)`. */ fun memberPermissions(memberPermissions: Optional>) = memberPermissions(memberPermissions.getOrNull()) - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Sets [Builder.memberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.memberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun memberPermissions(memberPermissions: JsonField>) = apply { body.memberPermissions(memberPermissions) } - /** (permission, restrict_object_type) tuples which belong to this role */ + /** + * Adds a single [MemberPermission] to [memberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMemberPermission(memberPermission: MemberPermission) = apply { body.addMemberPermission(memberPermission) } @@ -447,29 +552,24 @@ private constructor( */ fun memberRoles(memberRoles: List?) = apply { body.memberRoles(memberRoles) } - /** - * Ids of the roles this role inherits from - * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions - */ + /** Alias for calling [Builder.memberRoles] with `memberRoles.orElse(null)`. */ fun memberRoles(memberRoles: Optional>) = memberRoles(memberRoles.getOrNull()) /** - * Ids of the roles this role inherits from + * Sets [Builder.memberRoles] to an arbitrary JSON value. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * You should usually call [Builder.memberRoles] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun memberRoles(memberRoles: JsonField>) = apply { body.memberRoles(memberRoles) } /** - * Ids of the roles this role inherits from + * Adds a single [String] to [memberRoles]. * - * An inheriting role has all the permissions contained in its member roles, as well as all - * of their inherited permissions + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addMemberRole(memberRole: String) = apply { body.addMemberRole(memberRole) } @@ -480,17 +580,14 @@ private constructor( */ fun orgName(orgName: String?) = apply { body.orgName(orgName) } - /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. - */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** - * For nearly all users, this parameter should be unnecessary. But in the rare case that - * your API key belongs to multiple organizations, you may specify the name of the - * organization the role belongs in. + * Sets [Builder.orgName] to an arbitrary JSON value. + * + * You should usually call [Builder.orgName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun orgName(orgName: JsonField) = apply { body.orgName(orgName) } @@ -637,23 +734,36 @@ private constructor( * 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 + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun permission(): Permission = permission.getRequired("permission") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** - * Each permission permits a certain type of operation on an object in the system + * Returns the raw JSON value of [permission]. * - * Permissions can be assigned to to objects on an individual basis, or grouped into roles + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType @@ -712,10 +822,11 @@ private constructor( fun permission(permission: Permission) = permission(JsonField.of(permission)) /** - * Each permission permits a certain type of operation on an object in the system + * Sets [Builder.permission] to an arbitrary JSON value. * - * Permissions can be assigned to to objects on an individual basis, or grouped into - * roles + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -725,11 +836,20 @@ private constructor( fun restrictObjectType(restrictObjectType: AclObjectType?) = restrictObjectType(JsonField.ofNullable(restrictObjectType)) - /** The object type that the ACL applies to */ + /** + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. + */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleUpdateParams.kt index 5c41fd74..e3ab8031 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/RoleUpdateParams.kt @@ -14,6 +14,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -38,42 +39,99 @@ private constructor( /** Role id */ fun roleId(): String = roleId - /** A list of permissions to add to the role */ + /** + * A list of permissions to add to the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun addMemberPermissions(): Optional> = body.addMemberPermissions() - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * A list of role IDs to add to the role's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun addMemberRoles(): Optional> = body.addMemberRoles() - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** A list of permissions to remove from the role */ + /** + * A list of permissions to remove from the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun removeMemberPermissions(): Optional> = body.removeMemberPermissions() - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * A list of role IDs to remove from the role's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun removeMemberRoles(): Optional> = body.removeMemberRoles() - /** A list of permissions to add to the role */ + /** + * Returns the raw JSON value of [addMemberPermissions]. + * + * Unlike [addMemberPermissions], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _addMemberPermissions(): JsonField> = body._addMemberPermissions() - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * Returns the raw JSON value of [addMemberRoles]. + * + * Unlike [addMemberRoles], this method doesn't throw if the JSON field has an unexpected type. + */ fun _addMemberRoles(): JsonField> = body._addMemberRoles() - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** A list of permissions to remove from the role */ + /** + * Returns the raw JSON value of [removeMemberPermissions]. + * + * Unlike [removeMemberPermissions], this method doesn't throw if the JSON field has an + * unexpected type. + */ fun _removeMemberPermissions(): JsonField> = body._removeMemberPermissions() - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Returns the raw JSON value of [removeMemberRoles]. + * + * Unlike [removeMemberRoles], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _removeMemberRoles(): JsonField> = body._removeMemberRoles() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -122,54 +180,112 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A list of permissions to add to the role */ + /** + * A list of permissions to add to the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun addMemberPermissions(): Optional> = Optional.ofNullable(addMemberPermissions.getNullable("add_member_permissions")) - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * A list of role IDs to add to the role's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun addMemberRoles(): Optional> = Optional.ofNullable(addMemberRoles.getNullable("add_member_roles")) - /** Textual description of the role */ + /** + * Textual description of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the role */ + /** + * Name of the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** A list of permissions to remove from the role */ + /** + * A list of permissions to remove from the role + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun removeMemberPermissions(): Optional> = Optional.ofNullable(removeMemberPermissions.getNullable("remove_member_permissions")) - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * A list of role IDs to remove from the role's inheriting-from set + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun removeMemberRoles(): Optional> = Optional.ofNullable(removeMemberRoles.getNullable("remove_member_roles")) - /** A list of permissions to add to the role */ + /** + * Returns the raw JSON value of [addMemberPermissions]. + * + * Unlike [addMemberPermissions], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("add_member_permissions") @ExcludeMissing fun _addMemberPermissions(): JsonField> = addMemberPermissions - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * Returns the raw JSON value of [addMemberRoles]. + * + * Unlike [addMemberRoles], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("add_member_roles") @ExcludeMissing fun _addMemberRoles(): JsonField> = addMemberRoles - /** Textual description of the role */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** Name of the role */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** A list of permissions to remove from the role */ + /** + * Returns the raw JSON value of [removeMemberPermissions]. + * + * Unlike [removeMemberPermissions], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("remove_member_permissions") @ExcludeMissing fun _removeMemberPermissions(): JsonField> = removeMemberPermissions - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Returns the raw JSON value of [removeMemberRoles]. + * + * Unlike [removeMemberRoles], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("remove_member_roles") @ExcludeMissing fun _removeMemberRoles(): JsonField> = removeMemberRoles @@ -229,17 +345,30 @@ private constructor( fun addMemberPermissions(addMemberPermissions: List?) = addMemberPermissions(JsonField.ofNullable(addMemberPermissions)) - /** A list of permissions to add to the role */ + /** + * Alias for calling [Builder.addMemberPermissions] with + * `addMemberPermissions.orElse(null)`. + */ fun addMemberPermissions(addMemberPermissions: Optional>) = addMemberPermissions(addMemberPermissions.getOrNull()) - /** A list of permissions to add to the role */ + /** + * Sets [Builder.addMemberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun addMemberPermissions(addMemberPermissions: JsonField>) = apply { this.addMemberPermissions = addMemberPermissions.map { it.toMutableList() } } - /** A list of permissions to add to the role */ + /** + * Adds a single [AddMemberPermission] to [addMemberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberPermission(addMemberPermission: AddMemberPermission) = apply { addMemberPermissions = (addMemberPermissions ?: JsonField.of(mutableListOf())).also { @@ -251,16 +380,26 @@ private constructor( fun addMemberRoles(addMemberRoles: List?) = addMemberRoles(JsonField.ofNullable(addMemberRoles)) - /** A list of role IDs to add to the role's inheriting-from set */ + /** Alias for calling [Builder.addMemberRoles] with `addMemberRoles.orElse(null)`. */ fun addMemberRoles(addMemberRoles: Optional>) = addMemberRoles(addMemberRoles.getOrNull()) - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * Sets [Builder.addMemberRoles] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberRoles] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun addMemberRoles(addMemberRoles: JsonField>) = apply { this.addMemberRoles = addMemberRoles.map { it.toMutableList() } } - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * Adds a single [String] to [addMemberRoles]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberRole(addMemberRole: String) = apply { addMemberRoles = (addMemberRoles ?: JsonField.of(mutableListOf())).also { @@ -271,10 +410,16 @@ private constructor( /** Textual description of the role */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -282,29 +427,48 @@ private constructor( /** Name of the role */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the role */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** A list of permissions to remove from the role */ fun removeMemberPermissions(removeMemberPermissions: List?) = removeMemberPermissions(JsonField.ofNullable(removeMemberPermissions)) - /** A list of permissions to remove from the role */ + /** + * Alias for calling [Builder.removeMemberPermissions] with + * `removeMemberPermissions.orElse(null)`. + */ fun removeMemberPermissions( removeMemberPermissions: Optional> ) = removeMemberPermissions(removeMemberPermissions.getOrNull()) - /** A list of permissions to remove from the role */ + /** + * Sets [Builder.removeMemberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun removeMemberPermissions( removeMemberPermissions: JsonField> ) = apply { this.removeMemberPermissions = removeMemberPermissions.map { it.toMutableList() } } - /** A list of permissions to remove from the role */ + /** + * Adds a single [RemoveMemberPermission] to [removeMemberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberPermission(removeMemberPermission: RemoveMemberPermission) = apply { removeMemberPermissions = (removeMemberPermissions ?: JsonField.of(mutableListOf())).also { @@ -316,16 +480,28 @@ private constructor( fun removeMemberRoles(removeMemberRoles: List?) = removeMemberRoles(JsonField.ofNullable(removeMemberRoles)) - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Alias for calling [Builder.removeMemberRoles] with `removeMemberRoles.orElse(null)`. + */ fun removeMemberRoles(removeMemberRoles: Optional>) = removeMemberRoles(removeMemberRoles.getOrNull()) - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Sets [Builder.removeMemberRoles] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberRoles] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun removeMemberRoles(removeMemberRoles: JsonField>) = apply { this.removeMemberRoles = removeMemberRoles.map { it.toMutableList() } } - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Adds a single [String] to [removeMemberRoles]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberRole(removeMemberRole: String) = apply { removeMemberRoles = (removeMemberRoles ?: JsonField.of(mutableListOf())).also { @@ -422,17 +598,30 @@ private constructor( body.addMemberPermissions(addMemberPermissions) } - /** A list of permissions to add to the role */ + /** + * Alias for calling [Builder.addMemberPermissions] with + * `addMemberPermissions.orElse(null)`. + */ fun addMemberPermissions(addMemberPermissions: Optional>) = addMemberPermissions(addMemberPermissions.getOrNull()) - /** A list of permissions to add to the role */ + /** + * Sets [Builder.addMemberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun addMemberPermissions(addMemberPermissions: JsonField>) = apply { body.addMemberPermissions(addMemberPermissions) } - /** A list of permissions to add to the role */ + /** + * Adds a single [AddMemberPermission] to [addMemberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberPermission(addMemberPermission: AddMemberPermission) = apply { body.addAddMemberPermission(addMemberPermission) } @@ -442,34 +631,55 @@ private constructor( body.addMemberRoles(addMemberRoles) } - /** A list of role IDs to add to the role's inheriting-from set */ + /** Alias for calling [Builder.addMemberRoles] with `addMemberRoles.orElse(null)`. */ fun addMemberRoles(addMemberRoles: Optional>) = addMemberRoles(addMemberRoles.getOrNull()) - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * Sets [Builder.addMemberRoles] to an arbitrary JSON value. + * + * You should usually call [Builder.addMemberRoles] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun addMemberRoles(addMemberRoles: JsonField>) = apply { body.addMemberRoles(addMemberRoles) } - /** A list of role IDs to add to the role's inheriting-from set */ + /** + * Adds a single [String] to [addMemberRoles]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAddMemberRole(addMemberRole: String) = apply { body.addAddMemberRole(addMemberRole) } /** Textual description of the role */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the role */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the role */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** Name of the role */ fun name(name: String?) = apply { body.name(name) } - /** Name of the role */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the role */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** A list of permissions to remove from the role */ @@ -478,17 +688,30 @@ private constructor( body.removeMemberPermissions(removeMemberPermissions) } - /** A list of permissions to remove from the role */ + /** + * Alias for calling [Builder.removeMemberPermissions] with + * `removeMemberPermissions.orElse(null)`. + */ fun removeMemberPermissions( removeMemberPermissions: Optional> ) = removeMemberPermissions(removeMemberPermissions.getOrNull()) - /** A list of permissions to remove from the role */ + /** + * Sets [Builder.removeMemberPermissions] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberPermissions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun removeMemberPermissions( removeMemberPermissions: JsonField> ) = apply { body.removeMemberPermissions(removeMemberPermissions) } - /** A list of permissions to remove from the role */ + /** + * Adds a single [RemoveMemberPermission] to [removeMemberPermissions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberPermission(removeMemberPermission: RemoveMemberPermission) = apply { body.addRemoveMemberPermission(removeMemberPermission) } @@ -498,16 +721,26 @@ private constructor( body.removeMemberRoles(removeMemberRoles) } - /** A list of role IDs to remove from the role's inheriting-from set */ + /** Alias for calling [Builder.removeMemberRoles] with `removeMemberRoles.orElse(null)`. */ fun removeMemberRoles(removeMemberRoles: Optional>) = removeMemberRoles(removeMemberRoles.getOrNull()) - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Sets [Builder.removeMemberRoles] to an arbitrary JSON value. + * + * You should usually call [Builder.removeMemberRoles] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun removeMemberRoles(removeMemberRoles: JsonField>) = apply { body.removeMemberRoles(removeMemberRoles) } - /** A list of role IDs to remove from the role's inheriting-from set */ + /** + * Adds a single [String] to [removeMemberRoles]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRemoveMemberRole(removeMemberRole: String) = apply { body.addRemoveMemberRole(removeMemberRole) } @@ -656,23 +889,36 @@ private constructor( * 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 + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun permission(): Permission = permission.getRequired("permission") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** - * Each permission permits a certain type of operation on an object in the system + * Returns the raw JSON value of [permission]. * - * Permissions can be assigned to to objects on an individual basis, or grouped into roles + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType @@ -731,10 +977,11 @@ private constructor( fun permission(permission: Permission) = permission(JsonField.of(permission)) /** - * Each permission permits a certain type of operation on an object in the system + * Sets [Builder.permission] to an arbitrary JSON value. * - * Permissions can be assigned to to objects on an individual basis, or grouped into - * roles + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -744,11 +991,20 @@ private constructor( fun restrictObjectType(restrictObjectType: AclObjectType?) = restrictObjectType(JsonField.ofNullable(restrictObjectType)) - /** The object type that the ACL applies to */ + /** + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. + */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType } @@ -816,23 +1072,36 @@ private constructor( * 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 + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun permission(): Permission = permission.getRequired("permission") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun restrictObjectType(): Optional = Optional.ofNullable(restrictObjectType.getNullable("restrict_object_type")) /** - * Each permission permits a certain type of operation on an object in the system + * Returns the raw JSON value of [permission]. * - * Permissions can be assigned to to objects on an individual basis, or grouped into roles + * Unlike [permission], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("permission") @ExcludeMissing fun _permission(): JsonField = permission - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [restrictObjectType]. + * + * Unlike [restrictObjectType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("restrict_object_type") @ExcludeMissing fun _restrictObjectType(): JsonField = restrictObjectType @@ -891,10 +1160,11 @@ private constructor( fun permission(permission: Permission) = permission(JsonField.of(permission)) /** - * Each permission permits a certain type of operation on an object in the system + * Sets [Builder.permission] to an arbitrary JSON value. * - * Permissions can be assigned to to objects on an individual basis, or grouped into - * roles + * You should usually call [Builder.permission] with a well-typed [Permission] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun permission(permission: JsonField) = apply { this.permission = permission @@ -904,11 +1174,20 @@ private constructor( fun restrictObjectType(restrictObjectType: AclObjectType?) = restrictObjectType(JsonField.ofNullable(restrictObjectType)) - /** The object type that the ACL applies to */ + /** + * Alias for calling [Builder.restrictObjectType] with + * `restrictObjectType.orElse(null)`. + */ fun restrictObjectType(restrictObjectType: Optional) = restrictObjectType(restrictObjectType.getOrNull()) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.restrictObjectType] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictObjectType] with a well-typed + * [AclObjectType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun restrictObjectType(restrictObjectType: JsonField) = apply { this.restrictObjectType = restrictObjectType } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ScoreSummary.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ScoreSummary.kt index ff05be5e..9c3bc79e 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ScoreSummary.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ScoreSummary.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -34,36 +35,81 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Number of improvements in the score */ + /** + * Number of improvements in the score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun improvements(): Long = improvements.getRequired("improvements") - /** Name of the score */ + /** + * Name of the score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Number of regressions in the score */ + /** + * Number of regressions in the score + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun regressions(): Long = regressions.getRequired("regressions") - /** Average score across all examples */ + /** + * Average score across all examples + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun score(): Double = score.getRequired("score") - /** Difference in score between the current and comparison experiment */ + /** + * Difference in score between the current and comparison experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun diff(): Optional = Optional.ofNullable(diff.getNullable("diff")) - /** Number of improvements in the score */ + /** + * Returns the raw JSON value of [improvements]. + * + * Unlike [improvements], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("improvements") @ExcludeMissing fun _improvements(): JsonField = improvements - /** Name of the score */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Number of regressions in the score */ + /** + * Returns the raw JSON value of [regressions]. + * + * Unlike [regressions], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("regressions") @ExcludeMissing fun _regressions(): JsonField = regressions - /** Average score across all examples */ + /** + * Returns the raw JSON value of [score]. + * + * Unlike [score], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("score") @ExcludeMissing fun _score(): JsonField = score - /** Difference in score between the current and comparison experiment */ + /** + * Returns the raw JSON value of [diff]. + * + * Unlike [diff], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("diff") @ExcludeMissing fun _diff(): JsonField = diff @JsonAnyGetter @@ -126,31 +172,58 @@ private constructor( /** Number of improvements in the score */ fun improvements(improvements: Long) = improvements(JsonField.of(improvements)) - /** Number of improvements in the score */ + /** + * Sets [Builder.improvements] to an arbitrary JSON value. + * + * You should usually call [Builder.improvements] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun improvements(improvements: JsonField) = apply { this.improvements = improvements } /** Name of the score */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the score */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Number of regressions in the score */ fun regressions(regressions: Long) = regressions(JsonField.of(regressions)) - /** Number of regressions in the score */ + /** + * Sets [Builder.regressions] to an arbitrary JSON value. + * + * You should usually call [Builder.regressions] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun regressions(regressions: JsonField) = apply { this.regressions = regressions } /** Average score across all examples */ fun score(score: Double) = score(JsonField.of(score)) - /** Average score across all examples */ + /** + * Sets [Builder.score] to an arbitrary JSON value. + * + * You should usually call [Builder.score] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun score(score: JsonField) = apply { this.score = score } /** Difference in score between the current and comparison experiment */ fun diff(diff: Double) = diff(JsonField.of(diff)) - /** Difference in score between the current and comparison experiment */ + /** + * Sets [Builder.diff] to an arbitrary JSON value. + * + * You should usually call [Builder.diff] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun diff(diff: JsonField) = apply { this.diff = diff } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanAttributes.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanAttributes.kt index 4f5c77c1..56bcd6b4 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanAttributes.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanAttributes.kt @@ -9,6 +9,7 @@ import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -27,16 +28,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the span, for display purposes only */ + /** + * Name of the span, for display purposes only + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Type of the span, for display purposes only */ + /** + * Type of the span, for display purposes only + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** Name of the span, for display purposes only */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Type of the span, for display purposes only */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -80,19 +99,29 @@ private constructor( /** Name of the span, for display purposes only */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the span, for display purposes only */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the span, for display purposes only */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Type of the span, for display purposes only */ fun type(type: SpanType?) = type(JsonField.ofNullable(type)) - /** Type of the span, for display purposes only */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of the span, for display purposes only */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [SpanType] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIFrame.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIFrame.kt index ab9266fa..f368b153 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIFrame.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIFrame.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -47,71 +48,147 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the span iframe */ + /** + * Unique identifier for the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Unique identifier for the project that the span iframe belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") - /** Date of span iframe creation */ + /** + * Date of span iframe creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date of span iframe deletion, or null if the span iframe is still active */ + /** + * Date of span iframe deletion, or null if the span iframe is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** * Whether to post messages to the iframe containing the span's data. This is useful when you * want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun postMessage(): Optional = Optional.ofNullable(postMessage.getNullable("post_message")) - /** Identifies the user who created the span iframe */ + /** + * Identifies the user who created the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** Unique identifier for the span iframe */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - /** Date of span iframe creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date of span iframe deletion, or null if the span iframe is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Whether to post messages to the iframe containing the span's data. This is useful when you - * want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("post_message") @ExcludeMissing fun _postMessage(): JsonField = postMessage - /** Identifies the user who created the span iframe */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId @JsonAnyGetter @@ -186,52 +263,91 @@ private constructor( /** Unique identifier for the span iframe */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the span iframe */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the span iframe */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the span iframe belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** URL to embed the project viewer in an iframe */ fun url(url: String) = url(JsonField.of(url)) - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun url(url: JsonField) = apply { this.url = url } /** Date of span iframe creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of span iframe creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of span iframe creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date of span iframe deletion, or null if the span iframe is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of span iframe deletion, or null if the span iframe is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of span iframe deletion, or null if the span iframe is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } /** Textual description of the span iframe */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { this.description = description } /** @@ -241,30 +357,36 @@ private constructor( fun postMessage(postMessage: Boolean?) = postMessage(JsonField.ofNullable(postMessage)) /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun postMessage(postMessage: JsonField) = apply { this.postMessage = postMessage } /** Identifies the user who created the span iframe */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the span iframe */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the span iframe */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeCreateParams.kt index 9f81c14e..1f1631e9 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeCreateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,39 +33,79 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Unique identifier for the project that the span iframe belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = body.url() - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() /** * Whether to post messages to the iframe containing the span's data. This is useful when you * want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun postMessage(): Optional = body.postMessage() - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ fun _url(): JsonField = body._url() - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() /** - * Whether to post messages to the iframe containing the span's data. This is useful when you - * want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ fun _postMessage(): JsonField = body._postMessage() @@ -101,43 +142,83 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Unique identifier for the project that the span iframe belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** * Whether to post messages to the iframe containing the span's data. This is useful when * you want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun postMessage(): Optional = Optional.ofNullable(postMessage.getNullable("post_message")) - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("post_message") @ExcludeMissing @@ -202,28 +283,52 @@ private constructor( /** Name of the span iframe */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the span iframe belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** URL to embed the project viewer in an iframe */ fun url(url: String) = url(JsonField.of(url)) - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun url(url: JsonField) = apply { this.url = url } /** Textual description of the span iframe */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -235,20 +340,21 @@ private constructor( fun postMessage(postMessage: Boolean?) = postMessage(JsonField.ofNullable(postMessage)) /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun postMessage(postMessage: JsonField) = apply { this.postMessage = postMessage @@ -337,28 +443,50 @@ private constructor( /** Name of the span iframe */ fun name(name: String) = apply { body.name(name) } - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the span iframe belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** URL to embed the project viewer in an iframe */ fun url(url: String) = apply { body.url(url) } - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun url(url: JsonField) = apply { body.url(url) } /** Textual description of the span iframe */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** @@ -368,20 +496,21 @@ private constructor( fun postMessage(postMessage: Boolean?) = apply { body.postMessage(postMessage) } /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun postMessage(postMessage: JsonField) = apply { body.postMessage(postMessage) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeListParams.kt index 87ccce77..f2dd183a 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeListParams.kt @@ -133,13 +133,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -148,43 +142,38 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** Name of the span_iframe to search for */ fun spanIframeName(spanIframeName: String?) = apply { this.spanIframeName = spanIframeName } - /** Name of the span_iframe to search for */ + /** Alias for calling [Builder.spanIframeName] with `spanIframeName.orElse(null)`. */ fun spanIframeName(spanIframeName: Optional) = spanIframeName(spanIframeName.getOrNull()) @@ -197,13 +186,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeReplaceParams.kt index d3dc8f16..9a65ea97 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeReplaceParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -32,39 +33,79 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Unique identifier for the project that the span iframe belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = body.projectId() - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = body.url() - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() /** * Whether to post messages to the iframe containing the span's data. This is useful when you * want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun postMessage(): Optional = body.postMessage() - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _projectId(): JsonField = body._projectId() - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ fun _url(): JsonField = body._url() - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() /** - * Whether to post messages to the iframe containing the span's data. This is useful when you - * want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ fun _postMessage(): JsonField = body._postMessage() @@ -101,43 +142,83 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Unique identifier for the project that the span iframe belongs under + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectId(): String = projectId.getRequired("project_id") - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun url(): String = url.getRequired("url") - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) /** * Whether to post messages to the iframe containing the span's data. This is useful when * you want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun postMessage(): Optional = Optional.ofNullable(postMessage.getNullable("post_message")) - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("post_message") @ExcludeMissing @@ -202,28 +283,52 @@ private constructor( /** Name of the span iframe */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Unique identifier for the project that the span iframe belongs under */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** URL to embed the project viewer in an iframe */ fun url(url: String) = url(JsonField.of(url)) - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun url(url: JsonField) = apply { this.url = url } /** Textual description of the span iframe */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -235,20 +340,21 @@ private constructor( fun postMessage(postMessage: Boolean?) = postMessage(JsonField.ofNullable(postMessage)) /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun postMessage(postMessage: JsonField) = apply { this.postMessage = postMessage @@ -337,28 +443,50 @@ private constructor( /** Name of the span iframe */ fun name(name: String) = apply { body.name(name) } - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Unique identifier for the project that the span iframe belongs under */ fun projectId(projectId: String) = apply { body.projectId(projectId) } - /** Unique identifier for the project that the span iframe belongs under */ + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } /** URL to embed the project viewer in an iframe */ fun url(url: String) = apply { body.url(url) } - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun url(url: JsonField) = apply { body.url(url) } /** Textual description of the span iframe */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** @@ -368,20 +496,21 @@ private constructor( fun postMessage(postMessage: Boolean?) = apply { body.postMessage(postMessage) } /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun postMessage(postMessage: JsonField) = apply { body.postMessage(postMessage) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeUpdateParams.kt index 7282d348..5e3efac6 100644 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SpanIframeUpdateParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,34 +38,65 @@ private constructor( /** SpanIframe id */ fun spanIframeId(): String = spanIframeId - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() /** * Whether to post messages to the iframe containing the span's data. This is useful when you * want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun postMessage(): Optional = body.postMessage() - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun url(): Optional = body.url() - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() /** - * Whether to post messages to the iframe containing the span's data. This is useful when you - * want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ fun _postMessage(): JsonField = body._postMessage() - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ fun _url(): JsonField = body._url() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -104,40 +136,71 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Textual description of the span iframe */ + /** + * Textual description of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Name of the span iframe */ + /** + * Name of the span iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** * Whether to post messages to the iframe containing the span's data. This is useful when * you want to render more data than fits in the URL. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun postMessage(): Optional = Optional.ofNullable(postMessage.getNullable("post_message")) - /** URL to embed the project viewer in an iframe */ + /** + * URL to embed the project viewer in an iframe + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun url(): Optional = Optional.ofNullable(url.getNullable("url")) - /** Textual description of the span iframe */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** Name of the span iframe */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Returns the raw JSON value of [postMessage]. + * + * Unlike [postMessage], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("post_message") @ExcludeMissing fun _postMessage(): JsonField = postMessage - /** URL to embed the project viewer in an iframe */ + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url @JsonAnyGetter @@ -187,10 +250,16 @@ private constructor( /** Textual description of the span iframe */ fun description(description: String?) = description(JsonField.ofNullable(description)) - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -198,10 +267,16 @@ private constructor( /** Name of the span iframe */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the span iframe */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** @@ -211,20 +286,21 @@ private constructor( fun postMessage(postMessage: Boolean?) = postMessage(JsonField.ofNullable(postMessage)) /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful - * when you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun postMessage(postMessage: JsonField) = apply { this.postMessage = postMessage @@ -233,10 +309,16 @@ private constructor( /** URL to embed the project viewer in an iframe */ fun url(url: String?) = url(JsonField.ofNullable(url)) - /** URL to embed the project viewer in an iframe */ + /** Alias for calling [Builder.url] with `url.orElse(null)`. */ fun url(url: Optional) = url(url.getOrNull()) - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun url(url: JsonField) = apply { this.url = url } fun additionalProperties(additionalProperties: Map) = apply { @@ -318,19 +400,30 @@ private constructor( /** Textual description of the span iframe */ fun description(description: String?) = apply { body.description(description) } - /** Textual description of the span iframe */ + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ fun description(description: Optional) = description(description.getOrNull()) - /** Textual description of the span iframe */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } /** Name of the span iframe */ fun name(name: String?) = apply { body.name(name) } - /** Name of the span iframe */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the span iframe */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** @@ -340,30 +433,36 @@ private constructor( fun postMessage(postMessage: Boolean?) = apply { body.postMessage(postMessage) } /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Alias for [Builder.postMessage]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun postMessage(postMessage: Boolean) = postMessage(postMessage as Boolean?) - /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. - */ + /** Alias for calling [Builder.postMessage] with `postMessage.orElse(null)`. */ fun postMessage(postMessage: Optional) = postMessage(postMessage.getOrNull()) /** - * Whether to post messages to the iframe containing the span's data. This is useful when - * you want to render more data than fits in the URL. + * Sets [Builder.postMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.postMessage] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun postMessage(postMessage: JsonField) = apply { body.postMessage(postMessage) } /** URL to embed the project viewer in an iframe */ fun url(url: String?) = apply { body.url(url) } - /** URL to embed the project viewer in an iframe */ + /** Alias for calling [Builder.url] with `url.orElse(null)`. */ fun url(url: Optional) = url(url.getOrNull()) - /** URL to embed the project viewer in an iframe */ + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun url(url: JsonField) = apply { body.url(url) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeDatasetResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeDatasetResponse.kt index 949d6300..1c29da9d 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeDatasetResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeDatasetResponse.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -41,39 +42,84 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the dataset */ + /** + * Name of the dataset + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun datasetName(): String = datasetName.getRequired("dataset_name") - /** URL to the dataset's page in the Braintrust app */ + /** + * URL to the dataset's page in the Braintrust app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun datasetUrl(): String = datasetUrl.getRequired("dataset_url") - /** Name of the project that the dataset belongs to */ + /** + * Name of the project that the dataset belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectName(): String = projectName.getRequired("project_name") - /** URL to the project's page in the Braintrust app */ + /** + * URL to the project's page in the Braintrust app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectUrl(): String = projectUrl.getRequired("project_url") - /** Summary of a dataset's data */ + /** + * Summary of a dataset's data + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dataSummary(): Optional = Optional.ofNullable(dataSummary.getNullable("data_summary")) - /** Name of the dataset */ + /** + * Returns the raw JSON value of [datasetName]. + * + * Unlike [datasetName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dataset_name") @ExcludeMissing fun _datasetName(): JsonField = datasetName - /** URL to the dataset's page in the Braintrust app */ + /** + * Returns the raw JSON value of [datasetUrl]. + * + * Unlike [datasetUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dataset_url") @ExcludeMissing fun _datasetUrl(): JsonField = datasetUrl - /** Name of the project that the dataset belongs to */ + /** + * Returns the raw JSON value of [projectName]. + * + * Unlike [projectName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_name") @ExcludeMissing fun _projectName(): JsonField = projectName - /** URL to the project's page in the Braintrust app */ + /** + * Returns the raw JSON value of [projectUrl]. + * + * Unlike [projectUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_url") @ExcludeMissing fun _projectUrl(): JsonField = projectUrl - /** Summary of a dataset's data */ + /** + * Returns the raw JSON value of [dataSummary]. + * + * Unlike [dataSummary], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data_summary") @ExcludeMissing fun _dataSummary(): JsonField = dataSummary @@ -138,34 +184,64 @@ private constructor( /** Name of the dataset */ fun datasetName(datasetName: String) = datasetName(JsonField.of(datasetName)) - /** Name of the dataset */ + /** + * Sets [Builder.datasetName] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun datasetName(datasetName: JsonField) = apply { this.datasetName = datasetName } /** URL to the dataset's page in the Braintrust app */ fun datasetUrl(datasetUrl: String) = datasetUrl(JsonField.of(datasetUrl)) - /** URL to the dataset's page in the Braintrust app */ + /** + * Sets [Builder.datasetUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.datasetUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun datasetUrl(datasetUrl: JsonField) = apply { this.datasetUrl = datasetUrl } /** Name of the project that the dataset belongs to */ fun projectName(projectName: String) = projectName(JsonField.of(projectName)) - /** Name of the project that the dataset belongs to */ + /** + * Sets [Builder.projectName] to an arbitrary JSON value. + * + * You should usually call [Builder.projectName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectName(projectName: JsonField) = apply { this.projectName = projectName } /** URL to the project's page in the Braintrust app */ fun projectUrl(projectUrl: String) = projectUrl(JsonField.of(projectUrl)) - /** URL to the project's page in the Braintrust app */ + /** + * Sets [Builder.projectUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.projectUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectUrl(projectUrl: JsonField) = apply { this.projectUrl = projectUrl } /** Summary of a dataset's data */ fun dataSummary(dataSummary: DataSummary?) = dataSummary(JsonField.ofNullable(dataSummary)) - /** Summary of a dataset's data */ + /** Alias for calling [Builder.dataSummary] with `dataSummary.orElse(null)`. */ fun dataSummary(dataSummary: Optional) = dataSummary(dataSummary.getOrNull()) - /** Summary of a dataset's data */ + /** + * Sets [Builder.dataSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.dataSummary] with a well-typed [DataSummary] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun dataSummary(dataSummary: JsonField) = apply { this.dataSummary = dataSummary } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeExperimentResponse.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeExperimentResponse.kt index b23ca9e9..8c39f8c2 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeExperimentResponse.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/SummarizeExperimentResponse.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -47,55 +48,119 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the experiment */ + /** + * Name of the experiment + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun experimentName(): String = experimentName.getRequired("experiment_name") - /** URL to the experiment's page in the Braintrust app */ + /** + * URL to the experiment's page in the Braintrust app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun experimentUrl(): String = experimentUrl.getRequired("experiment_url") - /** Name of the project that the experiment belongs to */ + /** + * Name of the project that the experiment belongs to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectName(): String = projectName.getRequired("project_name") - /** URL to the project's page in the Braintrust app */ + /** + * URL to the project's page in the Braintrust app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun projectUrl(): String = projectUrl.getRequired("project_url") - /** The experiment which scores are baselined against */ + /** + * The experiment which scores are baselined against + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun comparisonExperimentName(): Optional = Optional.ofNullable(comparisonExperimentName.getNullable("comparison_experiment_name")) - /** Summary of the experiment's metrics */ + /** + * Summary of the experiment's metrics + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun metrics(): Optional = Optional.ofNullable(metrics.getNullable("metrics")) - /** Summary of the experiment's scores */ + /** + * Summary of the experiment's scores + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun scores(): Optional = Optional.ofNullable(scores.getNullable("scores")) - /** Name of the experiment */ + /** + * Returns the raw JSON value of [experimentName]. + * + * Unlike [experimentName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("experiment_name") @ExcludeMissing fun _experimentName(): JsonField = experimentName - /** URL to the experiment's page in the Braintrust app */ + /** + * Returns the raw JSON value of [experimentUrl]. + * + * Unlike [experimentUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("experiment_url") @ExcludeMissing fun _experimentUrl(): JsonField = experimentUrl - /** Name of the project that the experiment belongs to */ + /** + * Returns the raw JSON value of [projectName]. + * + * Unlike [projectName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_name") @ExcludeMissing fun _projectName(): JsonField = projectName - /** URL to the project's page in the Braintrust app */ + /** + * Returns the raw JSON value of [projectUrl]. + * + * Unlike [projectUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("project_url") @ExcludeMissing fun _projectUrl(): JsonField = projectUrl - /** The experiment which scores are baselined against */ + /** + * Returns the raw JSON value of [comparisonExperimentName]. + * + * Unlike [comparisonExperimentName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("comparison_experiment_name") @ExcludeMissing fun _comparisonExperimentName(): JsonField = comparisonExperimentName - /** Summary of the experiment's metrics */ + /** + * Returns the raw JSON value of [metrics]. + * + * Unlike [metrics], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("metrics") @ExcludeMissing fun _metrics(): JsonField = metrics - /** Summary of the experiment's scores */ + /** + * Returns the raw JSON value of [scores]. + * + * Unlike [scores], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("scores") @ExcludeMissing fun _scores(): JsonField = scores @JsonAnyGetter @@ -164,7 +229,13 @@ private constructor( /** Name of the experiment */ fun experimentName(experimentName: String) = experimentName(JsonField.of(experimentName)) - /** Name of the experiment */ + /** + * Sets [Builder.experimentName] to an arbitrary JSON value. + * + * You should usually call [Builder.experimentName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun experimentName(experimentName: JsonField) = apply { this.experimentName = experimentName } @@ -172,7 +243,13 @@ private constructor( /** URL to the experiment's page in the Braintrust app */ fun experimentUrl(experimentUrl: String) = experimentUrl(JsonField.of(experimentUrl)) - /** URL to the experiment's page in the Braintrust app */ + /** + * Sets [Builder.experimentUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.experimentUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun experimentUrl(experimentUrl: JsonField) = apply { this.experimentUrl = experimentUrl } @@ -180,24 +257,45 @@ private constructor( /** Name of the project that the experiment belongs to */ fun projectName(projectName: String) = projectName(JsonField.of(projectName)) - /** Name of the project that the experiment belongs to */ + /** + * Sets [Builder.projectName] to an arbitrary JSON value. + * + * You should usually call [Builder.projectName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectName(projectName: JsonField) = apply { this.projectName = projectName } /** URL to the project's page in the Braintrust app */ fun projectUrl(projectUrl: String) = projectUrl(JsonField.of(projectUrl)) - /** URL to the project's page in the Braintrust app */ + /** + * Sets [Builder.projectUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.projectUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun projectUrl(projectUrl: JsonField) = apply { this.projectUrl = projectUrl } /** The experiment which scores are baselined against */ fun comparisonExperimentName(comparisonExperimentName: String?) = comparisonExperimentName(JsonField.ofNullable(comparisonExperimentName)) - /** The experiment which scores are baselined against */ + /** + * Alias for calling [Builder.comparisonExperimentName] with + * `comparisonExperimentName.orElse(null)`. + */ fun comparisonExperimentName(comparisonExperimentName: Optional) = comparisonExperimentName(comparisonExperimentName.getOrNull()) - /** The experiment which scores are baselined against */ + /** + * Sets [Builder.comparisonExperimentName] to an arbitrary JSON value. + * + * You should usually call [Builder.comparisonExperimentName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun comparisonExperimentName(comparisonExperimentName: JsonField) = apply { this.comparisonExperimentName = comparisonExperimentName } @@ -205,19 +303,29 @@ private constructor( /** Summary of the experiment's metrics */ fun metrics(metrics: Metrics?) = metrics(JsonField.ofNullable(metrics)) - /** Summary of the experiment's metrics */ + /** Alias for calling [Builder.metrics] with `metrics.orElse(null)`. */ fun metrics(metrics: Optional) = metrics(metrics.getOrNull()) - /** Summary of the experiment's metrics */ + /** + * Sets [Builder.metrics] to an arbitrary JSON value. + * + * You should usually call [Builder.metrics] with a well-typed [Metrics] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun metrics(metrics: JsonField) = apply { this.metrics = metrics } /** Summary of the experiment's scores */ fun scores(scores: Scores?) = scores(JsonField.ofNullable(scores)) - /** Summary of the experiment's scores */ + /** Alias for calling [Builder.scores] with `scores.orElse(null)`. */ fun scores(scores: Optional) = scores(scores.getOrNull()) - /** Summary of the experiment's scores */ + /** + * Sets [Builder.scores] to an arbitrary JSON value. + * + * You should usually call [Builder.scores] with a well-typed [Scores] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun scores(scores: JsonField) = apply { this.scores = scores } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/User.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/User.kt index b064f7aa..a2e2f9c3 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/User.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/User.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkRequired import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -40,40 +41,94 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the user */ + /** + * Unique identifier for the user + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** URL of the user's Avatar image */ + /** + * URL of the user's Avatar image + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun avatarUrl(): Optional = Optional.ofNullable(avatarUrl.getNullable("avatar_url")) - /** Date of user creation */ + /** + * Date of user creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** The user's email */ + /** + * The user's email + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun email(): Optional = Optional.ofNullable(email.getNullable("email")) - /** Family name of the user */ + /** + * Family name of the user + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun familyName(): Optional = Optional.ofNullable(familyName.getNullable("family_name")) - /** Given name of the user */ + /** + * Given name of the user + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun givenName(): Optional = Optional.ofNullable(givenName.getNullable("given_name")) - /** Unique identifier for the user */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** URL of the user's Avatar image */ + /** + * Returns the raw JSON value of [avatarUrl]. + * + * Unlike [avatarUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("avatar_url") @ExcludeMissing fun _avatarUrl(): JsonField = avatarUrl - /** Date of user creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** The user's email */ + /** + * Returns the raw JSON value of [email]. + * + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email - /** Family name of the user */ + /** + * Returns the raw JSON value of [familyName]. + * + * Unlike [familyName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("family_name") @ExcludeMissing fun _familyName(): JsonField = familyName - /** Given name of the user */ + /** + * Returns the raw JSON value of [givenName]. + * + * Unlike [givenName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("given_name") @ExcludeMissing fun _givenName(): JsonField = givenName @JsonAnyGetter @@ -136,52 +191,86 @@ private constructor( /** Unique identifier for the user */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the user */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** URL of the user's Avatar image */ fun avatarUrl(avatarUrl: String?) = avatarUrl(JsonField.ofNullable(avatarUrl)) - /** URL of the user's Avatar image */ + /** Alias for calling [Builder.avatarUrl] with `avatarUrl.orElse(null)`. */ fun avatarUrl(avatarUrl: Optional) = avatarUrl(avatarUrl.getOrNull()) - /** URL of the user's Avatar image */ + /** + * Sets [Builder.avatarUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.avatarUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun avatarUrl(avatarUrl: JsonField) = apply { this.avatarUrl = avatarUrl } /** Date of user creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of user creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of user creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** The user's email */ fun email(email: String?) = email(JsonField.ofNullable(email)) - /** The user's email */ + /** Alias for calling [Builder.email] with `email.orElse(null)`. */ fun email(email: Optional) = email(email.getOrNull()) - /** The user's email */ + /** + * Sets [Builder.email] to an arbitrary JSON value. + * + * You should usually call [Builder.email] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun email(email: JsonField) = apply { this.email = email } /** Family name of the user */ fun familyName(familyName: String?) = familyName(JsonField.ofNullable(familyName)) - /** Family name of the user */ + /** Alias for calling [Builder.familyName] with `familyName.orElse(null)`. */ fun familyName(familyName: Optional) = familyName(familyName.getOrNull()) - /** Family name of the user */ + /** + * Sets [Builder.familyName] to an arbitrary JSON value. + * + * You should usually call [Builder.familyName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun familyName(familyName: JsonField) = apply { this.familyName = familyName } /** Given name of the user */ fun givenName(givenName: String?) = givenName(JsonField.ofNullable(givenName)) - /** Given name of the user */ + /** Alias for calling [Builder.givenName] with `givenName.orElse(null)`. */ fun givenName(givenName: Optional) = givenName(givenName.getOrNull()) - /** Given name of the user */ + /** + * Sets [Builder.givenName] to an arbitrary JSON value. + * + * You should usually call [Builder.givenName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun givenName(givenName: JsonField) = apply { this.givenName = givenName } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/UserListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/UserListParams.kt index d259099e..d456383c 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/UserListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/UserListParams.kt @@ -153,22 +153,13 @@ private constructor( */ fun email(email: Email?) = apply { this.email = email } - /** - * Email of the user to search for. You may pass the param multiple times to filter for more - * than one email - */ + /** Alias for calling [Builder.email] with `email.orElse(null)`. */ fun email(email: Optional) = email(email.getOrNull()) - /** - * Email of the user to search for. You may pass the param multiple times to filter for more - * than one email - */ + /** Alias for calling [email] with `Email.ofString(string)`. */ fun email(string: String) = email(Email.ofString(string)) - /** - * Email of the user to search for. You may pass the param multiple times to filter for more - * than one email - */ + /** Alias for calling [email] with `Email.ofStrings(strings)`. */ fun emailOfStrings(strings: List) = email(Email.ofStrings(strings)) /** @@ -180,13 +171,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -195,22 +180,13 @@ private constructor( */ fun familyName(familyName: FamilyName?) = apply { this.familyName = familyName } - /** - * Family name of the user to search for. You may pass the param multiple times to filter - * for more than one family name - */ + /** Alias for calling [Builder.familyName] with `familyName.orElse(null)`. */ fun familyName(familyName: Optional) = familyName(familyName.getOrNull()) - /** - * Family name of the user to search for. You may pass the param multiple times to filter - * for more than one family name - */ + /** Alias for calling [familyName] with `FamilyName.ofString(string)`. */ fun familyName(string: String) = familyName(FamilyName.ofString(string)) - /** - * Family name of the user to search for. You may pass the param multiple times to filter - * for more than one family name - */ + /** Alias for calling [familyName] with `FamilyName.ofStrings(strings)`. */ fun familyNameOfStrings(strings: List) = familyName(FamilyName.ofStrings(strings)) /** @@ -219,22 +195,13 @@ private constructor( */ fun givenName(givenName: GivenName?) = apply { this.givenName = givenName } - /** - * Given name of the user to search for. You may pass the param multiple times to filter for - * more than one given name - */ + /** Alias for calling [Builder.givenName] with `givenName.orElse(null)`. */ fun givenName(givenName: Optional) = givenName(givenName.getOrNull()) - /** - * Given name of the user to search for. You may pass the param multiple times to filter for - * more than one given name - */ + /** Alias for calling [givenName] with `GivenName.ofString(string)`. */ fun givenName(string: String) = givenName(GivenName.ofString(string)) - /** - * Given name of the user to search for. You may pass the param multiple times to filter for - * more than one given name - */ + /** Alias for calling [givenName] with `GivenName.ofStrings(strings)`. */ fun givenNameOfStrings(strings: List) = givenName(GivenName.ofStrings(strings)) /** @@ -243,37 +210,32 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Filter search results to within a particular organization */ fun orgName(orgName: String?) = apply { this.orgName = orgName } - /** Filter search results to within a particular organization */ + /** Alias for calling [Builder.orgName] with `orgName.orElse(null)`. */ fun orgName(orgName: Optional) = orgName(orgName.getOrNull()) /** @@ -285,13 +247,7 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/View.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/View.kt index 031f9f92..c53b8ab5 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/View.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/View.kt @@ -54,69 +54,159 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unique identifier for the view */ + /** + * Unique identifier for the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun id(): String = id.getRequired("id") - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewType(): Optional = Optional.ofNullable(viewType.getNullable("view_type")) - /** Date of view creation */ + /** + * Date of view creation + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun created(): Optional = Optional.ofNullable(created.getNullable("created")) - /** Date of role deletion, or null if the role is still active */ + /** + * Date of role deletion, or null if the role is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = Optional.ofNullable(options.getNullable("options")) - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewData(): Optional = Optional.ofNullable(viewData.getNullable("view_data")) - /** Unique identifier for the view */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_type") @ExcludeMissing fun _viewType(): JsonField = viewType - /** Date of view creation */ + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** Date of role deletion, or null if the role is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_data") @ExcludeMissing fun _viewData(): JsonField = viewData @JsonAnyGetter @@ -195,25 +285,46 @@ private constructor( /** Unique identifier for the view */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the view */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the view */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { this.name = name } /** The id of the object the view applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -221,55 +332,90 @@ private constructor( /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = viewType(JsonField.ofNullable(viewType)) - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewType(viewType: JsonField) = apply { this.viewType = viewType } /** Date of view creation */ fun created(created: OffsetDateTime?) = created(JsonField.ofNullable(created)) - /** Date of view creation */ + /** Alias for calling [Builder.created] with `created.orElse(null)`. */ fun created(created: Optional) = created(created.getOrNull()) - /** Date of view creation */ + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun created(created: JsonField) = apply { this.created = created } /** Date of role deletion, or null if the role is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of role deletion, or null if the role is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of role deletion, or null if the role is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } /** Options for the view in the app */ fun options(options: ViewOptions?) = options(JsonField.ofNullable(options)) - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun options(options: JsonField) = apply { this.options = options } /** Identifies the user who created the view */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } /** The view definition */ fun viewData(viewData: ViewData?) = viewData(JsonField.ofNullable(viewData)) - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewData(viewData: JsonField) = apply { this.viewData = viewData } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewCreateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewCreateParams.kt index c9846755..e123c1da 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewCreateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewCreateParams.kt @@ -35,52 +35,124 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = body.objectType() - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewType(): Optional = body.viewType() - /** Date of role deletion, or null if the role is still active */ + /** + * Date of role deletion, or null if the role is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = body.deletedAt() - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = body.options() - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = body.userId() - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewData(): Optional = body.viewData() - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _viewType(): JsonField = body._viewType() - /** Date of role deletion, or null if the role is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ fun _deletedAt(): JsonField = body._deletedAt() - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ fun _options(): JsonField = body._options() - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _userId(): JsonField = body._userId() - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _viewData(): JsonField = body._viewData() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -127,57 +199,129 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun viewType(): Optional = Optional.ofNullable(viewType.getNullable("view_type")) - /** Date of role deletion, or null if the role is still active */ + /** + * Date of role deletion, or null if the role is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun options(): Optional = Optional.ofNullable(options.getNullable("options")) - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun viewData(): Optional = Optional.ofNullable(viewData.getNullable("view_data")) - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_type") @ExcludeMissing fun _viewType(): JsonField = viewType - /** Date of role deletion, or null if the role is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_data") @ExcludeMissing fun _viewData(): JsonField = viewData @JsonAnyGetter @@ -249,19 +393,37 @@ private constructor( /** Name of the view */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The id of the object the view applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -269,19 +431,31 @@ private constructor( /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = viewType(JsonField.ofNullable(viewType)) - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun viewType(viewType: JsonField) = apply { this.viewType = viewType } /** Date of role deletion, or null if the role is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of role deletion, or null if the role is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of role deletion, or null if the role is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } @@ -289,28 +463,46 @@ private constructor( /** Options for the view in the app */ fun options(options: ViewOptions?) = options(JsonField.ofNullable(options)) - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun options(options: JsonField) = apply { this.options = options } /** Identifies the user who created the view */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } /** The view definition */ fun viewData(viewData: ViewData?) = viewData(JsonField.ofNullable(viewData)) - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun viewData(viewData: JsonField) = apply { this.viewData = viewData } fun additionalProperties(additionalProperties: Map) = apply { @@ -400,64 +592,109 @@ private constructor( /** Name of the view */ fun name(name: String) = apply { body.name(name) } - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The id of the object the view applies to */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = apply { body.objectType(objectType) } - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = apply { body.viewType(viewType) } - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewType(viewType: JsonField) = apply { body.viewType(viewType) } /** Date of role deletion, or null if the role is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = apply { body.deletedAt(deletedAt) } - /** Date of role deletion, or null if the role is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of role deletion, or null if the role is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { body.deletedAt(deletedAt) } /** Options for the view in the app */ fun options(options: ViewOptions?) = apply { body.options(options) } - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun options(options: JsonField) = apply { body.options(options) } /** Identifies the user who created the view */ fun userId(userId: String?) = apply { body.userId(userId) } - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { body.userId(userId) } /** The view definition */ fun viewData(viewData: ViewData?) = apply { body.viewData(viewData) } - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewData(viewData: JsonField) = apply { body.viewData(viewData) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewData.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewData.kt index 70d0d8ce..8ab619b7 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewData.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewData.kt @@ -9,6 +9,7 @@ import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -28,8 +29,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun search(): Optional = Optional.ofNullable(search.getNullable("search")) + /** + * Returns the raw JSON value of [search]. + * + * Unlike [search], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("search") @ExcludeMissing fun _search(): JsonField = search @JsonAnyGetter @@ -69,8 +79,16 @@ private constructor( fun search(search: ViewDataSearch?) = search(JsonField.ofNullable(search)) + /** Alias for calling [Builder.search] with `search.orElse(null)`. */ fun search(search: Optional) = search(search.getOrNull()) + /** + * Sets [Builder.search] to an arbitrary JSON value. + * + * You should usually call [Builder.search] with a well-typed [ViewDataSearch] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun search(search: JsonField) = apply { this.search = search } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDataSearch.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDataSearch.kt index 6d12484b..3b39ddb7 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDataSearch.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDataSearch.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -37,20 +38,56 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun filter(): Optional> = Optional.ofNullable(filter.getNullable("filter")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun match(): Optional> = Optional.ofNullable(match.getNullable("match")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sort(): Optional> = Optional.ofNullable(sort.getNullable("sort")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tag(): Optional> = Optional.ofNullable(tag.getNullable("tag")) + /** + * Returns the raw JSON value of [filter]. + * + * Unlike [filter], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField> = filter + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + /** + * Returns the raw JSON value of [sort]. + * + * Unlike [sort], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("sort") @ExcludeMissing fun _sort(): JsonField> = sort + /** + * Returns the raw JSON value of [tag]. + * + * Unlike [tag], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("tag") @ExcludeMissing fun _tag(): JsonField> = tag @JsonAnyGetter @@ -99,12 +136,25 @@ private constructor( fun filter(filter: List?) = filter(JsonField.ofNullable(filter)) + /** Alias for calling [Builder.filter] with `filter.orElse(null)`. */ fun filter(filter: Optional>) = filter(filter.getOrNull()) + /** + * Sets [Builder.filter] to an arbitrary JSON value. + * + * You should usually call [Builder.filter] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun filter(filter: JsonField>) = apply { this.filter = filter.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [Builder.filter]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addFilter(filter: JsonValue) = apply { this.filter = (this.filter ?: JsonField.of(mutableListOf())).also { @@ -114,12 +164,25 @@ private constructor( fun match(match: List?) = match(JsonField.ofNullable(match)) + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ fun match(match: Optional>) = match(match.getOrNull()) + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun match(match: JsonField>) = apply { this.match = match.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addMatch(match: JsonValue) = apply { this.match = (this.match ?: JsonField.of(mutableListOf())).also { @@ -129,12 +192,25 @@ private constructor( fun sort(sort: List?) = sort(JsonField.ofNullable(sort)) + /** Alias for calling [Builder.sort] with `sort.orElse(null)`. */ fun sort(sort: Optional>) = sort(sort.getOrNull()) + /** + * Sets [Builder.sort] to an arbitrary JSON value. + * + * You should usually call [Builder.sort] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun sort(sort: JsonField>) = apply { this.sort = sort.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [Builder.sort]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addSort(sort: JsonValue) = apply { this.sort = (this.sort ?: JsonField.of(mutableListOf())).also { @@ -144,12 +220,25 @@ private constructor( fun tag(tag: List?) = tag(JsonField.ofNullable(tag)) + /** Alias for calling [Builder.tag] with `tag.orElse(null)`. */ fun tag(tag: Optional>) = tag(tag.getOrNull()) + /** + * Sets [Builder.tag] to an arbitrary JSON value. + * + * You should usually call [Builder.tag] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tag(tag: JsonField>) = apply { this.tag = tag.map { it.toMutableList() } } + /** + * Adds a single [JsonValue] to [Builder.tag]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTag(tag: JsonValue) = apply { this.tag = (this.tag ?: JsonField.of(mutableListOf())).also { checkKnown("tag", it).add(tag) } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDeleteParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDeleteParams.kt index 859f6c54..64ac535e 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDeleteParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewDeleteParams.kt @@ -13,6 +13,7 @@ import com.braintrustdata.api.core.http.Headers import com.braintrustdata.api.core.http.QueryParams import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -31,16 +32,34 @@ private constructor( /** View id */ fun viewId(): String = viewId - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = body.objectType() - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -76,16 +95,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType @@ -139,13 +176,25 @@ private constructor( /** The id of the object the view applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -235,13 +284,24 @@ private constructor( /** The id of the object the view applies to */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = apply { body.objectType(objectType) } - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewListParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewListParams.kt index f7438d8e..db3c13bb 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewListParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewListParams.kt @@ -160,13 +160,7 @@ private constructor( */ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } - /** - * Pagination cursor id. - * - * For example, if the initial item in the last page you fetched had an id of `foo`, pass - * `ending_before=foo` to fetch the previous page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) /** @@ -175,31 +169,26 @@ private constructor( */ fun ids(ids: Ids?) = apply { this.ids = ids } - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [Builder.ids] with `ids.orElse(null)`. */ fun ids(ids: Optional) = ids(ids.getOrNull()) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofString(string)`. */ fun ids(string: String) = ids(Ids.ofString(string)) - /** - * Filter search results to a particular set of object IDs. To specify a list of IDs, - * include the query param multiple times - */ + /** Alias for calling [ids] with `Ids.ofStrings(strings)`. */ fun idsOfStrings(strings: List) = ids(Ids.ofStrings(strings)) /** Limit the number of objects to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Limit the number of objects to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Limit the number of objects to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** @@ -211,26 +200,20 @@ private constructor( */ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } - /** - * Pagination cursor id. - * - * For example, if the final item in the last page you fetched had an id of `foo`, pass - * `starting_after=foo` to fetch the next page. Note: you may only pass one of - * `starting_after` and `ending_before` - */ + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) /** Name of the view to search for */ fun viewName(viewName: String?) = apply { this.viewName = viewName } - /** Name of the view to search for */ + /** Alias for calling [Builder.viewName] with `viewName.orElse(null)`. */ fun viewName(viewName: Optional) = viewName(viewName.getOrNull()) /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = apply { this.viewType = viewType } - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewOptions.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewOptions.kt index 40ff24c4..13231bb1 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewOptions.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewOptions.kt @@ -10,6 +10,7 @@ import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.checkKnown import com.braintrustdata.api.core.immutableEmptyMap import com.braintrustdata.api.core.toImmutable +import com.braintrustdata.api.errors.BraintrustInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -44,37 +45,92 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun columnOrder(): Optional> = Optional.ofNullable(columnOrder.getNullable("columnOrder")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun columnSizing(): Optional = Optional.ofNullable(columnSizing.getNullable("columnSizing")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun columnVisibility(): Optional = Optional.ofNullable(columnVisibility.getNullable("columnVisibility")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun grouping(): Optional = Optional.ofNullable(grouping.getNullable("grouping")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun layout(): Optional = Optional.ofNullable(layout.getNullable("layout")) + /** + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun rowHeight(): Optional = Optional.ofNullable(rowHeight.getNullable("rowHeight")) + /** + * Returns the raw JSON value of [columnOrder]. + * + * Unlike [columnOrder], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("columnOrder") @ExcludeMissing fun _columnOrder(): JsonField> = columnOrder + /** + * Returns the raw JSON value of [columnSizing]. + * + * Unlike [columnSizing], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("columnSizing") @ExcludeMissing fun _columnSizing(): JsonField = columnSizing + /** + * Returns the raw JSON value of [columnVisibility]. + * + * Unlike [columnVisibility], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("columnVisibility") @ExcludeMissing fun _columnVisibility(): JsonField = columnVisibility + /** + * Returns the raw JSON value of [grouping]. + * + * Unlike [grouping], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("grouping") @ExcludeMissing fun _grouping(): JsonField = grouping + /** + * Returns the raw JSON value of [layout]. + * + * Unlike [layout], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("layout") @ExcludeMissing fun _layout(): JsonField = layout + /** + * Returns the raw JSON value of [rowHeight]. + * + * Unlike [rowHeight], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("rowHeight") @ExcludeMissing fun _rowHeight(): JsonField = rowHeight @JsonAnyGetter @@ -129,12 +185,25 @@ private constructor( fun columnOrder(columnOrder: List?) = columnOrder(JsonField.ofNullable(columnOrder)) + /** Alias for calling [Builder.columnOrder] with `columnOrder.orElse(null)`. */ fun columnOrder(columnOrder: Optional>) = columnOrder(columnOrder.getOrNull()) + /** + * Sets [Builder.columnOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.columnOrder] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun columnOrder(columnOrder: JsonField>) = apply { this.columnOrder = columnOrder.map { it.toMutableList() } } + /** + * Adds a single [String] to [Builder.columnOrder]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addColumnOrder(columnOrder: String) = apply { this.columnOrder = (this.columnOrder ?: JsonField.of(mutableListOf())).also { @@ -145,9 +214,17 @@ private constructor( fun columnSizing(columnSizing: ColumnSizing?) = columnSizing(JsonField.ofNullable(columnSizing)) + /** Alias for calling [Builder.columnSizing] with `columnSizing.orElse(null)`. */ fun columnSizing(columnSizing: Optional) = columnSizing(columnSizing.getOrNull()) + /** + * Sets [Builder.columnSizing] to an arbitrary JSON value. + * + * You should usually call [Builder.columnSizing] with a well-typed [ColumnSizing] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun columnSizing(columnSizing: JsonField) = apply { this.columnSizing = columnSizing } @@ -155,29 +232,59 @@ private constructor( fun columnVisibility(columnVisibility: ColumnVisibility?) = columnVisibility(JsonField.ofNullable(columnVisibility)) + /** Alias for calling [Builder.columnVisibility] with `columnVisibility.orElse(null)`. */ fun columnVisibility(columnVisibility: Optional) = columnVisibility(columnVisibility.getOrNull()) + /** + * Sets [Builder.columnVisibility] to an arbitrary JSON value. + * + * You should usually call [Builder.columnVisibility] with a well-typed [ColumnVisibility] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun columnVisibility(columnVisibility: JsonField) = apply { this.columnVisibility = columnVisibility } fun grouping(grouping: String?) = grouping(JsonField.ofNullable(grouping)) + /** Alias for calling [Builder.grouping] with `grouping.orElse(null)`. */ fun grouping(grouping: Optional) = grouping(grouping.getOrNull()) + /** + * Sets [Builder.grouping] to an arbitrary JSON value. + * + * You should usually call [Builder.grouping] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun grouping(grouping: JsonField) = apply { this.grouping = grouping } fun layout(layout: String?) = layout(JsonField.ofNullable(layout)) + /** Alias for calling [Builder.layout] with `layout.orElse(null)`. */ fun layout(layout: Optional) = layout(layout.getOrNull()) + /** + * Sets [Builder.layout] to an arbitrary JSON value. + * + * You should usually call [Builder.layout] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun layout(layout: JsonField) = apply { this.layout = layout } fun rowHeight(rowHeight: String?) = rowHeight(JsonField.ofNullable(rowHeight)) + /** Alias for calling [Builder.rowHeight] with `rowHeight.orElse(null)`. */ fun rowHeight(rowHeight: Optional) = rowHeight(rowHeight.getOrNull()) + /** + * Sets [Builder.rowHeight] to an arbitrary JSON value. + * + * You should usually call [Builder.rowHeight] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun rowHeight(rowHeight: JsonField) = apply { this.rowHeight = rowHeight } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewReplaceParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewReplaceParams.kt index 7112d267..720246b3 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewReplaceParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewReplaceParams.kt @@ -35,52 +35,124 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = body.name() - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = body.objectType() - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewType(): Optional = body.viewType() - /** Date of role deletion, or null if the role is still active */ + /** + * Date of role deletion, or null if the role is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deletedAt(): Optional = body.deletedAt() - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = body.options() - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = body.userId() - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewData(): Optional = body.viewData() - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _viewType(): JsonField = body._viewType() - /** Date of role deletion, or null if the role is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ fun _deletedAt(): JsonField = body._deletedAt() - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ fun _options(): JsonField = body._options() - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _userId(): JsonField = body._userId() - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _viewData(): JsonField = body._viewData() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -127,57 +199,129 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun name(): String = name.getRequired("name") - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun viewType(): Optional = Optional.ofNullable(viewType.getNullable("view_type")) - /** Date of role deletion, or null if the role is still active */ + /** + * Date of role deletion, or null if the role is still active + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun deletedAt(): Optional = Optional.ofNullable(deletedAt.getNullable("deleted_at")) - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun options(): Optional = Optional.ofNullable(options.getNullable("options")) - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun viewData(): Optional = Optional.ofNullable(viewData.getNullable("view_data")) - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_type") @ExcludeMissing fun _viewType(): JsonField = viewType - /** Date of role deletion, or null if the role is still active */ + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deleted_at") @ExcludeMissing fun _deletedAt(): JsonField = deletedAt - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_data") @ExcludeMissing fun _viewData(): JsonField = viewData @JsonAnyGetter @@ -249,19 +393,37 @@ private constructor( /** Name of the view */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** The id of the object the view applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -269,19 +431,31 @@ private constructor( /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = viewType(JsonField.ofNullable(viewType)) - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun viewType(viewType: JsonField) = apply { this.viewType = viewType } /** Date of role deletion, or null if the role is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = deletedAt(JsonField.ofNullable(deletedAt)) - /** Date of role deletion, or null if the role is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of role deletion, or null if the role is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } @@ -289,28 +463,46 @@ private constructor( /** Options for the view in the app */ fun options(options: ViewOptions?) = options(JsonField.ofNullable(options)) - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun options(options: JsonField) = apply { this.options = options } /** Identifies the user who created the view */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } /** The view definition */ fun viewData(viewData: ViewData?) = viewData(JsonField.ofNullable(viewData)) - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun viewData(viewData: JsonField) = apply { this.viewData = viewData } fun additionalProperties(additionalProperties: Map) = apply { @@ -400,64 +592,109 @@ private constructor( /** Name of the view */ fun name(name: String) = apply { body.name(name) } - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** The id of the object the view applies to */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = apply { body.objectType(objectType) } - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = apply { body.viewType(viewType) } - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewType(viewType: JsonField) = apply { body.viewType(viewType) } /** Date of role deletion, or null if the role is still active */ fun deletedAt(deletedAt: OffsetDateTime?) = apply { body.deletedAt(deletedAt) } - /** Date of role deletion, or null if the role is still active */ + /** Alias for calling [Builder.deletedAt] with `deletedAt.orElse(null)`. */ fun deletedAt(deletedAt: Optional) = deletedAt(deletedAt.getOrNull()) - /** Date of role deletion, or null if the role is still active */ + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deletedAt(deletedAt: JsonField) = apply { body.deletedAt(deletedAt) } /** Options for the view in the app */ fun options(options: ViewOptions?) = apply { body.options(options) } - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun options(options: JsonField) = apply { body.options(options) } /** Identifies the user who created the view */ fun userId(userId: String?) = apply { body.userId(userId) } - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { body.userId(userId) } /** The view definition */ fun viewData(viewData: ViewData?) = apply { body.viewData(viewData) } - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewData(viewData: JsonField) = apply { body.viewData(viewData) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewUpdateParams.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewUpdateParams.kt index 6521f2e1..a442a37a 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewUpdateParams.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ViewUpdateParams.kt @@ -39,46 +39,109 @@ private constructor( /** View id */ fun viewId(): String = viewId - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = body.objectId() - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = body.objectType() - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = body.name() - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = body.options() - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun userId(): Optional = body.userId() - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewData(): Optional = body.viewData() - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun viewType(): Optional = body.viewType() - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectId(): JsonField = body._objectId() - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _objectType(): JsonField = body._objectType() - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ fun _name(): JsonField = body._name() - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ fun _options(): JsonField = body._options() - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _userId(): JsonField = body._userId() - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ fun _viewData(): JsonField = body._viewData() - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ fun _viewType(): JsonField = body._viewType() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -129,48 +192,111 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the object the view applies to */ + /** + * The id of the object the view applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectId(): String = objectId.getRequired("object_id") - /** The object type that the ACL applies to */ + /** + * The object type that the ACL applies to + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun objectType(): AclObjectType = objectType.getRequired("object_type") - /** Name of the view */ + /** + * Name of the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Options for the view in the app */ + /** + * Options for the view in the app + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun options(): Optional = Optional.ofNullable(options.getNullable("options")) - /** Identifies the user who created the view */ + /** + * Identifies the user who created the view + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun userId(): Optional = Optional.ofNullable(userId.getNullable("user_id")) - /** The view definition */ + /** + * The view definition + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun viewData(): Optional = Optional.ofNullable(viewData.getNullable("view_data")) - /** Type of table that the view corresponds to. */ + /** + * Type of table that the view corresponds to. + * + * @throws BraintrustInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun viewType(): Optional = Optional.ofNullable(viewType.getNullable("view_type")) - /** The id of the object the view applies to */ + /** + * Returns the raw JSON value of [objectId]. + * + * Unlike [objectId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_id") @ExcludeMissing fun _objectId(): JsonField = objectId - /** The object type that the ACL applies to */ + /** + * Returns the raw JSON value of [objectType]. + * + * Unlike [objectType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("object_type") @ExcludeMissing fun _objectType(): JsonField = objectType - /** Name of the view */ + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** Options for the view in the app */ + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options - /** Identifies the user who created the view */ + /** + * Returns the raw JSON value of [userId]. + * + * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - /** The view definition */ + /** + * Returns the raw JSON value of [viewData]. + * + * Unlike [viewData], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_data") @ExcludeMissing fun _viewData(): JsonField = viewData - /** Type of table that the view corresponds to. */ + /** + * Returns the raw JSON value of [viewType]. + * + * Unlike [viewType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("view_type") @ExcludeMissing fun _viewType(): JsonField = viewType @JsonAnyGetter @@ -237,13 +363,25 @@ private constructor( /** The id of the object the view applies to */ fun objectId(objectId: String) = objectId(JsonField.of(objectId)) - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectId(objectId: JsonField) = apply { this.objectId = objectId } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = objectType(JsonField.of(objectType)) - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { this.objectType = objectType } @@ -251,46 +389,76 @@ private constructor( /** Name of the view */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** Name of the view */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun name(name: JsonField) = apply { this.name = name } /** Options for the view in the app */ fun options(options: ViewOptions?) = options(JsonField.ofNullable(options)) - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun options(options: JsonField) = apply { this.options = options } /** Identifies the user who created the view */ fun userId(userId: String?) = userId(JsonField.ofNullable(userId)) - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun userId(userId: JsonField) = apply { this.userId = userId } /** The view definition */ fun viewData(viewData: ViewData?) = viewData(JsonField.ofNullable(viewData)) - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun viewData(viewData: JsonField) = apply { this.viewData = viewData } /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = viewType(JsonField.ofNullable(viewType)) - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun viewType(viewType: JsonField) = apply { this.viewType = viewType } fun additionalProperties(additionalProperties: Map) = apply { @@ -383,58 +551,97 @@ private constructor( /** The id of the object the view applies to */ fun objectId(objectId: String) = apply { body.objectId(objectId) } - /** The id of the object the view applies to */ + /** + * Sets [Builder.objectId] to an arbitrary JSON value. + * + * You should usually call [Builder.objectId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun objectId(objectId: JsonField) = apply { body.objectId(objectId) } /** The object type that the ACL applies to */ fun objectType(objectType: AclObjectType) = apply { body.objectType(objectType) } - /** The object type that the ACL applies to */ + /** + * Sets [Builder.objectType] to an arbitrary JSON value. + * + * You should usually call [Builder.objectType] with a well-typed [AclObjectType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun objectType(objectType: JsonField) = apply { body.objectType(objectType) } /** Name of the view */ fun name(name: String?) = apply { body.name(name) } - /** Name of the view */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Name of the view */ + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun name(name: JsonField) = apply { body.name(name) } /** Options for the view in the app */ fun options(options: ViewOptions?) = apply { body.options(options) } - /** Options for the view in the app */ + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) - /** Options for the view in the app */ + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [ViewOptions] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun options(options: JsonField) = apply { body.options(options) } /** Identifies the user who created the view */ fun userId(userId: String?) = apply { body.userId(userId) } - /** Identifies the user who created the view */ + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ fun userId(userId: Optional) = userId(userId.getOrNull()) - /** Identifies the user who created the view */ + /** + * Sets [Builder.userId] to an arbitrary JSON value. + * + * You should usually call [Builder.userId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun userId(userId: JsonField) = apply { body.userId(userId) } /** The view definition */ fun viewData(viewData: ViewData?) = apply { body.viewData(viewData) } - /** The view definition */ + /** Alias for calling [Builder.viewData] with `viewData.orElse(null)`. */ fun viewData(viewData: Optional) = viewData(viewData.getOrNull()) - /** The view definition */ + /** + * Sets [Builder.viewData] to an arbitrary JSON value. + * + * You should usually call [Builder.viewData] with a well-typed [ViewData] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewData(viewData: JsonField) = apply { body.viewData(viewData) } /** Type of table that the view corresponds to. */ fun viewType(viewType: ViewType?) = apply { body.viewType(viewType) } - /** Type of table that the view corresponds to. */ + /** Alias for calling [Builder.viewType] with `viewType.orElse(null)`. */ fun viewType(viewType: Optional) = viewType(viewType.getOrNull()) - /** Type of table that the view corresponds to. */ + /** + * Sets [Builder.viewType] to an arbitrary JSON value. + * + * You should usually call [Builder.viewType] with a well-typed [ViewType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun viewType(viewType: JsonField) = apply { body.viewType(viewType) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply {