From 37acbbd239d6b540a461084240bc266ad0491e9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 17:51:29 +0000 Subject: [PATCH 1/2] docs: builder, enum, and union comments (#171) --- .../client/okhttp/OpenAIOkHttpClient.kt | 1 + .../client/okhttp/OpenAIOkHttpClientAsync.kt | 1 + .../kotlin/com/openai/core/ClientOptions.kt | 1 + .../kotlin/com/openai/errors/OpenAIError.kt | 1 + .../kotlin/com/openai/models/Annotation.kt | 10 + .../com/openai/models/AnnotationDelta.kt | 14 + .../kotlin/com/openai/models/Assistant.kt | 4 + .../com/openai/models/AssistantDeleted.kt | 1 + .../models/AssistantResponseFormatOption.kt | 14 + .../com/openai/models/AssistantStreamEvent.kt | 38 ++ .../kotlin/com/openai/models/AssistantTool.kt | 12 + .../com/openai/models/AssistantToolChoice.kt | 36 ++ .../models/AssistantToolChoiceFunction.kt | 1 + .../models/AssistantToolChoiceOption.kt | 49 ++ .../models/AutoFileChunkingStrategyParam.kt | 1 + .../main/kotlin/com/openai/models/Batch.kt | 37 ++ .../com/openai/models/BatchCancelParams.kt | 1 + .../com/openai/models/BatchCreateParams.kt | 76 +++ .../kotlin/com/openai/models/BatchError.kt | 1 + .../com/openai/models/BatchListParams.kt | 1 + .../com/openai/models/BatchRequestCounts.kt | 1 + .../com/openai/models/BatchRetrieveParams.kt | 1 + .../models/BetaAssistantCreateParams.kt | 6 + .../models/BetaAssistantDeleteParams.kt | 1 + .../openai/models/BetaAssistantListParams.kt | 36 ++ .../models/BetaAssistantRetrieveParams.kt | 1 + .../models/BetaAssistantUpdateParams.kt | 5 + .../models/BetaThreadCreateAndRunParams.kt | 123 +++++ .../openai/models/BetaThreadCreateParams.kt | 71 +++ .../openai/models/BetaThreadDeleteParams.kt | 1 + .../models/BetaThreadMessageCreateParams.kt | 64 +++ .../models/BetaThreadMessageDeleteParams.kt | 1 + .../models/BetaThreadMessageListParams.kt | 36 ++ .../models/BetaThreadMessageRetrieveParams.kt | 1 + .../models/BetaThreadMessageUpdateParams.kt | 2 + .../openai/models/BetaThreadRetrieveParams.kt | 1 + .../models/BetaThreadRunCancelParams.kt | 1 + .../models/BetaThreadRunCreateParams.kt | 103 ++++ .../openai/models/BetaThreadRunListParams.kt | 36 ++ .../models/BetaThreadRunRetrieveParams.kt | 1 + .../models/BetaThreadRunStepListParams.kt | 36 ++ .../models/BetaThreadRunStepRetrieveParams.kt | 1 + .../BetaThreadRunSubmitToolOutputsParams.kt | 3 + .../models/BetaThreadRunUpdateParams.kt | 2 + .../openai/models/BetaThreadUpdateParams.kt | 5 + .../models/BetaVectorStoreCreateParams.kt | 3 + .../models/BetaVectorStoreDeleteParams.kt | 1 + .../BetaVectorStoreFileBatchCancelParams.kt | 1 + .../BetaVectorStoreFileBatchCreateParams.kt | 2 + ...BetaVectorStoreFileBatchListFilesParams.kt | 71 +++ .../BetaVectorStoreFileBatchRetrieveParams.kt | 1 + .../models/BetaVectorStoreFileCreateParams.kt | 2 + .../models/BetaVectorStoreFileDeleteParams.kt | 1 + .../models/BetaVectorStoreFileListParams.kt | 71 +++ .../BetaVectorStoreFileRetrieveParams.kt | 1 + .../models/BetaVectorStoreListParams.kt | 36 ++ .../models/BetaVectorStoreRetrieveParams.kt | 1 + .../models/BetaVectorStoreUpdateParams.kt | 3 + .../com/openai/models/ChatCompletion.kt | 78 +++ .../ChatCompletionAssistantMessageParam.kt | 31 ++ .../com/openai/models/ChatCompletionAudio.kt | 1 + .../openai/models/ChatCompletionAudioParam.kt | 71 +++ .../com/openai/models/ChatCompletionChunk.kt | 157 ++++++ .../models/ChatCompletionContentPart.kt | 14 + .../models/ChatCompletionContentPartImage.kt | 39 ++ .../ChatCompletionContentPartInputAudio.kt | 39 ++ .../ChatCompletionContentPartRefusal.kt | 1 + .../models/ChatCompletionContentPartText.kt | 1 + .../models/ChatCompletionCreateParams.kt | 115 ++++ .../ChatCompletionDeveloperMessageParam.kt | 14 + .../ChatCompletionFunctionCallOption.kt | 1 + .../ChatCompletionFunctionMessageParam.kt | 1 + .../openai/models/ChatCompletionMessage.kt | 2 + .../models/ChatCompletionMessageParam.kt | 14 + .../models/ChatCompletionMessageToolCall.kt | 2 + .../openai/models/ChatCompletionModality.kt | 36 ++ .../models/ChatCompletionNamedToolChoice.kt | 2 + .../models/ChatCompletionPredictionContent.kt | 14 + .../models/ChatCompletionReasoningEffort.kt | 38 ++ .../com/openai/models/ChatCompletionRole.kt | 36 ++ .../models/ChatCompletionStreamOptions.kt | 1 + .../ChatCompletionSystemMessageParam.kt | 14 + .../models/ChatCompletionTokenLogprob.kt | 2 + .../com/openai/models/ChatCompletionTool.kt | 1 + .../models/ChatCompletionToolChoiceOption.kt | 49 ++ .../models/ChatCompletionToolMessageParam.kt | 14 + .../models/ChatCompletionUserMessageParam.kt | 14 + .../kotlin/com/openai/models/ChatModel.kt | 33 ++ .../com/openai/models/CodeInterpreterLogs.kt | 1 + .../models/CodeInterpreterOutputImage.kt | 2 + .../com/openai/models/CodeInterpreterTool.kt | 1 + .../openai/models/CodeInterpreterToolCall.kt | 18 + .../models/CodeInterpreterToolCallDelta.kt | 15 + .../kotlin/com/openai/models/Completion.kt | 1 + .../com/openai/models/CompletionChoice.kt | 40 ++ .../openai/models/CompletionCreateParams.kt | 59 +++ .../com/openai/models/CompletionUsage.kt | 3 + .../openai/models/CreateEmbeddingResponse.kt | 2 + .../kotlin/com/openai/models/Embedding.kt | 1 + .../openai/models/EmbeddingCreateParams.kt | 51 ++ .../com/openai/models/EmbeddingModel.kt | 35 ++ .../kotlin/com/openai/models/ErrorObject.kt | 1 + .../com/openai/models/FileChunkingStrategy.kt | 14 + .../models/FileChunkingStrategyParam.kt | 14 + .../openai/models/FileCitationAnnotation.kt | 2 + .../models/FileCitationDeltaAnnotation.kt | 2 + .../com/openai/models/FileDeleteParams.kt | 1 + .../kotlin/com/openai/models/FileDeleted.kt | 1 + .../com/openai/models/FileListParams.kt | 36 ++ .../kotlin/com/openai/models/FileObject.kt | 71 +++ .../com/openai/models/FilePathAnnotation.kt | 2 + .../openai/models/FilePathDeltaAnnotation.kt | 2 + .../kotlin/com/openai/models/FilePurpose.kt | 33 ++ .../com/openai/models/FileRetrieveParams.kt | 1 + .../com/openai/models/FileSearchTool.kt | 41 ++ .../com/openai/models/FileSearchToolCall.kt | 43 ++ .../openai/models/FileSearchToolCallDelta.kt | 1 + .../kotlin/com/openai/models/FineTuningJob.kt | 220 ++++++++ .../models/FineTuningJobCancelParams.kt | 1 + .../openai/models/FineTuningJobCheckpoint.kt | 2 + .../FineTuningJobCheckpointListParams.kt | 1 + .../models/FineTuningJobCreateParams.kt | 222 ++++++++ .../com/openai/models/FineTuningJobEvent.kt | 71 +++ .../models/FineTuningJobListEventsParams.kt | 1 + .../openai/models/FineTuningJobListParams.kt | 1 + .../models/FineTuningJobRetrieveParams.kt | 1 + .../models/FineTuningJobWandbIntegration.kt | 1 + .../FineTuningJobWandbIntegrationObject.kt | 1 + .../com/openai/models/FunctionDefinition.kt | 1 + .../com/openai/models/FunctionParameters.kt | 1 + .../kotlin/com/openai/models/FunctionTool.kt | 1 + .../com/openai/models/FunctionToolCall.kt | 2 + .../openai/models/FunctionToolCallDelta.kt | 2 + .../main/kotlin/com/openai/models/Image.kt | 1 + .../kotlin/com/openai/models/ImageFile.kt | 36 ++ .../openai/models/ImageFileContentBlock.kt | 1 + .../com/openai/models/ImageFileDelta.kt | 36 ++ .../com/openai/models/ImageFileDeltaBlock.kt | 1 + .../com/openai/models/ImageGenerateParams.kt | 145 +++++ .../kotlin/com/openai/models/ImageModel.kt | 33 ++ .../main/kotlin/com/openai/models/ImageUrl.kt | 36 ++ .../com/openai/models/ImageUrlContentBlock.kt | 1 + .../kotlin/com/openai/models/ImageUrlDelta.kt | 36 ++ .../com/openai/models/ImageUrlDeltaBlock.kt | 1 + .../com/openai/models/ImagesResponse.kt | 1 + .../main/kotlin/com/openai/models/Message.kt | 123 +++++ .../com/openai/models/MessageContent.kt | 13 + .../com/openai/models/MessageContentDelta.kt | 14 + .../openai/models/MessageContentPartParam.kt | 14 + .../models/MessageCreationStepDetails.kt | 2 + .../com/openai/models/MessageDeleted.kt | 1 + .../kotlin/com/openai/models/MessageDelta.kt | 36 ++ .../com/openai/models/MessageDeltaEvent.kt | 1 + .../com/openai/models/MessageStreamEvent.kt | 19 + .../main/kotlin/com/openai/models/Model.kt | 1 + .../com/openai/models/ModelDeleteParams.kt | 1 + .../kotlin/com/openai/models/ModelDeleted.kt | 1 + .../com/openai/models/ModelListParams.kt | 1 + .../com/openai/models/ModelRetrieveParams.kt | 1 + .../kotlin/com/openai/models/Moderation.kt | 495 ++++++++++++++++++ .../openai/models/ModerationCreateParams.kt | 13 + .../openai/models/ModerationCreateResponse.kt | 1 + .../openai/models/ModerationImageUrlInput.kt | 2 + .../com/openai/models/ModerationModel.kt | 35 ++ .../models/ModerationMultiModalInput.kt | 14 + .../com/openai/models/ModerationTextInput.kt | 1 + .../models/OtherFileChunkingStrategyObject.kt | 1 + .../com/openai/models/RefusalContentBlock.kt | 1 + .../com/openai/models/RefusalDeltaBlock.kt | 1 + .../models/RequiredActionFunctionToolCall.kt | 2 + .../openai/models/ResponseFormatJsonObject.kt | 1 + .../openai/models/ResponseFormatJsonSchema.kt | 3 + .../com/openai/models/ResponseFormatText.kt | 1 + .../src/main/kotlin/com/openai/models/Run.kt | 114 ++++ .../kotlin/com/openai/models/RunStatus.kt | 33 ++ .../main/kotlin/com/openai/models/RunStep.kt | 122 +++++ .../kotlin/com/openai/models/RunStepDelta.kt | 15 + .../com/openai/models/RunStepDeltaEvent.kt | 1 + .../openai/models/RunStepDeltaMessageDelta.kt | 2 + .../com/openai/models/RunStepInclude.kt | 35 ++ .../com/openai/models/RunStepStreamEvent.kt | 21 + .../com/openai/models/RunStreamEvent.kt | 23 + .../models/StaticFileChunkingStrategy.kt | 1 + .../StaticFileChunkingStrategyObject.kt | 1 + .../StaticFileChunkingStrategyObjectParam.kt | 1 + .../src/main/kotlin/com/openai/models/Text.kt | 1 + .../com/openai/models/TextContentBlock.kt | 1 + .../openai/models/TextContentBlockParam.kt | 1 + .../kotlin/com/openai/models/TextDelta.kt | 1 + .../com/openai/models/TextDeltaBlock.kt | 1 + .../main/kotlin/com/openai/models/Thread.kt | 4 + .../kotlin/com/openai/models/ThreadDeleted.kt | 1 + .../com/openai/models/ThreadStreamEvent.kt | 1 + .../main/kotlin/com/openai/models/ToolCall.kt | 10 + .../kotlin/com/openai/models/ToolCallDelta.kt | 12 + .../com/openai/models/ToolCallDeltaObject.kt | 1 + .../com/openai/models/ToolCallsStepDetails.kt | 1 + .../main/kotlin/com/openai/models/Upload.kt | 36 ++ .../com/openai/models/UploadCancelParams.kt | 1 + .../com/openai/models/UploadCompleteParams.kt | 2 + .../com/openai/models/UploadCreateParams.kt | 2 + .../kotlin/com/openai/models/UploadPart.kt | 1 + .../kotlin/com/openai/models/VectorStore.kt | 38 ++ .../com/openai/models/VectorStoreDeleted.kt | 1 + .../com/openai/models/VectorStoreFile.kt | 72 +++ .../com/openai/models/VectorStoreFileBatch.kt | 37 ++ .../openai/models/VectorStoreFileDeleted.kt | 1 + 207 files changed, 4613 insertions(+) diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt index a7fec001..abb408f9 100644 --- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt +++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt @@ -24,6 +24,7 @@ class OpenAIOkHttpClient private constructor() { @JvmStatic fun fromEnv(): OpenAIClient = builder().fromEnv().build() } + /** A builder for [OpenAIOkHttpClient]. */ class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt index de53143b..3407fdc3 100644 --- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt +++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt @@ -24,6 +24,7 @@ class OpenAIOkHttpClientAsync private constructor() { @JvmStatic fun fromEnv(): OpenAIClientAsync = builder().fromEnv().build() } + /** A builder for [OpenAIOkHttpClientAsync]. */ class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() diff --git a/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt b/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt index 4b485458..d23b8222 100644 --- a/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt +++ b/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt @@ -48,6 +48,7 @@ private constructor( @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() } + /** A builder for [ClientOptions]. */ class Builder internal constructor() { private var httpClient: HttpClient? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt b/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt index 31a0d01c..9508dc2c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt @@ -30,6 +30,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [OpenAIError]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt index 976b4f3e..487dd69a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt @@ -129,6 +129,7 @@ private constructor( @JvmStatic fun ofFilePath(filePath: FilePathAnnotation) = Annotation(filePath = filePath) } + /** An interface that defines how to map each variant of [Annotation] to a value of type [T]. */ interface Visitor { /** @@ -144,6 +145,15 @@ private constructor( */ fun visitFilePath(filePath: FilePathAnnotation): T + /** + * Maps an unknown variant of [Annotation] to a value of type [T]. + * + * An instance of [Annotation] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Annotation: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt index ea6141a0..7eb9f641 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt @@ -130,6 +130,10 @@ private constructor( fun ofFilePath(filePath: FilePathDeltaAnnotation) = AnnotationDelta(filePath = filePath) } + /** + * An interface that defines how to map each variant of [AnnotationDelta] to a value of type + * [T]. + */ interface Visitor { /** @@ -145,6 +149,16 @@ private constructor( */ fun visitFilePath(filePath: FilePathDeltaAnnotation): T + /** + * Maps an unknown variant of [AnnotationDelta] to a value of type [T]. + * + * An instance of [AnnotationDelta] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is unaware + * of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown AnnotationDelta: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt b/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt index 41a32580..3b62306a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt @@ -261,6 +261,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Assistant]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -754,6 +755,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -857,6 +859,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -1001,6 +1004,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt index e7cf7a63..817d1bc6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [AssistantDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt index f4a6f118..2ed580f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt @@ -171,6 +171,10 @@ private constructor( AssistantResponseFormatOption(responseFormatJsonSchema = responseFormatJsonSchema) } + /** + * An interface that defines how to map each variant of [AssistantResponseFormatOption] to a + * value of type [T]. + */ interface Visitor { /** `auto` is the default value */ @@ -182,6 +186,16 @@ private constructor( fun visitResponseFormatJsonSchema(responseFormatJsonSchema: ResponseFormatJsonSchema): T + /** + * Maps an unknown variant of [AssistantResponseFormatOption] to a value of type [T]. + * + * An instance of [AssistantResponseFormatOption] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown AssistantResponseFormatOption: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt index 661e18fa..86c6ad82 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt @@ -858,6 +858,10 @@ private constructor( fun ofErrorEvent(errorEvent: ErrorEvent) = AssistantStreamEvent(errorEvent = errorEvent) } + /** + * An interface that defines how to map each variant of [AssistantStreamEvent] to a value of + * type [T]. + */ interface Visitor { /** @@ -1008,6 +1012,16 @@ private constructor( */ fun visitErrorEvent(errorEvent: ErrorEvent): T + /** + * Maps an unknown variant of [AssistantStreamEvent] to a value of type [T]. + * + * An instance of [AssistantStreamEvent] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown AssistantStreamEvent: $json") } @@ -1298,6 +1312,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1434,6 +1449,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1561,6 +1577,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunQueued]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1688,6 +1705,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunInProgress]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1815,6 +1833,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunRequiresAction]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1941,6 +1960,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCompleted]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2068,6 +2088,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunIncomplete]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2192,6 +2213,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunFailed]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2319,6 +2341,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCancelling]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2445,6 +2468,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCancelled]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2569,6 +2593,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunExpired]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2692,6 +2717,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2810,6 +2836,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepInProgress]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -2928,6 +2955,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepDelta]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3050,6 +3078,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepCompleted]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3167,6 +3196,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepFailed]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3285,6 +3315,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepCancelled]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3402,6 +3433,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepExpired]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3525,6 +3557,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3654,6 +3687,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageInProgress]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3777,6 +3811,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageDelta]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -3900,6 +3935,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageCompleted]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -4029,6 +4065,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageIncomplete]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -4150,6 +4187,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ErrorEvent]. */ class Builder internal constructor() { private var data: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt index 91887796..06b06179 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt @@ -113,6 +113,9 @@ private constructor( @JvmStatic fun ofFunction(function: FunctionTool) = AssistantTool(function = function) } + /** + * An interface that defines how to map each variant of [AssistantTool] to a value of type [T]. + */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T @@ -121,6 +124,15 @@ private constructor( fun visitFunction(function: FunctionTool): T + /** + * Maps an unknown variant of [AssistantTool] to a value of type [T]. + * + * An instance of [AssistantTool] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown AssistantTool: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt index b7cf8ab0..c6eecedd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [AssistantToolChoice]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -126,6 +127,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -139,19 +148,37 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { FUNCTION, CODE_INTERPRETER, FILE_SEARCH, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { FUNCTION, CODE_INTERPRETER, FILE_SEARCH, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { FUNCTION -> Value.FUNCTION @@ -160,6 +187,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { FUNCTION -> Known.FUNCTION diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt index 56fbc30c..b01f621b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt @@ -52,6 +52,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [AssistantToolChoiceFunction]. */ class Builder internal constructor() { private var name: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt index ee6b7952..8b0e9348 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt @@ -128,6 +128,10 @@ private constructor( AssistantToolChoiceOption(assistantToolChoice = assistantToolChoice) } + /** + * An interface that defines how to map each variant of [AssistantToolChoiceOption] to a value + * of type [T]. + */ interface Visitor { /** @@ -142,6 +146,16 @@ private constructor( */ fun visitAssistantToolChoice(assistantToolChoice: AssistantToolChoice): T + /** + * Maps an unknown variant of [AssistantToolChoiceOption] to a value of type [T]. + * + * An instance of [AssistantToolChoiceOption] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown AssistantToolChoiceOption: $json") } @@ -194,6 +208,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -207,19 +229,37 @@ private constructor( @JvmStatic fun of(value: String) = Auto(JsonField.of(value)) } + /** An enum containing [Auto]'s known values. */ enum class Known { NONE, AUTO, REQUIRED, } + /** + * An enum containing [Auto]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Auto] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { NONE, AUTO, REQUIRED, + /** An enum member indicating that [Auto] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { NONE -> Value.NONE @@ -228,6 +268,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { NONE -> Known.NONE diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt index 73d8c155..0e5d0898 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [AutoFileChunkingStrategyParam]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("auto") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt b/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt index 32d478d3..fe6f5d06 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt @@ -260,6 +260,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Batch]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -483,6 +484,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -506,6 +515,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { VALIDATING, FAILED, @@ -517,6 +527,15 @@ private constructor( CANCELLED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { VALIDATING, FAILED, @@ -526,9 +545,17 @@ private constructor( EXPIRED, CANCELLING, CANCELLED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { VALIDATING -> Value.VALIDATING @@ -542,6 +569,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { VALIDATING -> Known.VALIDATING @@ -617,6 +653,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Errors]. */ class Builder internal constructor() { private var data: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt index 0c372b2a..a4431b37 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt @@ -54,6 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchCancelParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt index 78a554cd..1f93018d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt @@ -206,6 +206,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchCreateBody]. */ class Builder internal constructor() { private var completionWindow: JsonField? = null @@ -345,6 +346,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -560,6 +562,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -569,21 +579,51 @@ private constructor( @JvmStatic fun of(value: String) = CompletionWindow(JsonField.of(value)) } + /** An enum containing [CompletionWindow]'s known values. */ enum class Known { _24H, } + /** + * An enum containing [CompletionWindow]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [CompletionWindow] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { _24H, + /** + * An enum member indicating that [CompletionWindow] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { _24H -> Value._24H else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { _24H -> Known._24H @@ -616,6 +656,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -629,19 +677,37 @@ private constructor( @JvmStatic fun of(value: String) = Endpoint(JsonField.of(value)) } + /** An enum containing [Endpoint]'s known values. */ enum class Known { V1_CHAT_COMPLETIONS, V1_EMBEDDINGS, V1_COMPLETIONS, } + /** + * An enum containing [Endpoint]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Endpoint] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { V1_CHAT_COMPLETIONS, V1_EMBEDDINGS, V1_COMPLETIONS, + /** An enum member indicating that [Endpoint] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { V1_CHAT_COMPLETIONS -> Value.V1_CHAT_COMPLETIONS @@ -650,6 +716,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { V1_CHAT_COMPLETIONS -> Known.V1_CHAT_COMPLETIONS @@ -703,6 +778,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Metadata]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt index 7b99b0b2..c9688668 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt @@ -78,6 +78,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchError]. */ class Builder internal constructor() { private var code: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt index 166ae685..f42f5247 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt @@ -52,6 +52,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchListParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt index ad9bf647..075cf81e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt @@ -71,6 +71,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchRequestCounts]. */ class Builder internal constructor() { private var completed: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt index 40d55644..926a164b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt @@ -40,6 +40,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BatchRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt index 382772e0..8507230c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt @@ -416,6 +416,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantCreateBody]. */ class Builder internal constructor() { private var model: JsonField? = null @@ -881,6 +882,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -1420,6 +1422,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -1523,6 +1526,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -1690,6 +1694,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null @@ -1888,6 +1893,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStore]. */ class Builder internal constructor() { private var chunkingStrategy: JsonField = diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt index 81e51332..ac46d252 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt index dbe25ae3..e3125dce 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt @@ -73,6 +73,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -275,6 +276,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -286,17 +295,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -304,6 +331,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt index 7e306076..0b9af4c3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt @@ -40,6 +40,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt index ecb67c04..8a3da006 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt @@ -426,6 +426,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantUpdateBody]. */ class Builder internal constructor() { private var description: JsonField = JsonMissing.of() @@ -883,6 +884,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaAssistantUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -1419,6 +1421,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -1522,6 +1525,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -1669,6 +1673,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt index 409b0034..1ec100a6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt @@ -629,6 +629,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadCreateAndRunBody]. */ class Builder internal constructor() { private var assistantId: JsonField? = null @@ -1291,6 +1292,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadCreateAndRunParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -2033,6 +2035,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Thread]. */ class Builder internal constructor() { private var messages: JsonField>? = null @@ -2226,6 +2229,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Message]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -2457,6 +2461,10 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type + * [T]. + */ interface Visitor { /** The text contents of the message. */ @@ -2472,6 +2480,16 @@ private constructor( arrayOfContentParts: List ): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if + * the SDK is on an older version than the API, then the API may respond with + * new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } @@ -2527,6 +2545,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2538,17 +2564,37 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { USER, ASSISTANT, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { USER, ASSISTANT, + /** + * An enum member indicating that [Role] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ fun value(): Value = when (this) { USER -> Value.USER @@ -2556,6 +2602,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { USER -> Known.USER @@ -2627,6 +2682,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Attachment]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() @@ -2793,12 +2849,26 @@ private constructor( Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search"))) } + /** + * An interface that defines how to map each variant of [Tool] to a value of + * type [T]. + */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T fun visitFileSearch(fileSearch: JsonValue): T + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Tool: $json") } @@ -2956,6 +3026,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -3062,6 +3133,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -3229,6 +3301,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null @@ -3429,6 +3502,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStore]. */ class Builder internal constructor() { private var chunkingStrategy: JsonField = @@ -3676,6 +3750,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -3779,6 +3854,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -3923,6 +3999,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null @@ -4131,6 +4208,7 @@ private constructor( @JvmStatic fun ofFunction(function: FunctionTool) = Tool(function = function) } + /** An interface that defines how to map each variant of [Tool] to a value of type [T]. */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T @@ -4139,6 +4217,15 @@ private constructor( fun visitFunction(function: FunctionTool): T + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Tool: $json") } @@ -4254,6 +4341,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TruncationStrategy]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -4350,6 +4438,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -4361,17 +4457,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { AUTO, LAST_MESSAGES, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LAST_MESSAGES, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -4379,6 +4493,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt index 6de40eb5..84f86353 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt @@ -166,6 +166,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadCreateBody]. */ class Builder internal constructor() { private var messages: JsonField>? = null @@ -300,6 +301,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -575,6 +577,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Message]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -792,6 +795,10 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type + * [T]. + */ interface Visitor { /** The text contents of the message. */ @@ -804,6 +811,16 @@ private constructor( */ fun visitArrayOfContentParts(arrayOfContentParts: List): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } @@ -859,6 +876,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -870,17 +895,35 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { USER, ASSISTANT, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { USER, ASSISTANT, + /** An enum member indicating that [Role] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { USER -> Value.USER @@ -888,6 +931,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { USER -> Known.USER @@ -959,6 +1011,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Attachment]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() @@ -1125,12 +1178,26 @@ private constructor( Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search"))) } + /** + * An interface that defines how to map each variant of [Tool] to a value of type + * [T]. + */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T fun visitFileSearch(fileSearch: JsonValue): T + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on + * an older version than the API, then the API may respond with new variants + * that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Tool: $json") } @@ -1283,6 +1350,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -1386,6 +1454,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -1553,6 +1622,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null @@ -1751,6 +1821,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStore]. */ class Builder internal constructor() { private var chunkingStrategy: JsonField = diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt index 71d04698..f302c923 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt index fdb3b54c..931bae99 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt @@ -181,6 +181,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageCreateBody]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -322,6 +323,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -626,6 +628,9 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** The text contents of the message. */ @@ -638,6 +643,16 @@ private constructor( */ fun visitArrayOfContentParts(arrayOfContentParts: List): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } @@ -693,6 +708,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -704,17 +727,35 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { USER, ASSISTANT, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { USER, ASSISTANT, + /** An enum member indicating that [Role] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { USER -> Value.USER @@ -722,6 +763,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { USER -> Known.USER @@ -793,6 +843,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Attachment]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() @@ -954,12 +1005,25 @@ private constructor( Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search"))) } + /** + * An interface that defines how to map each variant of [Tool] to a value of type [T]. + */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T fun visitFileSearch(fileSearch: JsonValue): T + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Tool: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt index 7a603a45..018151b5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt @@ -54,6 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt index 66ba5300..d23251ef 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt @@ -89,6 +89,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -305,6 +306,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -316,17 +325,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -334,6 +361,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt index 0386a28d..96c76735 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt @@ -44,6 +44,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt index 75822450..5208aee4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt @@ -97,6 +97,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageUpdateBody]. */ class Builder internal constructor() { private var metadata: JsonValue = JsonMissing.of() @@ -164,6 +165,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadMessageUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt index e4e053ee..5d87c85d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt @@ -40,6 +40,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt index 1674a093..009800d0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt @@ -54,6 +54,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunCancelParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt index e24a1df4..def84db7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt @@ -662,6 +662,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunCreateBody]. */ class Builder internal constructor() { private var assistantId: JsonField? = null @@ -1349,6 +1350,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -2152,6 +2154,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [AdditionalMessage]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -2369,6 +2372,10 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type + * [T]. + */ interface Visitor { /** The text contents of the message. */ @@ -2381,6 +2388,16 @@ private constructor( */ fun visitArrayOfContentParts(arrayOfContentParts: List): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } @@ -2436,6 +2453,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2447,17 +2472,35 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { USER, ASSISTANT, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { USER, ASSISTANT, + /** An enum member indicating that [Role] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { USER -> Value.USER @@ -2465,6 +2508,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { USER -> Known.USER @@ -2536,6 +2588,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Attachment]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() @@ -2702,12 +2755,26 @@ private constructor( Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search"))) } + /** + * An interface that defines how to map each variant of [Tool] to a value of type + * [T]. + */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T fun visitFileSearch(fileSearch: JsonValue): T + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on + * an older version than the API, then the API may respond with new variants + * that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Tool: $json") } @@ -2874,6 +2941,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TruncationStrategy]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -2970,6 +3038,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2981,17 +3057,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { AUTO, LAST_MESSAGES, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LAST_MESSAGES, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -2999,6 +3093,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt index dc8d1ad7..1fe05a63 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt @@ -84,6 +84,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -291,6 +292,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -302,17 +311,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -320,6 +347,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt index 50f16cd7..8be9b303 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt @@ -44,6 +44,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt index 735b9249..38683ae0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt @@ -102,6 +102,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunStepListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -354,6 +355,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -365,17 +374,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -383,6 +410,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt index 1b1b434a..f5d4bf4e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt @@ -68,6 +68,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunStepRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt index 23a71d07..38e29422 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt @@ -104,6 +104,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunSubmitToolOutputsBody]. */ class Builder internal constructor() { private var toolOutputs: JsonField>? = null @@ -192,6 +193,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunSubmitToolOutputsParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -414,6 +416,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolOutput]. */ class Builder internal constructor() { private var output: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt index 38c584eb..54d93523 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt @@ -97,6 +97,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunUpdateBody]. */ class Builder internal constructor() { private var metadata: JsonValue = JsonMissing.of() @@ -163,6 +164,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadRunUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt index b1d1c4f4..d09ace2e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt @@ -132,6 +132,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadUpdateBody]. */ class Builder internal constructor() { private var metadata: JsonValue = JsonMissing.of() @@ -232,6 +233,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaThreadUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -468,6 +470,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -571,6 +574,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -715,6 +719,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt index 7122023e..876301d3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt @@ -180,6 +180,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreCreateBody]. */ class Builder internal constructor() { private var chunkingStrategy: JsonField = JsonMissing.of() @@ -335,6 +336,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -595,6 +597,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ExpiresAfter]. */ class Builder internal constructor() { private var anchor: JsonValue = JsonValue.from("last_active_at") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt index 2297f21e..3288d553 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt index 2f8c1950..f8dd6852 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt @@ -57,6 +57,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileBatchCancelParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt index bec23d39..a2bb9206 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt @@ -137,6 +137,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileBatchCreateBody]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -265,6 +266,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileBatchCreateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt index 8e37bd1e..01857f73 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt @@ -93,6 +93,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileBatchListFilesParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -315,6 +316,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -330,6 +339,7 @@ private constructor( @JvmStatic fun of(value: String) = Filter(JsonField.of(value)) } + /** An enum containing [Filter]'s known values. */ enum class Known { IN_PROGRESS, COMPLETED, @@ -337,14 +347,31 @@ private constructor( CANCELLED, } + /** + * An enum containing [Filter]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Filter] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { IN_PROGRESS, COMPLETED, FAILED, CANCELLED, + /** An enum member indicating that [Filter] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { IN_PROGRESS -> Value.IN_PROGRESS @@ -354,6 +381,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { IN_PROGRESS -> Known.IN_PROGRESS @@ -388,6 +424,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -399,17 +443,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -417,6 +479,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt index 576c20e1..eac542ce 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt @@ -44,6 +44,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileBatchRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt index 771786b3..b3e875a3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt @@ -141,6 +141,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileCreateBody]. */ class Builder internal constructor() { private var fileId: JsonField? = null @@ -249,6 +250,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileCreateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt index edf6df28..c0b44aa2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt @@ -58,6 +58,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt index c047490f..f090899d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt @@ -89,6 +89,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -302,6 +303,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -317,6 +326,7 @@ private constructor( @JvmStatic fun of(value: String) = Filter(JsonField.of(value)) } + /** An enum containing [Filter]'s known values. */ enum class Known { IN_PROGRESS, COMPLETED, @@ -324,14 +334,31 @@ private constructor( CANCELLED, } + /** + * An enum containing [Filter]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Filter] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { IN_PROGRESS, COMPLETED, FAILED, CANCELLED, + /** An enum member indicating that [Filter] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { IN_PROGRESS -> Value.IN_PROGRESS @@ -341,6 +368,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { IN_PROGRESS -> Known.IN_PROGRESS @@ -375,6 +411,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -386,17 +430,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -404,6 +466,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt index cb48bda7..b685ce30 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt @@ -44,6 +44,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreFileRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt index 3e0c90af..d2f883fe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt @@ -73,6 +73,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -275,6 +276,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -286,17 +295,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -304,6 +331,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt index 45bb640c..9d42c68b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt @@ -40,6 +40,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt index 8c56f664..a3d47387 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt @@ -131,6 +131,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreUpdateBody]. */ class Builder internal constructor() { private var expiresAfter: JsonField = JsonMissing.of() @@ -228,6 +229,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [BetaVectorStoreUpdateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -450,6 +452,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ExpiresAfter]. */ class Builder internal constructor() { private var anchor: JsonValue = JsonValue.from("last_active_at") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt index 2462334a..1afd955c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt @@ -139,6 +139,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletion]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -361,6 +362,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Choice]. */ class Builder internal constructor() { private var finishReason: JsonField? = null @@ -463,6 +465,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -480,6 +490,7 @@ private constructor( @JvmStatic fun of(value: String) = FinishReason(JsonField.of(value)) } + /** An enum containing [FinishReason]'s known values. */ enum class Known { STOP, LENGTH, @@ -488,15 +499,35 @@ private constructor( FUNCTION_CALL, } + /** + * An enum containing [FinishReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FinishReason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { STOP, LENGTH, TOOL_CALLS, CONTENT_FILTER, FUNCTION_CALL, + /** + * An enum member indicating that [FinishReason] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { STOP -> Value.STOP @@ -507,6 +538,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { STOP -> Known.STOP @@ -588,6 +628,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Logprobs]. */ class Builder internal constructor() { private var content: JsonField>? = null @@ -728,6 +769,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -739,17 +788,37 @@ private constructor( @JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value)) } + /** An enum containing [ServiceTier]'s known values. */ enum class Known { SCALE, DEFAULT, } + /** + * An enum containing [ServiceTier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ServiceTier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SCALE, DEFAULT, + /** + * An enum member indicating that [ServiceTier] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { SCALE -> Value.SCALE @@ -757,6 +826,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SCALE -> Known.SCALE diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt index ba8b4887..9d574d28 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt @@ -155,6 +155,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionAssistantMessageParam]. */ class Builder internal constructor() { private var role: JsonValue = JsonValue.from("assistant") @@ -373,6 +374,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Audio]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -532,6 +534,9 @@ private constructor( ) = Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** The contents of the assistant message. */ @@ -545,6 +550,16 @@ private constructor( arrayOfContentParts: List ): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } @@ -688,6 +703,10 @@ private constructor( ChatCompletionRequestAssistantMessageContentPart(refusal = refusal) } + /** + * An interface that defines how to map each variant of + * [ChatCompletionRequestAssistantMessageContentPart] to a value of type [T]. + */ interface Visitor { /** @@ -698,6 +717,17 @@ private constructor( fun visitRefusal(refusal: ChatCompletionContentPartRefusal): T + /** + * Maps an unknown variant of [ChatCompletionRequestAssistantMessageContentPart] to + * a value of type [T]. + * + * An instance of [ChatCompletionRequestAssistantMessageContentPart] can contain an + * unknown variant if it was deserialized from data that doesn't match any known + * variant. For example, if the SDK is on an older version than the API, then the + * API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException( "Unknown ChatCompletionRequestAssistantMessageContentPart: $json" @@ -836,6 +866,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionCall]. */ class Builder internal constructor() { private var arguments: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt index 2e21aaa5..a7bde739 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt @@ -94,6 +94,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionAudio]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt index 6f07fc0e..02d89242 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt @@ -80,6 +80,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionAudioParam]. */ class Builder internal constructor() { private var format: JsonField? = null @@ -155,6 +156,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -172,6 +181,7 @@ private constructor( @JvmStatic fun of(value: String) = Format(JsonField.of(value)) } + /** An enum containing [Format]'s known values. */ enum class Known { WAV, MP3, @@ -180,15 +190,32 @@ private constructor( PCM16, } + /** + * An enum containing [Format]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Format] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WAV, MP3, FLAC, OPUS, PCM16, + /** An enum member indicating that [Format] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { WAV -> Value.WAV @@ -199,6 +226,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WAV -> Known.WAV @@ -235,6 +271,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -258,6 +302,7 @@ private constructor( @JvmStatic fun of(value: String) = Voice(JsonField.of(value)) } + /** An enum containing [Voice]'s known values. */ enum class Known { ALLOY, ASH, @@ -269,6 +314,15 @@ private constructor( VERSE, } + /** + * An enum containing [Voice]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Voice] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ALLOY, ASH, @@ -278,9 +332,17 @@ private constructor( SAGE, SHIMMER, VERSE, + /** An enum member indicating that [Voice] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ALLOY -> Value.ALLOY @@ -294,6 +356,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ALLOY -> Known.ALLOY diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt index 8617e44d..2c0a07d7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt @@ -162,6 +162,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionChunk]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -414,6 +415,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Choice]. */ class Builder internal constructor() { private var delta: JsonField? = null @@ -604,6 +606,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Delta]. */ class Builder internal constructor() { private var content: JsonField = JsonMissing.of() @@ -783,6 +786,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionCall]. */ class Builder internal constructor() { private var arguments: JsonField = JsonMissing.of() @@ -875,6 +879,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -890,6 +902,7 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { SYSTEM, USER, @@ -897,14 +910,33 @@ private constructor( TOOL, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SYSTEM, USER, ASSISTANT, TOOL, + /** + * An enum member indicating that [Role] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ fun value(): Value = when (this) { SYSTEM -> Value.SYSTEM @@ -914,6 +946,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { SYSTEM -> Known.SYSTEM @@ -1006,6 +1047,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolCall]. */ class Builder internal constructor() { private var index: JsonField? = null @@ -1137,6 +1179,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var arguments: JsonField = JsonMissing.of() @@ -1230,6 +1273,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value @@ -1240,21 +1291,51 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { FUNCTION, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { FUNCTION, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ fun value(): Value = when (this) { FUNCTION -> Value.FUNCTION else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { FUNCTION -> Known.FUNCTION @@ -1325,6 +1406,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1342,6 +1431,7 @@ private constructor( @JvmStatic fun of(value: String) = FinishReason(JsonField.of(value)) } + /** An enum containing [FinishReason]'s known values. */ enum class Known { STOP, LENGTH, @@ -1350,15 +1440,35 @@ private constructor( FUNCTION_CALL, } + /** + * An enum containing [FinishReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FinishReason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { STOP, LENGTH, TOOL_CALLS, CONTENT_FILTER, FUNCTION_CALL, + /** + * An enum member indicating that [FinishReason] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { STOP -> Value.STOP @@ -1369,6 +1479,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { STOP -> Known.STOP @@ -1450,6 +1569,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Logprobs]. */ class Builder internal constructor() { private var content: JsonField>? = null @@ -1590,6 +1710,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1601,17 +1729,37 @@ private constructor( @JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value)) } + /** An enum containing [ServiceTier]'s known values. */ enum class Known { SCALE, DEFAULT, } + /** + * An enum containing [ServiceTier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ServiceTier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SCALE, DEFAULT, + /** + * An enum member indicating that [ServiceTier] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { SCALE -> Value.SCALE @@ -1619,6 +1767,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SCALE -> Known.SCALE diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt index 6b9d1023..ac540cb7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt @@ -126,6 +126,10 @@ private constructor( ChatCompletionContentPart(inputAudio = inputAudio) } + /** + * An interface that defines how to map each variant of [ChatCompletionContentPart] to a value + * of type [T]. + */ interface Visitor { /** Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation). */ @@ -137,6 +141,16 @@ private constructor( /** Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). */ fun visitInputAudio(inputAudio: ChatCompletionContentPartInputAudio): T + /** + * Maps an unknown variant of [ChatCompletionContentPart] to a value of type [T]. + * + * An instance of [ChatCompletionContentPart] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ChatCompletionContentPart: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt index 897ee92c..82d84c8a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt @@ -65,6 +65,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionContentPartImage]. */ class Builder internal constructor() { private var imageUrl: JsonField? = null @@ -166,6 +167,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageUrl]. */ class Builder internal constructor() { private var url: JsonField? = null @@ -234,6 +236,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -247,19 +257,39 @@ private constructor( @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) } + /** An enum containing [Detail]'s known values. */ enum class Known { AUTO, LOW, HIGH, } + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LOW, HIGH, + /** + * An enum member indicating that [Detail] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -268,6 +298,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt index 543d767d..2d953c32 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionContentPartInputAudio]. */ class Builder internal constructor() { private var inputAudio: JsonField? = null @@ -165,6 +166,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [InputAudio]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -224,6 +226,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -235,17 +245,37 @@ private constructor( @JvmStatic fun of(value: String) = Format(JsonField.of(value)) } + /** An enum containing [Format]'s known values. */ enum class Known { WAV, MP3, } + /** + * An enum containing [Format]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Format] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { WAV, MP3, + /** + * An enum member indicating that [Format] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { WAV -> Value.WAV @@ -253,6 +283,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { WAV -> Known.WAV diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt index 2ce2f1e6..6ee691d8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt @@ -64,6 +64,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionContentPartRefusal]. */ class Builder internal constructor() { private var refusal: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt index 3521cfa5..c7edcedc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionContentPartText]. */ class Builder internal constructor() { private var text: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt index 7fe13087..17818fcf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt @@ -1248,6 +1248,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionCreateBody]. */ class Builder internal constructor() { private var messages: JsonField>? = null @@ -2436,6 +2437,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -3677,6 +3679,10 @@ private constructor( FunctionCall(functionCallOption = functionCallOption) } + /** + * An interface that defines how to map each variant of [FunctionCall] to a value of type + * [T]. + */ interface Visitor { /** @@ -3691,6 +3697,16 @@ private constructor( */ fun visitFunctionCallOption(functionCallOption: ChatCompletionFunctionCallOption): T + /** + * Maps an unknown variant of [FunctionCall] to a value of type [T]. + * + * An instance of [FunctionCall] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown FunctionCall: $json") } @@ -3742,6 +3758,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -3753,17 +3777,35 @@ private constructor( @JvmStatic fun of(value: String) = Auto(JsonField.of(value)) } + /** An enum containing [Auto]'s known values. */ enum class Known { NONE, AUTO, } + /** + * An enum containing [Auto]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Auto] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { NONE, AUTO, + /** An enum member indicating that [Auto] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { NONE -> Value.NONE @@ -3771,6 +3813,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { NONE -> Known.NONE @@ -3886,6 +3937,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var name: JsonField? = null @@ -4033,6 +4085,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LogitBias]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() @@ -4114,6 +4167,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Metadata]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() @@ -4275,6 +4329,10 @@ private constructor( ResponseFormat(jsonSchema = jsonSchema) } + /** + * An interface that defines how to map each variant of [ResponseFormat] to a value of type + * [T]. + */ interface Visitor { fun visitText(text: ResponseFormatText): T @@ -4283,6 +4341,16 @@ private constructor( fun visitJsonSchema(jsonSchema: ResponseFormatJsonSchema): T + /** + * Maps an unknown variant of [ResponseFormat] to a value of type [T]. + * + * An instance of [ResponseFormat] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ResponseFormat: $json") } @@ -4345,6 +4413,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -4356,17 +4432,37 @@ private constructor( @JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value)) } + /** An enum containing [ServiceTier]'s known values. */ enum class Known { AUTO, DEFAULT, } + /** + * An enum containing [ServiceTier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ServiceTier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, DEFAULT, + /** + * An enum member indicating that [ServiceTier] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -4374,6 +4470,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO @@ -4470,12 +4575,22 @@ private constructor( @JvmStatic fun ofStrings(strings: List) = Stop(strings = strings) } + /** An interface that defines how to map each variant of [Stop] to a value of type [T]. */ interface Visitor { fun visitString(string: String): T fun visitStrings(strings: List): T + /** + * Maps an unknown variant of [Stop] to a value of type [T]. + * + * An instance of [Stop] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Stop: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt index 10805c64..1f464514 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt @@ -93,6 +93,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionDeveloperMessageParam]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -267,6 +268,9 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** The contents of the developer message. */ @@ -280,6 +284,16 @@ private constructor( arrayOfContentParts: List ): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt index 6163f2a3..29e94281 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionFunctionCallOption]. */ class Builder internal constructor() { private var name: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt index 227a3642..16bfec77 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt @@ -74,6 +74,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionFunctionMessageParam]. */ class Builder internal constructor() { private var content: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt index 4039d8a3..1edec00b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt @@ -146,6 +146,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionMessage]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -340,6 +341,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionCall]. */ class Builder internal constructor() { private var arguments: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt index 4d91c7e2..354958eb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt @@ -205,6 +205,10 @@ private constructor( ChatCompletionMessageParam(function = function) } + /** + * An interface that defines how to map each variant of [ChatCompletionMessageParam] to a value + * of type [T]. + */ interface Visitor { /** @@ -230,6 +234,16 @@ private constructor( @Deprecated("deprecated") fun visitFunction(function: ChatCompletionFunctionMessageParam): T + /** + * Maps an unknown variant of [ChatCompletionMessageParam] to a value of type [T]. + * + * An instance of [ChatCompletionMessageParam] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ChatCompletionMessageParam: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt index 424ab0a8..0903cebc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt @@ -72,6 +72,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionMessageToolCall]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -190,6 +191,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var arguments: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt index e4a97301..acc35bd6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt @@ -13,6 +13,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -24,17 +31,38 @@ private constructor( @JvmStatic fun of(value: String) = ChatCompletionModality(JsonField.of(value)) } + /** An enum containing [ChatCompletionModality]'s known values. */ enum class Known { TEXT, AUDIO, } + /** + * An enum containing [ChatCompletionModality]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ChatCompletionModality] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, AUDIO, + /** + * An enum member indicating that [ChatCompletionModality] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -42,6 +70,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt index 68f9a365..b07dc3e3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionNamedToolChoice]. */ class Builder internal constructor() { private var function: JsonField? = null @@ -149,6 +150,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var name: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt index 5fb5a1f0..2547a535 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt @@ -87,6 +87,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionPredictionContent]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -273,6 +274,9 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** @@ -290,6 +294,16 @@ private constructor( arrayOfContentParts: List ): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt index 6ad438e8..d485fdad 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt @@ -21,6 +21,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -34,19 +41,42 @@ private constructor( @JvmStatic fun of(value: String) = ChatCompletionReasoningEffort(JsonField.of(value)) } + /** An enum containing [ChatCompletionReasoningEffort]'s known values. */ enum class Known { LOW, MEDIUM, HIGH, } + /** + * An enum containing [ChatCompletionReasoningEffort]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ChatCompletionReasoningEffort] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { LOW, MEDIUM, HIGH, + /** + * An enum member indicating that [ChatCompletionReasoningEffort] was instantiated with an + * unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { LOW -> Value.LOW @@ -55,6 +85,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { LOW -> Known.LOW diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt index c6e940b0..b6be330f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt @@ -14,6 +14,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -31,6 +38,7 @@ private constructor( @JvmStatic fun of(value: String) = ChatCompletionRole(JsonField.of(value)) } + /** An enum containing [ChatCompletionRole]'s known values. */ enum class Known { SYSTEM, USER, @@ -39,15 +47,35 @@ private constructor( FUNCTION, } + /** + * An enum containing [ChatCompletionRole]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ChatCompletionRole] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SYSTEM, USER, ASSISTANT, TOOL, FUNCTION, + /** + * An enum member indicating that [ChatCompletionRole] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { SYSTEM -> Value.SYSTEM @@ -58,6 +86,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { SYSTEM -> Known.SYSTEM diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt index 03ef3449..13d36387 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt @@ -68,6 +68,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionStreamOptions]. */ class Builder internal constructor() { private var includeUsage: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt index f5321bb0..36012d06 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt @@ -93,6 +93,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionSystemMessageParam]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -266,6 +267,9 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** The contents of the system message. */ @@ -279,6 +283,16 @@ private constructor( arrayOfContentParts: List ): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt index 8bac1f0a..87648b58 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt @@ -107,6 +107,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionTokenLogprob]. */ class Builder internal constructor() { private var token: JsonField? = null @@ -322,6 +323,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TopLogprob]. */ class Builder internal constructor() { private var token: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt index 66ab4fa0..cdff8a43 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt @@ -64,6 +64,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionTool]. */ class Builder internal constructor() { private var function: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt index 4e39ea79..19bff6b3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt @@ -134,6 +134,10 @@ private constructor( ChatCompletionToolChoiceOption(namedToolChoice = namedToolChoice) } + /** + * An interface that defines how to map each variant of [ChatCompletionToolChoiceOption] to a + * value of type [T]. + */ interface Visitor { /** @@ -149,6 +153,16 @@ private constructor( */ fun visitNamedToolChoice(namedToolChoice: ChatCompletionNamedToolChoice): T + /** + * Maps an unknown variant of [ChatCompletionToolChoiceOption] to a value of type [T]. + * + * An instance of [ChatCompletionToolChoiceOption] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ChatCompletionToolChoiceOption: $json") } @@ -200,6 +214,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -213,19 +235,37 @@ private constructor( @JvmStatic fun of(value: String) = Auto(JsonField.of(value)) } + /** An enum containing [Auto]'s known values. */ enum class Known { NONE, AUTO, REQUIRED, } + /** + * An enum containing [Auto]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Auto] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { NONE, AUTO, REQUIRED, + /** An enum member indicating that [Auto] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { NONE -> Value.NONE @@ -234,6 +274,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { NONE -> Known.NONE diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt index 72b31f60..ea7a6974 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt @@ -85,6 +85,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionToolMessageParam]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -251,6 +252,9 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** The contents of the tool message. */ @@ -264,6 +268,16 @@ private constructor( arrayOfContentParts: List ): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt index 9c51b146..9bb79dd4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt @@ -90,6 +90,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ChatCompletionUserMessageParam]. */ class Builder internal constructor() { private var content: JsonField? = null @@ -266,6 +267,9 @@ private constructor( Content(arrayOfContentParts = arrayOfContentParts) } + /** + * An interface that defines how to map each variant of [Content] to a value of type [T]. + */ interface Visitor { /** The text contents of the message. */ @@ -278,6 +282,16 @@ private constructor( */ fun visitArrayOfContentParts(arrayOfContentParts: List): T + /** + * Maps an unknown variant of [Content] to a value of type [T]. + * + * An instance of [Content] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Content: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt index dfd10caa..441ff07b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt @@ -13,6 +13,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -95,6 +102,7 @@ private constructor( @JvmStatic fun of(value: String) = ChatModel(JsonField.of(value)) } + /** An enum containing [ChatModel]'s known values. */ enum class Known { O1, O1_2024_12_17, @@ -135,6 +143,15 @@ private constructor( GPT_3_5_TURBO_16K_0613, } + /** + * An enum containing [ChatModel]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ChatModel] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { O1, O1_2024_12_17, @@ -173,9 +190,17 @@ private constructor( GPT_3_5_TURBO_1106, GPT_3_5_TURBO_0125, GPT_3_5_TURBO_16K_0613, + /** An enum member indicating that [ChatModel] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { O1 -> Value.O1 @@ -218,6 +243,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { O1 -> Known.O1 diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt index 44a9ed3f..3617a1fb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt @@ -72,6 +72,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreterLogs]. */ class Builder internal constructor() { private var index: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt index 1e170d8c..2a97ae23 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt @@ -69,6 +69,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreterOutputImage]. */ class Builder internal constructor() { private var index: JsonField? = null @@ -164,6 +165,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Image]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt index 8469231e..b02bafcd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt @@ -52,6 +52,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreterTool]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("code_interpreter") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt index 4cd2cf64..f0a1d300 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt @@ -90,6 +90,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreterToolCall]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -212,6 +213,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var input: JsonField? = null @@ -383,6 +385,9 @@ private constructor( @JvmStatic fun ofImage(image: ImageOutput) = Output(image = image) } + /** + * An interface that defines how to map each variant of [Output] to a value of type [T]. + */ interface Visitor { /** Text output from the Code Interpreter tool call as part of a run step. */ @@ -390,6 +395,16 @@ private constructor( fun visitImage(image: ImageOutput): T + /** + * Maps an unknown variant of [Output] to a value of type [T]. + * + * An instance of [Output] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Output: $json") } @@ -487,6 +502,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LogsOutput]. */ class Builder internal constructor() { private var logs: JsonField? = null @@ -605,6 +621,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageOutput]. */ class Builder internal constructor() { private var image: JsonField? = null @@ -702,6 +719,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Image]. */ class Builder internal constructor() { private var fileId: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt index d5f77b96..01d874a4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt @@ -99,6 +99,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreterToolCallDelta]. */ class Builder internal constructor() { private var index: JsonField? = null @@ -230,6 +231,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var input: JsonField = JsonMissing.of() @@ -401,6 +403,9 @@ private constructor( @JvmStatic fun ofImage(image: CodeInterpreterOutputImage) = Output(image = image) } + /** + * An interface that defines how to map each variant of [Output] to a value of type [T]. + */ interface Visitor { /** Text output from the Code Interpreter tool call as part of a run step. */ @@ -408,6 +413,16 @@ private constructor( fun visitImage(image: CodeInterpreterOutputImage): T + /** + * Maps an unknown variant of [Output] to a value of type [T]. + * + * An instance of [Output] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Output: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt b/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt index a48e0988..0e9db010 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt @@ -130,6 +130,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Completion]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt index 26324403..e2f0ff78 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt @@ -89,6 +89,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CompletionChoice]. */ class Builder internal constructor() { private var finishReason: JsonField? = null @@ -179,6 +180,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -192,19 +201,39 @@ private constructor( @JvmStatic fun of(value: String) = FinishReason(JsonField.of(value)) } + /** An enum containing [FinishReason]'s known values. */ enum class Known { STOP, LENGTH, CONTENT_FILTER, } + /** + * An enum containing [FinishReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FinishReason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { STOP, LENGTH, CONTENT_FILTER, + /** + * An enum member indicating that [FinishReason] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { STOP -> Value.STOP @@ -213,6 +242,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { STOP -> Known.STOP @@ -306,6 +344,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Logprobs]. */ class Builder internal constructor() { private var textOffset: JsonField>? = null @@ -458,6 +497,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TopLogprob]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt index 35667529..dea43a8c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt @@ -741,6 +741,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CompletionCreateBody]. */ class Builder internal constructor() { private var model: JsonField? = null @@ -1469,6 +1470,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CompletionCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -2233,6 +2235,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -2246,19 +2256,37 @@ private constructor( @JvmStatic fun of(value: String) = Model(JsonField.of(value)) } + /** An enum containing [Model]'s known values. */ enum class Known { GPT_3_5_TURBO_INSTRUCT, DAVINCI_002, BABBAGE_002, } + /** + * An enum containing [Model]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Model] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { GPT_3_5_TURBO_INSTRUCT, DAVINCI_002, BABBAGE_002, + /** An enum member indicating that [Model] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { GPT_3_5_TURBO_INSTRUCT -> Value.GPT_3_5_TURBO_INSTRUCT @@ -2267,6 +2295,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { GPT_3_5_TURBO_INSTRUCT -> Known.GPT_3_5_TURBO_INSTRUCT @@ -2403,6 +2440,7 @@ private constructor( Prompt(arrayOfTokenArrays = arrayOfTokenArrays) } + /** An interface that defines how to map each variant of [Prompt] to a value of type [T]. */ interface Visitor { fun visitString(string: String): T @@ -2413,6 +2451,16 @@ private constructor( fun visitArrayOfTokenArrays(arrayOfTokenArrays: List>): T + /** + * Maps an unknown variant of [Prompt] to a value of type [T]. + * + * An instance of [Prompt] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Prompt: $json") } @@ -2502,6 +2550,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LogitBias]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() @@ -2627,12 +2676,22 @@ private constructor( @JvmStatic fun ofStrings(strings: List) = Stop(strings = strings) } + /** An interface that defines how to map each variant of [Stop] to a value of type [T]. */ interface Visitor { fun visitString(string: String): T fun visitStrings(strings: List): T + /** + * Maps an unknown variant of [Stop] to a value of type [T]. + * + * An instance of [Stop] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Stop: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionUsage.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionUsage.kt index d72b1875..f661b4d5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionUsage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionUsage.kt @@ -106,6 +106,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CompletionUsage]. */ class Builder internal constructor() { private var completionTokens: JsonField? = null @@ -291,6 +292,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CompletionTokensDetails]. */ class Builder internal constructor() { private var acceptedPredictionTokens: JsonField = JsonMissing.of() @@ -460,6 +462,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [PromptTokensDetails]. */ class Builder internal constructor() { private var audioTokens: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt index f66edf28..48bc376e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt @@ -80,6 +80,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CreateEmbeddingResponse]. */ class Builder internal constructor() { private var data: JsonField>? = null @@ -217,6 +218,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Usage]. */ class Builder internal constructor() { private var promptTokens: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt b/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt index 0d35928c..5d64ae93 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt @@ -79,6 +79,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Embedding]. */ class Builder internal constructor() { private var embedding: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt index fdf80ccf..84d2c5b2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt @@ -255,6 +255,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [EmbeddingCreateBody]. */ class Builder internal constructor() { private var input: JsonField? = null @@ -433,6 +434,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [EmbeddingCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -805,6 +807,7 @@ private constructor( Input(arrayOfTokenArrays = arrayOfTokenArrays) } + /** An interface that defines how to map each variant of [Input] to a value of type [T]. */ interface Visitor { /** The string that will be turned into an embedding. */ @@ -819,6 +822,16 @@ private constructor( /** The array of arrays containing integers that will be turned into an embedding. */ fun visitArrayOfTokenArrays(arrayOfTokenArrays: List>): T + /** + * Maps an unknown variant of [Input] to a value of type [T]. + * + * An instance of [Input] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Input: $json") } @@ -876,6 +889,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -887,17 +908,38 @@ private constructor( @JvmStatic fun of(value: String) = EncodingFormat(JsonField.of(value)) } + /** An enum containing [EncodingFormat]'s known values. */ enum class Known { FLOAT, BASE64, } + /** + * An enum containing [EncodingFormat]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EncodingFormat] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { FLOAT, BASE64, + /** + * An enum member indicating that [EncodingFormat] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { FLOAT -> Value.FLOAT @@ -905,6 +947,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { FLOAT -> Known.FLOAT diff --git a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt index e130a4b7..03d0a4cc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt @@ -13,6 +13,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -26,19 +33,39 @@ private constructor( @JvmStatic fun of(value: String) = EmbeddingModel(JsonField.of(value)) } + /** An enum containing [EmbeddingModel]'s known values. */ enum class Known { TEXT_EMBEDDING_ADA_002, TEXT_EMBEDDING_3_SMALL, TEXT_EMBEDDING_3_LARGE, } + /** + * An enum containing [EmbeddingModel]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EmbeddingModel] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT_EMBEDDING_ADA_002, TEXT_EMBEDDING_3_SMALL, TEXT_EMBEDDING_3_LARGE, + /** + * An enum member indicating that [EmbeddingModel] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { TEXT_EMBEDDING_ADA_002 -> Value.TEXT_EMBEDDING_ADA_002 @@ -47,6 +74,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { TEXT_EMBEDDING_ADA_002 -> Known.TEXT_EMBEDDING_ADA_002 diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt index b9386cfd..bdb0d735 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt @@ -71,6 +71,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ErrorObject]. */ class Builder internal constructor() { private var code: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategy.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategy.kt index 46094c6a..a5023116 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategy.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategy.kt @@ -111,6 +111,10 @@ private constructor( fun ofOther(other: OtherFileChunkingStrategyObject) = FileChunkingStrategy(other = other) } + /** + * An interface that defines how to map each variant of [FileChunkingStrategy] to a value of + * type [T]. + */ interface Visitor { fun visitStatic(static_: StaticFileChunkingStrategyObject): T @@ -121,6 +125,16 @@ private constructor( */ fun visitOther(other: OtherFileChunkingStrategyObject): T + /** + * Maps an unknown variant of [FileChunkingStrategy] to a value of type [T]. + * + * An instance of [FileChunkingStrategy] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown FileChunkingStrategy: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategyParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategyParam.kt index 4f8b542e..41ae88b3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategyParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileChunkingStrategyParam.kt @@ -114,6 +114,10 @@ private constructor( FileChunkingStrategyParam(static_ = static_) } + /** + * An interface that defines how to map each variant of [FileChunkingStrategyParam] to a value + * of type [T]. + */ interface Visitor { /** @@ -124,6 +128,16 @@ private constructor( fun visitStatic(static_: StaticFileChunkingStrategyObjectParam): T + /** + * Maps an unknown variant of [FileChunkingStrategyParam] to a value of type [T]. + * + * An instance of [FileChunkingStrategyParam] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown FileChunkingStrategyParam: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileCitationAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileCitationAnnotation.kt index 1395cac8..330357e6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileCitationAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileCitationAnnotation.kt @@ -93,6 +93,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileCitationAnnotation]. */ class Builder internal constructor() { private var endIndex: JsonField? = null @@ -204,6 +205,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileCitation]. */ class Builder internal constructor() { private var fileId: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileCitationDeltaAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileCitationDeltaAnnotation.kt index 00c7839d..605d2a3d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileCitationDeltaAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileCitationDeltaAnnotation.kt @@ -103,6 +103,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileCitationDeltaAnnotation]. */ class Builder internal constructor() { private var index: JsonField? = null @@ -233,6 +234,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileCitation]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileDeleteParams.kt index 7b350de6..067892f4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileDeleteParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt index 30b5abc0..c1ec3ab0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt index 2f9aa056..c54a015c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt @@ -69,6 +69,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileListParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -261,6 +262,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -272,17 +281,35 @@ private constructor( @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } + /** An enum containing [Order]'s known values. */ enum class Known { ASC, DESC, } + /** + * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Order] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASC, DESC, + /** An enum member indicating that [Order] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASC -> Value.ASC @@ -290,6 +317,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASC -> Known.ASC diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt index 3d5b427b..c1aef8e0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt @@ -149,6 +149,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileObject]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -285,6 +286,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -306,6 +315,7 @@ private constructor( @JvmStatic fun of(value: String) = Purpose(JsonField.of(value)) } + /** An enum containing [Purpose]'s known values. */ enum class Known { ASSISTANTS, ASSISTANTS_OUTPUT, @@ -316,6 +326,15 @@ private constructor( VISION, } + /** + * An enum containing [Purpose]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Purpose] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASSISTANTS, ASSISTANTS_OUTPUT, @@ -324,9 +343,17 @@ private constructor( FINE_TUNE, FINE_TUNE_RESULTS, VISION, + /** An enum member indicating that [Purpose] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { ASSISTANTS -> Value.ASSISTANTS @@ -339,6 +366,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { ASSISTANTS -> Known.ASSISTANTS @@ -377,6 +413,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -390,19 +434,37 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { UPLOADED, PROCESSED, ERROR, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { UPLOADED, PROCESSED, ERROR, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { UPLOADED -> Value.UPLOADED @@ -411,6 +473,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { UPLOADED -> Known.UPLOADED diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FilePathAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/FilePathAnnotation.kt index 06ca5c1e..c6f08974 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FilePathAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FilePathAnnotation.kt @@ -90,6 +90,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FilePathAnnotation]. */ class Builder internal constructor() { private var endIndex: JsonField? = null @@ -199,6 +200,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FilePath]. */ class Builder internal constructor() { private var fileId: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FilePathDeltaAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/FilePathDeltaAnnotation.kt index d1ce0eb1..b0f4797f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FilePathDeltaAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FilePathDeltaAnnotation.kt @@ -99,6 +99,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FilePathDeltaAnnotation]. */ class Builder internal constructor() { private var index: JsonField? = null @@ -217,6 +218,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FilePath]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt b/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt index 775a2a75..8ecc8846 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt @@ -21,6 +21,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -36,6 +43,7 @@ private constructor( @JvmStatic fun of(value: String) = FilePurpose(JsonField.of(value)) } + /** An enum containing [FilePurpose]'s known values. */ enum class Known { ASSISTANTS, BATCH, @@ -43,14 +51,31 @@ private constructor( VISION, } + /** + * An enum containing [FilePurpose]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FilePurpose] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { ASSISTANTS, BATCH, FINE_TUNE, VISION, + /** An enum member indicating that [FilePurpose] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { ASSISTANTS -> Value.ASSISTANTS @@ -60,6 +85,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { ASSISTANTS -> Known.ASSISTANTS diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileRetrieveParams.kt index 6aa36d05..38d9740c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileRetrieveParams.kt @@ -40,6 +40,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileSearchTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileSearchTool.kt index 16185f7f..101d7a82 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileSearchTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileSearchTool.kt @@ -69,6 +69,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearchTool]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("file_search") @@ -204,6 +205,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var maxNumResults: JsonField = JsonMissing.of() @@ -362,6 +364,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RankingOptions]. */ class Builder internal constructor() { private var scoreThreshold: JsonField? = null @@ -441,6 +444,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -452,17 +463,38 @@ private constructor( @JvmStatic fun of(value: String) = Ranker(JsonField.of(value)) } + /** An enum containing [Ranker]'s known values. */ enum class Known { AUTO, DEFAULT_2024_08_21, } + /** + * An enum containing [Ranker]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Ranker] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, DEFAULT_2024_08_21, + /** + * An enum member indicating that [Ranker] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -470,6 +502,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCall.kt index 91f91ee8..e2ea6ab2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCall.kt @@ -78,6 +78,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearchToolCall]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -192,6 +193,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var rankingOptions: JsonField = JsonMissing.of() @@ -322,6 +324,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RankingOptions]. */ class Builder internal constructor() { private var ranker: JsonValue = JsonValue.from("default_2024_08_21") @@ -484,6 +487,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Result]. */ class Builder internal constructor() { private var fileId: JsonField? = null @@ -637,6 +641,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Content]. */ class Builder internal constructor() { private var text: JsonField = JsonMissing.of() @@ -699,6 +704,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value @@ -709,21 +722,51 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a + * known member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCallDelta.kt index b3679862..0455612c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileSearchToolCallDelta.kt @@ -79,6 +79,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearchToolCallDelta]. */ class Builder internal constructor() { private var fileSearch: JsonValue? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt index 7fe023b1..3254fa9a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt @@ -315,6 +315,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJob]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -761,6 +762,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Error]. */ class Builder internal constructor() { private var code: JsonField? = null @@ -939,6 +941,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Hyperparameters]. */ class Builder internal constructor() { private var batchSize: JsonField = JsonMissing.of() @@ -1145,12 +1148,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = BatchSize(manual = manual) } + /** + * An interface that defines how to map each variant of [BatchSize] to a value of type + * [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [BatchSize] to a value of type [T]. + * + * An instance of [BatchSize] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown BatchSize: $json") } @@ -1283,12 +1300,26 @@ private constructor( @JvmStatic fun ofNumber(number: Double) = LearningRateMultiplier(number = number) } + /** + * An interface that defines how to map each variant of [LearningRateMultiplier] to a + * value of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitNumber(number: Double): T + /** + * Maps an unknown variant of [LearningRateMultiplier] to a value of type [T]. + * + * An instance of [LearningRateMultiplier] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the + * SDK is on an older version than the API, then the API may respond with new + * variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown LearningRateMultiplier: $json") } @@ -1423,12 +1454,26 @@ private constructor( @JvmStatic fun ofInteger(integer: Long) = NEpochs(integer = integer) } + /** + * An interface that defines how to map each variant of [NEpochs] to a value of type + * [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitInteger(integer: Long): T + /** + * Maps an unknown variant of [NEpochs] to a value of type [T]. + * + * An instance of [NEpochs] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown NEpochs: $json") } @@ -1504,6 +1549,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1523,6 +1576,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { VALIDATING_FILES, QUEUED, @@ -1532,6 +1586,15 @@ private constructor( CANCELLED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { VALIDATING_FILES, QUEUED, @@ -1539,9 +1602,17 @@ private constructor( SUCCEEDED, FAILED, CANCELLED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { VALIDATING_FILES -> Value.VALIDATING_FILES @@ -1553,6 +1624,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { VALIDATING_FILES -> Known.VALIDATING_FILES @@ -1638,6 +1718,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Method]. */ class Builder internal constructor() { private var dpo: JsonField = JsonMissing.of() @@ -1744,6 +1825,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Dpo]. */ class Builder internal constructor() { private var hyperparameters: JsonField = JsonMissing.of() @@ -1896,6 +1978,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Hyperparameters]. */ class Builder internal constructor() { private var batchSize: JsonField = JsonMissing.of() @@ -2134,12 +2217,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = BatchSize(manual = manual) } + /** + * An interface that defines how to map each variant of [BatchSize] to a value + * of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [BatchSize] to a value of type [T]. + * + * An instance of [BatchSize] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown BatchSize: $json") } @@ -2272,12 +2369,26 @@ private constructor( @JvmStatic fun ofManual(manual: Double) = Beta(manual = manual) } + /** + * An interface that defines how to map each variant of [Beta] to a value of + * type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Double): T + /** + * Maps an unknown variant of [Beta] to a value of type [T]. + * + * An instance of [Beta] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Beta: $json") } @@ -2412,12 +2523,27 @@ private constructor( fun ofManual(manual: Double) = LearningRateMultiplier(manual = manual) } + /** + * An interface that defines how to map each variant of [LearningRateMultiplier] + * to a value of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Double): T + /** + * Maps an unknown variant of [LearningRateMultiplier] to a value of type + * [T]. + * + * An instance of [LearningRateMultiplier] can contain an unknown variant if + * it was deserialized from data that doesn't match any known variant. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException( "Unknown LearningRateMultiplier: $json" @@ -2557,12 +2683,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = NEpochs(manual = manual) } + /** + * An interface that defines how to map each variant of [NEpochs] to a value of + * type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [NEpochs] to a value of type [T]. + * + * An instance of [NEpochs] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown NEpochs: $json") } @@ -2689,6 +2829,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Supervised]. */ class Builder internal constructor() { private var hyperparameters: JsonField = JsonMissing.of() @@ -2826,6 +2967,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Hyperparameters]. */ class Builder internal constructor() { private var batchSize: JsonField = JsonMissing.of() @@ -3037,12 +3179,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = BatchSize(manual = manual) } + /** + * An interface that defines how to map each variant of [BatchSize] to a value + * of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [BatchSize] to a value of type [T]. + * + * An instance of [BatchSize] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown BatchSize: $json") } @@ -3177,12 +3333,27 @@ private constructor( fun ofManual(manual: Double) = LearningRateMultiplier(manual = manual) } + /** + * An interface that defines how to map each variant of [LearningRateMultiplier] + * to a value of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Double): T + /** + * Maps an unknown variant of [LearningRateMultiplier] to a value of type + * [T]. + * + * An instance of [LearningRateMultiplier] can contain an unknown variant if + * it was deserialized from data that doesn't match any known variant. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException( "Unknown LearningRateMultiplier: $json" @@ -3322,12 +3493,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = NEpochs(manual = manual) } + /** + * An interface that defines how to map each variant of [NEpochs] to a value of + * type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [NEpochs] to a value of type [T]. + * + * An instance of [NEpochs] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown NEpochs: $json") } @@ -3418,6 +3603,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -3429,17 +3622,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { SUPERVISED, DPO, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SUPERVISED, DPO, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { SUPERVISED -> Value.SUPERVISED @@ -3447,6 +3658,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SUPERVISED -> Known.SUPERVISED diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCancelParams.kt index 54bfac76..49a321f9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCancelParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCancelParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobCancelParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt index 32b733ef..dad53ec5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt @@ -122,6 +122,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobCheckpoint]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -322,6 +323,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Metrics]. */ class Builder internal constructor() { private var fullValidLoss: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpointListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpointListParams.kt index 84cb7324..8dae2cc4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpointListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpointListParams.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobCheckpointListParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt index bc6db64b..fd0c1ea5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt @@ -408,6 +408,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobCreateBody]. */ class Builder internal constructor() { private var model: JsonField? = null @@ -705,6 +706,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -1058,6 +1060,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1073,6 +1083,7 @@ private constructor( @JvmStatic fun of(value: String) = Model(JsonField.of(value)) } + /** An enum containing [Model]'s known values. */ enum class Known { BABBAGE_002, DAVINCI_002, @@ -1080,14 +1091,31 @@ private constructor( GPT_4O_MINI, } + /** + * An enum containing [Model]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Model] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { BABBAGE_002, DAVINCI_002, GPT_3_5_TURBO, GPT_4O_MINI, + /** An enum member indicating that [Model] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { BABBAGE_002 -> Value.BABBAGE_002 @@ -1097,6 +1125,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { BABBAGE_002 -> Known.BABBAGE_002 @@ -1209,6 +1246,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Hyperparameters]. */ class Builder internal constructor() { private var batchSize: JsonField = JsonMissing.of() @@ -1415,12 +1453,26 @@ private constructor( @JvmStatic fun ofInteger(integer: Long) = BatchSize(integer = integer) } + /** + * An interface that defines how to map each variant of [BatchSize] to a value of type + * [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitInteger(integer: Long): T + /** + * Maps an unknown variant of [BatchSize] to a value of type [T]. + * + * An instance of [BatchSize] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown BatchSize: $json") } @@ -1553,12 +1605,26 @@ private constructor( @JvmStatic fun ofNumber(number: Double) = LearningRateMultiplier(number = number) } + /** + * An interface that defines how to map each variant of [LearningRateMultiplier] to a + * value of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitNumber(number: Double): T + /** + * Maps an unknown variant of [LearningRateMultiplier] to a value of type [T]. + * + * An instance of [LearningRateMultiplier] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the + * SDK is on an older version than the API, then the API may respond with new + * variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown LearningRateMultiplier: $json") } @@ -1693,12 +1759,26 @@ private constructor( @JvmStatic fun ofInteger(integer: Long) = NEpochs(integer = integer) } + /** + * An interface that defines how to map each variant of [NEpochs] to a value of type + * [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitInteger(integer: Long): T + /** + * Maps an unknown variant of [NEpochs] to a value of type [T]. + * + * An instance of [NEpochs] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown NEpochs: $json") } @@ -1825,6 +1905,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Integration]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("wandb") @@ -1982,6 +2063,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Wandb]. */ class Builder internal constructor() { private var project: JsonField? = null @@ -2205,6 +2287,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Method]. */ class Builder internal constructor() { private var dpo: JsonField = JsonMissing.of() @@ -2311,6 +2394,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Dpo]. */ class Builder internal constructor() { private var hyperparameters: JsonField = JsonMissing.of() @@ -2463,6 +2547,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Hyperparameters]. */ class Builder internal constructor() { private var batchSize: JsonField = JsonMissing.of() @@ -2701,12 +2786,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = BatchSize(manual = manual) } + /** + * An interface that defines how to map each variant of [BatchSize] to a value + * of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [BatchSize] to a value of type [T]. + * + * An instance of [BatchSize] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown BatchSize: $json") } @@ -2839,12 +2938,26 @@ private constructor( @JvmStatic fun ofManual(manual: Double) = Beta(manual = manual) } + /** + * An interface that defines how to map each variant of [Beta] to a value of + * type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Double): T + /** + * Maps an unknown variant of [Beta] to a value of type [T]. + * + * An instance of [Beta] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Beta: $json") } @@ -2979,12 +3092,27 @@ private constructor( fun ofManual(manual: Double) = LearningRateMultiplier(manual = manual) } + /** + * An interface that defines how to map each variant of [LearningRateMultiplier] + * to a value of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Double): T + /** + * Maps an unknown variant of [LearningRateMultiplier] to a value of type + * [T]. + * + * An instance of [LearningRateMultiplier] can contain an unknown variant if + * it was deserialized from data that doesn't match any known variant. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException( "Unknown LearningRateMultiplier: $json" @@ -3124,12 +3252,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = NEpochs(manual = manual) } + /** + * An interface that defines how to map each variant of [NEpochs] to a value of + * type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [NEpochs] to a value of type [T]. + * + * An instance of [NEpochs] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown NEpochs: $json") } @@ -3256,6 +3398,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Supervised]. */ class Builder internal constructor() { private var hyperparameters: JsonField = JsonMissing.of() @@ -3393,6 +3536,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Hyperparameters]. */ class Builder internal constructor() { private var batchSize: JsonField = JsonMissing.of() @@ -3604,12 +3748,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = BatchSize(manual = manual) } + /** + * An interface that defines how to map each variant of [BatchSize] to a value + * of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [BatchSize] to a value of type [T]. + * + * An instance of [BatchSize] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown BatchSize: $json") } @@ -3744,12 +3902,27 @@ private constructor( fun ofManual(manual: Double) = LearningRateMultiplier(manual = manual) } + /** + * An interface that defines how to map each variant of [LearningRateMultiplier] + * to a value of type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Double): T + /** + * Maps an unknown variant of [LearningRateMultiplier] to a value of type + * [T]. + * + * An instance of [LearningRateMultiplier] can contain an unknown variant if + * it was deserialized from data that doesn't match any known variant. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException( "Unknown LearningRateMultiplier: $json" @@ -3889,12 +4062,26 @@ private constructor( @JvmStatic fun ofManual(manual: Long) = NEpochs(manual = manual) } + /** + * An interface that defines how to map each variant of [NEpochs] to a value of + * type [T]. + */ interface Visitor { fun visitAuto(auto: JsonValue): T fun visitManual(manual: Long): T + /** + * Maps an unknown variant of [NEpochs] to a value of type [T]. + * + * An instance of [NEpochs] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, + * if the SDK is on an older version than the API, then the API may respond + * with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown NEpochs: $json") } @@ -3985,6 +4172,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -3996,17 +4191,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { SUPERVISED, DPO, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SUPERVISED, DPO, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { SUPERVISED -> Value.SUPERVISED @@ -4014,6 +4227,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SUPERVISED -> Known.SUPERVISED diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt index 2c20e18d..a36b0877 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt @@ -105,6 +105,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobEvent]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -203,6 +204,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -216,19 +225,37 @@ private constructor( @JvmStatic fun of(value: String) = Level(JsonField.of(value)) } + /** An enum containing [Level]'s known values. */ enum class Known { INFO, WARN, ERROR, } + /** + * An enum containing [Level]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Level] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { INFO, WARN, ERROR, + /** An enum member indicating that [Level] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { INFO -> Value.INFO @@ -237,6 +264,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { INFO -> Known.INFO @@ -267,6 +303,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -278,17 +322,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { MESSAGE, METRICS, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { MESSAGE, METRICS, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { MESSAGE -> Value.MESSAGE @@ -296,6 +358,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { MESSAGE -> Known.MESSAGE diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListEventsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListEventsParams.kt index 79b9017e..c745b70a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListEventsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListEventsParams.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobListEventsParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListParams.kt index 9a85a4e1..b8484cee 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobListParams.kt @@ -45,6 +45,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobListParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobRetrieveParams.kt index f023fab0..eba4b3db 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobRetrieveParams.kt @@ -44,6 +44,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegration.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegration.kt index 5b2534bb..a3e382d7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegration.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegration.kt @@ -104,6 +104,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobWandbIntegration]. */ class Builder internal constructor() { private var project: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt index 3b300446..97ca05ee 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt @@ -76,6 +76,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FineTuningJobWandbIntegrationObject]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("wandb") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt index e6e8452f..e29d0bea 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt @@ -123,6 +123,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionDefinition]. */ class Builder internal constructor() { private var name: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt index 367e5349..fe8032a4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt @@ -48,6 +48,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionParameters]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionTool.kt index ed204a11..1d1e7021 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionTool.kt @@ -64,6 +64,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionTool]. */ class Builder internal constructor() { private var function: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCall.kt index 4063c05a..9e0a31d7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCall.kt @@ -73,6 +73,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionToolCall]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -199,6 +200,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var arguments: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCallDelta.kt index af532da4..9141e887 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionToolCallDelta.kt @@ -81,6 +81,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FunctionToolCallDelta]. */ class Builder internal constructor() { private var index: JsonField? = null @@ -216,6 +217,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var arguments: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Image.kt b/openai-java-core/src/main/kotlin/com/openai/models/Image.kt index 857c989e..3d3a3906 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Image.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Image.kt @@ -76,6 +76,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Image]. */ class Builder internal constructor() { private var b64Json: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageFile.kt index ce695619..f41a0e4c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageFile.kt @@ -81,6 +81,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageFile]. */ class Builder internal constructor() { private var fileId: JsonField? = null @@ -157,6 +158,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -170,19 +179,37 @@ private constructor( @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) } + /** An enum containing [Detail]'s known values. */ enum class Known { AUTO, LOW, HIGH, } + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LOW, HIGH, + /** An enum member indicating that [Detail] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -191,6 +218,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageFileContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageFileContentBlock.kt index 55e77f2e..ed29ab7f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageFileContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageFileContentBlock.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageFileContentBlock]. */ class Builder internal constructor() { private var imageFile: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDelta.kt index 89f41358..0f8db809 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDelta.kt @@ -80,6 +80,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageFileDelta]. */ class Builder internal constructor() { private var detail: JsonField = JsonMissing.of() @@ -156,6 +157,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -169,19 +178,37 @@ private constructor( @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) } + /** An enum containing [Detail]'s known values. */ enum class Known { AUTO, LOW, HIGH, } + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LOW, HIGH, + /** An enum member indicating that [Detail] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -190,6 +217,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDeltaBlock.kt index e37881ce..e4d6cf91 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageFileDeltaBlock.kt @@ -78,6 +78,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageFileDeltaBlock]. */ class Builder internal constructor() { private var index: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt index 09577251..85b6b5eb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt @@ -295,6 +295,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageGenerateBody]. */ class Builder internal constructor() { private var prompt: JsonField? = null @@ -522,6 +523,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageGenerateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -814,6 +816,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -825,17 +835,35 @@ private constructor( @JvmStatic fun of(value: String) = Quality(JsonField.of(value)) } + /** An enum containing [Quality]'s known values. */ enum class Known { STANDARD, HD, } + /** + * An enum containing [Quality]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Quality] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { STANDARD, HD, + /** An enum member indicating that [Quality] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { STANDARD -> Value.STANDARD @@ -843,6 +871,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { STANDARD -> Known.STANDARD @@ -875,6 +912,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -886,17 +931,38 @@ private constructor( @JvmStatic fun of(value: String) = ResponseFormat(JsonField.of(value)) } + /** An enum containing [ResponseFormat]'s known values. */ enum class Known { URL, B64_JSON, } + /** + * An enum containing [ResponseFormat]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ResponseFormat] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { URL, B64_JSON, + /** + * An enum member indicating that [ResponseFormat] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { URL -> Value.URL @@ -904,6 +970,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { URL -> Known.URL @@ -936,6 +1011,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -953,6 +1036,7 @@ private constructor( @JvmStatic fun of(value: String) = Size(JsonField.of(value)) } + /** An enum containing [Size]'s known values. */ enum class Known { _256X256, _512X512, @@ -961,15 +1045,32 @@ private constructor( _1024X1792, } + /** + * An enum containing [Size]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Size] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { _256X256, _512X512, _1024X1024, _1792X1024, _1024X1792, + /** An enum member indicating that [Size] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { _256X256 -> Value._256X256 @@ -980,6 +1081,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { _256X256 -> Known._256X256 @@ -1017,6 +1127,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1028,17 +1146,35 @@ private constructor( @JvmStatic fun of(value: String) = Style(JsonField.of(value)) } + /** An enum containing [Style]'s known values. */ enum class Known { VIVID, NATURAL, } + /** + * An enum containing [Style]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Style] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { VIVID, NATURAL, + /** An enum member indicating that [Style] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { VIVID -> Value.VIVID @@ -1046,6 +1182,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { VIVID -> Known.VIVID diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt index 376f8ff5..dc786374 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt @@ -13,6 +13,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -24,17 +31,35 @@ private constructor( @JvmStatic fun of(value: String) = ImageModel(JsonField.of(value)) } + /** An enum containing [ImageModel]'s known values. */ enum class Known { DALL_E_2, DALL_E_3, } + /** + * An enum containing [ImageModel]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ImageModel] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { DALL_E_2, DALL_E_3, + /** An enum member indicating that [ImageModel] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { DALL_E_2 -> Value.DALL_E_2 @@ -42,6 +67,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { DALL_E_2 -> Known.DALL_E_2 diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrl.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrl.kt index ed1c5691..9adc97cf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrl.kt @@ -75,6 +75,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageUrl]. */ class Builder internal constructor() { private var url: JsonField? = null @@ -149,6 +150,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -162,19 +171,37 @@ private constructor( @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) } + /** An enum containing [Detail]'s known values. */ enum class Known { AUTO, LOW, HIGH, } + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LOW, HIGH, + /** An enum member indicating that [Detail] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -183,6 +210,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlContentBlock.kt index 1225e062..43370379 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlContentBlock.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageUrlContentBlock]. */ class Builder internal constructor() { private var imageUrl: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDelta.kt index dfb67091..3e199c14 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDelta.kt @@ -70,6 +70,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageUrlDelta]. */ class Builder internal constructor() { private var detail: JsonField = JsonMissing.of() @@ -138,6 +139,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -151,19 +160,37 @@ private constructor( @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) } + /** An enum containing [Detail]'s known values. */ enum class Known { AUTO, LOW, HIGH, } + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LOW, HIGH, + /** An enum member indicating that [Detail] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -172,6 +199,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDeltaBlock.kt index 39b5df60..2af66345 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageUrlDeltaBlock.kt @@ -72,6 +72,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageUrlDeltaBlock]. */ class Builder internal constructor() { private var index: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImagesResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImagesResponse.kt index 184cc889..7309aa9e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImagesResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImagesResponse.kt @@ -60,6 +60,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImagesResponse]. */ class Builder internal constructor() { private var created: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Message.kt b/openai-java-core/src/main/kotlin/com/openai/models/Message.kt index 55b2bf2e..2b0ffb2f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Message.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Message.kt @@ -231,6 +231,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Message]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -557,6 +558,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Attachment]. */ class Builder internal constructor() { private var fileId: JsonField = JsonMissing.of() @@ -730,6 +732,9 @@ private constructor( ) } + /** + * An interface that defines how to map each variant of [Tool] to a value of type [T]. + */ interface Visitor { fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T @@ -738,6 +743,16 @@ private constructor( assistantToolsFileSearchTypeOnly: JsonValue ): T + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Tool: $json") } @@ -846,6 +861,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [IncompleteDetails]. */ class Builder internal constructor() { private var reason: JsonField? = null @@ -896,6 +912,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -913,6 +937,7 @@ private constructor( @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) } + /** An enum containing [Reason]'s known values. */ enum class Known { CONTENT_FILTER, MAX_TOKENS, @@ -921,15 +946,34 @@ private constructor( RUN_FAILED, } + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { CONTENT_FILTER, MAX_TOKENS, RUN_CANCELLED, RUN_EXPIRED, RUN_FAILED, + /** + * An enum member indicating that [Reason] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { CONTENT_FILTER -> Value.CONTENT_FILTER @@ -940,6 +984,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { CONTENT_FILTER -> Known.CONTENT_FILTER @@ -990,6 +1043,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1001,17 +1062,35 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { USER, ASSISTANT, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { USER, ASSISTANT, + /** An enum member indicating that [Role] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { USER -> Value.USER @@ -1019,6 +1098,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { USER -> Known.USER @@ -1050,6 +1138,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1063,19 +1159,37 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { IN_PROGRESS, INCOMPLETE, COMPLETED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { IN_PROGRESS, INCOMPLETE, COMPLETED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { IN_PROGRESS -> Value.IN_PROGRESS @@ -1084,6 +1198,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { IN_PROGRESS -> Known.IN_PROGRESS diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageContent.kt index 87566ac0..853c7fcd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageContent.kt @@ -152,6 +152,9 @@ private constructor( @JvmStatic fun ofRefusal(refusal: RefusalContentBlock) = MessageContent(refusal = refusal) } + /** + * An interface that defines how to map each variant of [MessageContent] to a value of type [T]. + */ interface Visitor { /** @@ -169,6 +172,16 @@ private constructor( /** The refusal content generated by the assistant. */ fun visitRefusal(refusal: RefusalContentBlock): T + /** + * Maps an unknown variant of [MessageContent] to a value of type [T]. + * + * An instance of [MessageContent] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is unaware + * of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown MessageContent: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageContentDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageContentDelta.kt index d2cdf3f9..8dacbcb4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageContentDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageContentDelta.kt @@ -153,6 +153,10 @@ private constructor( fun ofImageUrl(imageUrl: ImageUrlDeltaBlock) = MessageContentDelta(imageUrl = imageUrl) } + /** + * An interface that defines how to map each variant of [MessageContentDelta] to a value of type + * [T]. + */ interface Visitor { /** @@ -170,6 +174,16 @@ private constructor( /** References an image URL in the content of a message. */ fun visitImageUrl(imageUrl: ImageUrlDeltaBlock): T + /** + * Maps an unknown variant of [MessageContentDelta] to a value of type [T]. + * + * An instance of [MessageContentDelta] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown MessageContentDelta: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageContentPartParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageContentPartParam.kt index fd2cc1b8..60d54e82 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageContentPartParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageContentPartParam.kt @@ -136,6 +136,10 @@ private constructor( @JvmStatic fun ofText(text: TextContentBlockParam) = MessageContentPartParam(text = text) } + /** + * An interface that defines how to map each variant of [MessageContentPartParam] to a value of + * type [T]. + */ interface Visitor { /** @@ -150,6 +154,16 @@ private constructor( /** The text content that is part of a message. */ fun visitText(text: TextContentBlockParam): T + /** + * Maps an unknown variant of [MessageContentPartParam] to a value of type [T]. + * + * An instance of [MessageContentPartParam] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown MessageContentPartParam: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageCreationStepDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageCreationStepDetails.kt index d6c2ac34..99d2d7e6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageCreationStepDetails.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageCreationStepDetails.kt @@ -65,6 +65,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MessageCreationStepDetails]. */ class Builder internal constructor() { private var messageCreation: JsonField? = null @@ -154,6 +155,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MessageCreation]. */ class Builder internal constructor() { private var messageId: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageDeleted.kt index 1e3f2abd..8e91e1ce 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageDeleted.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MessageDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt index cf995d42..54b0bd7f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageDelta.kt @@ -68,6 +68,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MessageDelta]. */ class Builder internal constructor() { private var content: JsonField>? = null @@ -161,6 +162,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -172,17 +181,35 @@ private constructor( @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } + /** An enum containing [Role]'s known values. */ enum class Known { USER, ASSISTANT, } + /** + * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Role] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { USER, ASSISTANT, + /** An enum member indicating that [Role] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { USER -> Value.USER @@ -190,6 +217,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { USER -> Known.USER diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageDeltaEvent.kt index 667e16c8..da056171 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageDeltaEvent.kt @@ -73,6 +73,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MessageDeltaEvent]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/MessageStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/MessageStreamEvent.kt index 10e1dcfb..f2da4f16 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/MessageStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/MessageStreamEvent.kt @@ -249,6 +249,10 @@ private constructor( MessageStreamEvent(threadMessageIncomplete = threadMessageIncomplete) } + /** + * An interface that defines how to map each variant of [MessageStreamEvent] to a value of type + * [T]. + */ interface Visitor { /** @@ -282,6 +286,16 @@ private constructor( */ fun visitThreadMessageIncomplete(threadMessageIncomplete: ThreadMessageIncomplete): T + /** + * Maps an unknown variant of [MessageStreamEvent] to a value of type [T]. + * + * An instance of [MessageStreamEvent] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is unaware + * of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown MessageStreamEvent: $json") } @@ -414,6 +428,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -543,6 +558,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageInProgress]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -666,6 +682,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageDelta]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -789,6 +806,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageCompleted]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -918,6 +936,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadMessageIncomplete]. */ class Builder internal constructor() { private var data: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Model.kt b/openai-java-core/src/main/kotlin/com/openai/models/Model.kt index dedf1031..9ba4b949 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Model.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Model.kt @@ -83,6 +83,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Model]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleteParams.kt index 3385971c..c73d74c6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleteParams.kt @@ -52,6 +52,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModelDeleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleted.kt index 908a2416..272b9325 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModelDeleted.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModelDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModelListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModelListParams.kt index 5c88a724..54b7b001 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModelListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModelListParams.kt @@ -32,6 +32,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModelListParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModelRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModelRetrieveParams.kt index f927944c..52624c92 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModelRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModelRetrieveParams.kt @@ -43,6 +43,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModelRetrieveParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt b/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt index 7c6f971a..c1646edb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt @@ -94,6 +94,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Moderation]. */ class Builder internal constructor() { private var categories: JsonField? = null @@ -404,6 +405,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Categories]. */ class Builder internal constructor() { private var harassment: JsonField? = null @@ -842,6 +844,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CategoryAppliedInputTypes]. */ class Builder internal constructor() { private var harassment: JsonField>? = null @@ -1225,6 +1228,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1234,21 +1245,51 @@ private constructor( @JvmStatic fun of(value: String) = Harassment(JsonField.of(value)) } + /** An enum containing [Harassment]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [Harassment]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Harassment] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [Harassment] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1276,6 +1317,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1285,21 +1334,53 @@ private constructor( @JvmStatic fun of(value: String) = HarassmentThreatening(JsonField.of(value)) } + /** An enum containing [HarassmentThreatening]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [HarassmentThreatening]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [HarassmentThreatening] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [HarassmentThreatening] was instantiated with an + * unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1328,6 +1409,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1337,21 +1426,48 @@ private constructor( @JvmStatic fun of(value: String) = Hate(JsonField.of(value)) } + /** An enum containing [Hate]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [Hate]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Hate] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** An enum member indicating that [Hate] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1379,6 +1495,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1388,21 +1512,51 @@ private constructor( @JvmStatic fun of(value: String) = HateThreatening(JsonField.of(value)) } + /** An enum containing [HateThreatening]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [HateThreatening]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [HateThreatening] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [HateThreatening] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1430,6 +1584,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1439,21 +1601,50 @@ private constructor( @JvmStatic fun of(value: String) = Illicit(JsonField.of(value)) } + /** An enum containing [Illicit]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [Illicit]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Illicit] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [Illicit] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1481,6 +1672,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1490,21 +1689,51 @@ private constructor( @JvmStatic fun of(value: String) = IllicitViolent(JsonField.of(value)) } + /** An enum containing [IllicitViolent]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [IllicitViolent]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [IllicitViolent] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [IllicitViolent] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1532,6 +1761,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1543,17 +1780,37 @@ private constructor( @JvmStatic fun of(value: String) = SelfHarm(JsonField.of(value)) } + /** An enum containing [SelfHarm]'s known values. */ enum class Known { TEXT, IMAGE, } + /** + * An enum containing [SelfHarm]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SelfHarm] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, IMAGE, + /** + * An enum member indicating that [SelfHarm] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -1561,6 +1818,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1589,6 +1855,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1600,17 +1874,40 @@ private constructor( @JvmStatic fun of(value: String) = SelfHarmInstruction(JsonField.of(value)) } + /** An enum containing [SelfHarmInstruction]'s known values. */ enum class Known { TEXT, IMAGE, } + /** + * An enum containing [SelfHarmInstruction]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [SelfHarmInstruction] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, IMAGE, + /** + * An enum member indicating that [SelfHarmInstruction] was instantiated with an + * unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -1618,6 +1915,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1646,6 +1952,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1657,17 +1971,38 @@ private constructor( @JvmStatic fun of(value: String) = SelfHarmIntent(JsonField.of(value)) } + /** An enum containing [SelfHarmIntent]'s known values. */ enum class Known { TEXT, IMAGE, } + /** + * An enum containing [SelfHarmIntent]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SelfHarmIntent] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, IMAGE, + /** + * An enum member indicating that [SelfHarmIntent] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -1675,6 +2010,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1703,6 +2047,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1714,17 +2066,37 @@ private constructor( @JvmStatic fun of(value: String) = Sexual(JsonField.of(value)) } + /** An enum containing [Sexual]'s known values. */ enum class Known { TEXT, IMAGE, } + /** + * An enum containing [Sexual]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Sexual] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, IMAGE, + /** + * An enum member indicating that [Sexual] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -1732,6 +2104,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1760,6 +2141,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1769,21 +2158,51 @@ private constructor( @JvmStatic fun of(value: String) = SexualMinor(JsonField.of(value)) } + /** An enum containing [SexualMinor]'s known values. */ enum class Known { TEXT, } + /** + * An enum containing [SexualMinor]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SexualMinor] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, + /** + * An enum member indicating that [SexualMinor] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1811,6 +2230,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1822,17 +2249,37 @@ private constructor( @JvmStatic fun of(value: String) = Violence(JsonField.of(value)) } + /** An enum containing [Violence]'s known values. */ enum class Known { TEXT, IMAGE, } + /** + * An enum containing [Violence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Violence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, IMAGE, + /** + * An enum member indicating that [Violence] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -1840,6 +2287,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -1868,6 +2324,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1879,17 +2343,38 @@ private constructor( @JvmStatic fun of(value: String) = ViolenceGraphic(JsonField.of(value)) } + /** An enum containing [ViolenceGraphic]'s known values. */ enum class Known { TEXT, IMAGE, } + /** + * An enum containing [ViolenceGraphic]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ViolenceGraphic] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { TEXT, IMAGE, + /** + * An enum member indicating that [ViolenceGraphic] was instantiated with an unknown + * value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { TEXT -> Value.TEXT @@ -1897,6 +2382,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { TEXT -> Known.TEXT @@ -2115,6 +2609,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CategoryScores]. */ class Builder internal constructor() { private var harassment: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateParams.kt index 4ca82722..c4206e73 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateParams.kt @@ -142,6 +142,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModerationCreateBody]. */ class Builder internal constructor() { private var input: JsonField? = null @@ -251,6 +252,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModerationCreateParams]. */ @NoAutoDetect class Builder internal constructor() { @@ -544,6 +546,7 @@ private constructor( ) = Input(moderationMultiModalArray = moderationMultiModalArray) } + /** An interface that defines how to map each variant of [Input] to a value of type [T]. */ interface Visitor { /** A string of text to classify for moderation. */ @@ -557,6 +560,16 @@ private constructor( moderationMultiModalArray: List ): T + /** + * Maps an unknown variant of [Input] to a value of type [T]. + * + * An instance of [Input] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown Input: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateResponse.kt index a29d90f4..2d361e07 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationCreateResponse.kt @@ -71,6 +71,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModerationCreateResponse]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt index a9e54b61..1d193c0d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt @@ -65,6 +65,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModerationImageUrlInput]. */ class Builder internal constructor() { private var imageUrl: JsonField? = null @@ -152,6 +153,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ImageUrl]. */ class Builder internal constructor() { private var url: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt index 1e8a2ef4..cd3ea08b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt @@ -13,6 +13,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -28,6 +35,7 @@ private constructor( @JvmStatic fun of(value: String) = ModerationModel(JsonField.of(value)) } + /** An enum containing [ModerationModel]'s known values. */ enum class Known { OMNI_MODERATION_LATEST, OMNI_MODERATION_2024_09_26, @@ -35,14 +43,33 @@ private constructor( TEXT_MODERATION_STABLE, } + /** + * An enum containing [ModerationModel]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ModerationModel] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { OMNI_MODERATION_LATEST, OMNI_MODERATION_2024_09_26, TEXT_MODERATION_LATEST, TEXT_MODERATION_STABLE, + /** + * An enum member indicating that [ModerationModel] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { OMNI_MODERATION_LATEST -> Value.OMNI_MODERATION_LATEST @@ -52,6 +79,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { OMNI_MODERATION_LATEST -> Known.OMNI_MODERATION_LATEST diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationMultiModalInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationMultiModalInput.kt index a9084ddf..581663de 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationMultiModalInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationMultiModalInput.kt @@ -104,6 +104,10 @@ private constructor( @JvmStatic fun ofText(text: ModerationTextInput) = ModerationMultiModalInput(text = text) } + /** + * An interface that defines how to map each variant of [ModerationMultiModalInput] to a value + * of type [T]. + */ interface Visitor { /** An object describing an image to classify. */ @@ -112,6 +116,16 @@ private constructor( /** An object describing text to classify. */ fun visitText(text: ModerationTextInput): T + /** + * Maps an unknown variant of [ModerationMultiModalInput] to a value of type [T]. + * + * An instance of [ModerationMultiModalInput] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK is + * on an older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ModerationMultiModalInput: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt index 47b7dd78..38065e6a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ModerationTextInput]. */ class Builder internal constructor() { private var text: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/OtherFileChunkingStrategyObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/OtherFileChunkingStrategyObject.kt index 64a13977..ac7a4d1b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/OtherFileChunkingStrategyObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/OtherFileChunkingStrategyObject.kt @@ -56,6 +56,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [OtherFileChunkingStrategyObject]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("other") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RefusalContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/RefusalContentBlock.kt index 702ca803..7201260b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RefusalContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RefusalContentBlock.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RefusalContentBlock]. */ class Builder internal constructor() { private var refusal: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RefusalDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/RefusalDeltaBlock.kt index f4bed9de..ac7981f5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RefusalDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RefusalDeltaBlock.kt @@ -72,6 +72,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RefusalDeltaBlock]. */ class Builder internal constructor() { private var index: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RequiredActionFunctionToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/RequiredActionFunctionToolCall.kt index 7f4f5028..ce7e04d5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RequiredActionFunctionToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RequiredActionFunctionToolCall.kt @@ -83,6 +83,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RequiredActionFunctionToolCall]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -202,6 +203,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Function]. */ class Builder internal constructor() { private var arguments: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt index b2c5d7b1..d1cd0243 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt @@ -52,6 +52,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ResponseFormatJsonObject]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("json_object") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt index 18585bf8..a215cee9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt @@ -65,6 +65,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ResponseFormatJsonSchema]. */ class Builder internal constructor() { private var jsonSchema: JsonField? = null @@ -206,6 +207,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [JsonSchema]. */ class Builder internal constructor() { private var name: JsonField? = null @@ -347,6 +349,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Schema]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt index 30d97567..e8299f53 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt @@ -52,6 +52,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ResponseFormatText]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("text") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Run.kt b/openai-java-core/src/main/kotlin/com/openai/models/Run.kt index a8dac155..e5298a36 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Run.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Run.kt @@ -460,6 +460,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Run]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -1203,6 +1204,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [IncompleteDetails]. */ class Builder internal constructor() { private var reason: JsonField = JsonMissing.of() @@ -1259,6 +1261,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1270,17 +1280,37 @@ private constructor( @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) } + /** An enum containing [Reason]'s known values. */ enum class Known { MAX_COMPLETION_TOKENS, MAX_PROMPT_TOKENS, } + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { MAX_COMPLETION_TOKENS, MAX_PROMPT_TOKENS, + /** + * An enum member indicating that [Reason] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { MAX_COMPLETION_TOKENS -> Value.MAX_COMPLETION_TOKENS @@ -1288,6 +1318,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { MAX_COMPLETION_TOKENS -> Known.MAX_COMPLETION_TOKENS @@ -1376,6 +1415,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LastError]. */ class Builder internal constructor() { private var code: JsonField? = null @@ -1435,6 +1475,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1448,19 +1496,37 @@ private constructor( @JvmStatic fun of(value: String) = Code(JsonField.of(value)) } + /** An enum containing [Code]'s known values. */ enum class Known { SERVER_ERROR, RATE_LIMIT_EXCEEDED, INVALID_PROMPT, } + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Code] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SERVER_ERROR, RATE_LIMIT_EXCEEDED, INVALID_PROMPT, + /** An enum member indicating that [Code] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { SERVER_ERROR -> Value.SERVER_ERROR @@ -1469,6 +1535,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SERVER_ERROR -> Known.SERVER_ERROR @@ -1564,6 +1639,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RequiredAction]. */ class Builder internal constructor() { private var submitToolOutputs: JsonField? = null @@ -1660,6 +1736,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [SubmitToolOutputs]. */ class Builder internal constructor() { private var toolCalls: JsonField>? = @@ -1830,6 +1907,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TruncationStrategy]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -1926,6 +2004,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -1937,17 +2023,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { AUTO, LAST_MESSAGES, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { AUTO, LAST_MESSAGES, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { AUTO -> Value.AUTO @@ -1955,6 +2059,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { AUTO -> Known.AUTO @@ -2064,6 +2177,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Usage]. */ class Builder internal constructor() { private var completionTokens: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStatus.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStatus.kt index 895a39c8..f9c9740d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStatus.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStatus.kt @@ -17,6 +17,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -42,6 +49,7 @@ private constructor( @JvmStatic fun of(value: String) = RunStatus(JsonField.of(value)) } + /** An enum containing [RunStatus]'s known values. */ enum class Known { QUEUED, IN_PROGRESS, @@ -54,6 +62,15 @@ private constructor( EXPIRED, } + /** + * An enum containing [RunStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [RunStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { QUEUED, IN_PROGRESS, @@ -64,9 +81,17 @@ private constructor( COMPLETED, INCOMPLETE, EXPIRED, + /** An enum member indicating that [RunStatus] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { QUEUED -> Value.QUEUED @@ -81,6 +106,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { QUEUED -> Known.QUEUED diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStep.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStep.kt index 287ba349..38381522 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStep.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStep.kt @@ -246,6 +246,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RunStep]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -561,6 +562,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LastError]. */ class Builder internal constructor() { private var code: JsonField? = null @@ -620,6 +622,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -631,17 +641,35 @@ private constructor( @JvmStatic fun of(value: String) = Code(JsonField.of(value)) } + /** An enum containing [Code]'s known values. */ enum class Known { SERVER_ERROR, RATE_LIMIT_EXCEEDED, } + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Code] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SERVER_ERROR, RATE_LIMIT_EXCEEDED, + /** An enum member indicating that [Code] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { SERVER_ERROR -> Value.SERVER_ERROR @@ -649,6 +677,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SERVER_ERROR -> Known.SERVER_ERROR @@ -699,6 +736,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -716,6 +761,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { IN_PROGRESS, CANCELLED, @@ -724,15 +770,32 @@ private constructor( EXPIRED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { IN_PROGRESS, CANCELLED, FAILED, COMPLETED, EXPIRED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { IN_PROGRESS -> Value.IN_PROGRESS @@ -743,6 +806,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { IN_PROGRESS -> Known.IN_PROGRESS @@ -857,6 +929,10 @@ private constructor( fun ofToolCalls(toolCalls: ToolCallsStepDetails) = StepDetails(toolCalls = toolCalls) } + /** + * An interface that defines how to map each variant of [StepDetails] to a value of type + * [T]. + */ interface Visitor { /** Details of the message creation by the run step. */ @@ -865,6 +941,16 @@ private constructor( /** Details of the tool call. */ fun visitToolCalls(toolCalls: ToolCallsStepDetails): T + /** + * Maps an unknown variant of [StepDetails] to a value of type [T]. + * + * An instance of [StepDetails] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown StepDetails: $json") } @@ -923,6 +1009,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -934,17 +1028,35 @@ private constructor( @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } + /** An enum containing [Type]'s known values. */ enum class Known { MESSAGE_CREATION, TOOL_CALLS, } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { MESSAGE_CREATION, TOOL_CALLS, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { MESSAGE_CREATION -> Value.MESSAGE_CREATION @@ -952,6 +1064,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { MESSAGE_CREATION -> Known.MESSAGE_CREATION @@ -1043,6 +1164,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Usage]. */ class Builder internal constructor() { private var completionTokens: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStepDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStepDelta.kt index c28bf763..21eb0d17 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStepDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStepDelta.kt @@ -70,6 +70,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RunStepDelta]. */ class Builder internal constructor() { private var stepDetails: JsonField = JsonMissing.of() @@ -208,6 +209,10 @@ private constructor( fun ofToolCalls(toolCalls: ToolCallDeltaObject) = StepDetails(toolCalls = toolCalls) } + /** + * An interface that defines how to map each variant of [StepDetails] to a value of type + * [T]. + */ interface Visitor { /** Details of the message creation by the run step. */ @@ -216,6 +221,16 @@ private constructor( /** Details of the tool call. */ fun visitToolCalls(toolCalls: ToolCallDeltaObject): T + /** + * Maps an unknown variant of [StepDetails] to a value of type [T]. + * + * An instance of [StepDetails] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the SDK + * is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown StepDetails: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaEvent.kt index 985a9823..862bffc2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaEvent.kt @@ -73,6 +73,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RunStepDeltaEvent]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaMessageDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaMessageDelta.kt index 4172f124..770cf812 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaMessageDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStepDeltaMessageDelta.kt @@ -66,6 +66,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [RunStepDeltaMessageDelta]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("message_creation") @@ -155,6 +156,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [MessageCreation]. */ class Builder internal constructor() { private var messageId: JsonField = JsonMissing.of() diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStepInclude.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStepInclude.kt index c32bb215..6f4cb9e4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStepInclude.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStepInclude.kt @@ -13,6 +13,13 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -24,15 +31,35 @@ private constructor( @JvmStatic fun of(value: String) = RunStepInclude(JsonField.of(value)) } + /** An enum containing [RunStepInclude]'s known values. */ enum class Known { STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT, } + /** + * An enum containing [RunStepInclude]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [RunStepInclude] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT, + /** + * An enum member indicating that [RunStepInclude] was instantiated with an unknown value. + */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ fun value(): Value = when (this) { STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT -> @@ -40,6 +67,14 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ fun known(): Known = when (this) { STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT -> diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStepStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStepStreamEvent.kt index f28aa1ea..3c7522e5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStepStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStepStreamEvent.kt @@ -325,6 +325,10 @@ private constructor( RunStepStreamEvent(threadRunStepExpired = threadRunStepExpired) } + /** + * An interface that defines how to map each variant of [RunStepStreamEvent] to a value of type + * [T]. + */ interface Visitor { /** @@ -374,6 +378,16 @@ private constructor( */ fun visitThreadRunStepExpired(threadRunStepExpired: ThreadRunStepExpired): T + /** + * Maps an unknown variant of [RunStepStreamEvent] to a value of type [T]. + * + * An instance of [RunStepStreamEvent] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is unaware + * of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown RunStepStreamEvent: $json") } @@ -514,6 +528,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -632,6 +647,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepInProgress]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -750,6 +766,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepDelta]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -872,6 +889,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepCompleted]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -989,6 +1007,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepFailed]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1107,6 +1126,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepCancelled]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1224,6 +1244,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunStepExpired]. */ class Builder internal constructor() { private var data: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/RunStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/RunStreamEvent.kt index f41b89ec..a5292384 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/RunStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/RunStreamEvent.kt @@ -368,6 +368,9 @@ private constructor( RunStreamEvent(threadRunExpired = threadRunExpired) } + /** + * An interface that defines how to map each variant of [RunStreamEvent] to a value of type [T]. + */ interface Visitor { /** @@ -428,6 +431,16 @@ private constructor( */ fun visitThreadRunExpired(threadRunExpired: ThreadRunExpired): T + /** + * Maps an unknown variant of [RunStreamEvent] to a value of type [T]. + * + * An instance of [RunStreamEvent] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is unaware + * of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown RunStreamEvent: $json") } @@ -591,6 +604,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCreated]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -718,6 +732,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunQueued]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -845,6 +860,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunInProgress]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -972,6 +988,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunRequiresAction]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1098,6 +1115,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCompleted]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1225,6 +1243,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunIncomplete]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1349,6 +1368,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunFailed]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1476,6 +1496,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCancelling]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1602,6 +1623,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunCancelled]. */ class Builder internal constructor() { private var data: JsonField? = null @@ -1726,6 +1748,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadRunExpired]. */ class Builder internal constructor() { private var data: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategy.kt b/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategy.kt index 69535f8f..ebd16f51 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategy.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategy.kt @@ -82,6 +82,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [StaticFileChunkingStrategy]. */ class Builder internal constructor() { private var chunkOverlapTokens: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObject.kt index 2d452b68..85c8107e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObject.kt @@ -64,6 +64,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [StaticFileChunkingStrategyObject]. */ class Builder internal constructor() { private var static_: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObjectParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObjectParam.kt index e6288922..e1fe6e81 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObjectParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/StaticFileChunkingStrategyObjectParam.kt @@ -64,6 +64,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [StaticFileChunkingStrategyObjectParam]. */ class Builder internal constructor() { private var static_: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Text.kt b/openai-java-core/src/main/kotlin/com/openai/models/Text.kt index 40dd50e7..0794ba9c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Text.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Text.kt @@ -62,6 +62,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Text]. */ class Builder internal constructor() { private var annotations: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlock.kt index 781c6abd..6a876aff 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlock.kt @@ -61,6 +61,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TextContentBlock]. */ class Builder internal constructor() { private var text: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlockParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlockParam.kt index e5999dff..5b96ec99 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlockParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/TextContentBlockParam.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TextContentBlockParam]. */ class Builder internal constructor() { private var text: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt index c8ab8d15..ecb01521 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/TextDelta.kt @@ -63,6 +63,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TextDelta]. */ class Builder internal constructor() { private var annotations: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/TextDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/TextDeltaBlock.kt index 1fbdd45b..645a3dc0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/TextDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/TextDeltaBlock.kt @@ -70,6 +70,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [TextDeltaBlock]. */ class Builder internal constructor() { private var index: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Thread.kt b/openai-java-core/src/main/kotlin/com/openai/models/Thread.kt index 6dd1a38e..050f535c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Thread.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Thread.kt @@ -106,6 +106,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Thread]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -261,6 +262,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolResources]. */ class Builder internal constructor() { private var codeInterpreter: JsonField = JsonMissing.of() @@ -364,6 +366,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [CodeInterpreter]. */ class Builder internal constructor() { private var fileIds: JsonField>? = null @@ -508,6 +511,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileSearch]. */ class Builder internal constructor() { private var vectorStoreIds: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ThreadDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/ThreadDeleted.kt index 68038108..0398f91b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ThreadDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ThreadDeleted.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ThreadStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/ThreadStreamEvent.kt index 89f30259..7df2772d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ThreadStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ThreadStreamEvent.kt @@ -82,6 +82,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ThreadStreamEvent]. */ class Builder internal constructor() { private var data: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/ToolCall.kt index 02de947b..91e104f5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ToolCall.kt @@ -117,6 +117,7 @@ private constructor( @JvmStatic fun ofFunction(function: FunctionToolCall) = ToolCall(function = function) } + /** An interface that defines how to map each variant of [ToolCall] to a value of type [T]. */ interface Visitor { /** Details of the Code Interpreter tool call the run step was involved in. */ @@ -126,6 +127,15 @@ private constructor( fun visitFunction(function: FunctionToolCall): T + /** + * Maps an unknown variant of [ToolCall] to a value of type [T]. + * + * An instance of [ToolCall] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version than + * the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ToolCall: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDelta.kt index 6e4c8588..565533e5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDelta.kt @@ -121,6 +121,9 @@ private constructor( fun ofFunction(function: FunctionToolCallDelta) = ToolCallDelta(function = function) } + /** + * An interface that defines how to map each variant of [ToolCallDelta] to a value of type [T]. + */ interface Visitor { /** Details of the Code Interpreter tool call the run step was involved in. */ @@ -130,6 +133,15 @@ private constructor( fun visitFunction(function: FunctionToolCallDelta): T + /** + * Maps an unknown variant of [ToolCallDelta] to a value of type [T]. + * + * An instance of [ToolCallDelta] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ fun unknown(json: JsonValue?): T { throw OpenAIInvalidDataException("Unknown ToolCallDelta: $json") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt index 7e1198bc..59582d7e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallDeltaObject.kt @@ -74,6 +74,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolCallDeltaObject]. */ class Builder internal constructor() { private var type: JsonValue = JsonValue.from("tool_calls") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt index bfc6e327..3a0baed6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ToolCallsStepDetails.kt @@ -73,6 +73,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ToolCallsStepDetails]. */ class Builder internal constructor() { private var toolCalls: JsonField>? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt b/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt index 736881cf..d293248a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt @@ -141,6 +141,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [Upload]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -271,6 +272,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -286,6 +295,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { PENDING, COMPLETED, @@ -293,14 +303,31 @@ private constructor( EXPIRED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { PENDING, COMPLETED, CANCELLED, EXPIRED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { PENDING -> Value.PENDING @@ -310,6 +337,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { PENDING -> Known.PENDING diff --git a/openai-java-core/src/main/kotlin/com/openai/models/UploadCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/UploadCancelParams.kt index ff6f8f70..84388165 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/UploadCancelParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/UploadCancelParams.kt @@ -50,6 +50,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [UploadCancelParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/UploadCompleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/UploadCompleteParams.kt index 21eebc2a..4d43e9c1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/UploadCompleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/UploadCompleteParams.kt @@ -131,6 +131,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [UploadCompleteBody]. */ class Builder internal constructor() { private var partIds: JsonField>? = null @@ -230,6 +231,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [UploadCompleteParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/UploadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/UploadCreateParams.kt index 6fca01b3..d87e0535 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/UploadCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/UploadCreateParams.kt @@ -187,6 +187,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [UploadCreateBody]. */ class Builder internal constructor() { private var bytes: JsonField? = null @@ -302,6 +303,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [UploadCreateParams]. */ @NoAutoDetect class Builder internal constructor() { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt index 7c29cd29..020ff989 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt @@ -83,6 +83,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [UploadPart]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/VectorStore.kt b/openai-java-core/src/main/kotlin/com/openai/models/VectorStore.kt index c7f392e8..03048913 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/VectorStore.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/VectorStore.kt @@ -163,6 +163,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStore]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -394,6 +395,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileCounts]. */ class Builder internal constructor() { private var cancelled: JsonField? = null @@ -501,6 +503,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -514,19 +524,37 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { EXPIRED, IN_PROGRESS, COMPLETED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { EXPIRED, IN_PROGRESS, COMPLETED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { EXPIRED -> Value.EXPIRED @@ -535,6 +563,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { EXPIRED -> Known.EXPIRED @@ -608,6 +645,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [ExpiresAfter]. */ class Builder internal constructor() { private var anchor: JsonValue = JsonValue.from("last_active_at") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreDeleted.kt index d7f4f70c..d4e7f6bd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreDeleted.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStoreDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null diff --git a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFile.kt index 8ec29620..00470904 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFile.kt @@ -156,6 +156,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStoreFile]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -359,6 +360,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [LastError]. */ class Builder internal constructor() { private var code: JsonField? = null @@ -418,6 +420,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -431,19 +441,37 @@ private constructor( @JvmStatic fun of(value: String) = Code(JsonField.of(value)) } + /** An enum containing [Code]'s known values. */ enum class Known { SERVER_ERROR, UNSUPPORTED_FILE, INVALID_FILE, } + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Code] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { SERVER_ERROR, UNSUPPORTED_FILE, INVALID_FILE, + /** An enum member indicating that [Code] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ fun value(): Value = when (this) { SERVER_ERROR -> Value.SERVER_ERROR @@ -452,6 +480,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { SERVER_ERROR -> Known.SERVER_ERROR @@ -504,6 +541,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -519,6 +564,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { IN_PROGRESS, COMPLETED, @@ -526,14 +572,31 @@ private constructor( FAILED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { IN_PROGRESS, COMPLETED, CANCELLED, FAILED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { IN_PROGRESS -> Value.IN_PROGRESS @@ -543,6 +606,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { IN_PROGRESS -> Known.IN_PROGRESS diff --git a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileBatch.kt b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileBatch.kt index fdf07019..2564ad07 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileBatch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileBatch.kt @@ -120,6 +120,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStoreFileBatch]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -298,6 +299,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [FileCounts]. */ class Builder internal constructor() { private var cancelled: JsonField? = null @@ -405,6 +407,14 @@ private constructor( private val value: JsonField, ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -420,6 +430,7 @@ private constructor( @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } + /** An enum containing [Status]'s known values. */ enum class Known { IN_PROGRESS, COMPLETED, @@ -427,14 +438,31 @@ private constructor( FAILED, } + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ enum class Value { IN_PROGRESS, COMPLETED, CANCELLED, FAILED, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ fun value(): Value = when (this) { IN_PROGRESS -> Value.IN_PROGRESS @@ -444,6 +472,15 @@ private constructor( else -> Value._UNKNOWN } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ fun known(): Known = when (this) { IN_PROGRESS -> Known.IN_PROGRESS diff --git a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileDeleted.kt index d97dd0bd..02f8b593 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/VectorStoreFileDeleted.kt @@ -67,6 +67,7 @@ private constructor( @JvmStatic fun builder() = Builder() } + /** A builder for [VectorStoreFileDeleted]. */ class Builder internal constructor() { private var id: JsonField? = null From c1e6dcb170a2a6d0f8ea3a1b9148201c5f3123f2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 17:51:55 +0000 Subject: [PATCH 2/2] release: 0.15.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 8 ++++---- build.gradle.kts | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8f3e0a49..56b9e502 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.15.0" + ".": "0.15.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ce227f3..0bef6d13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.15.1 (2025-01-27) + +Full Changelog: [v0.15.0...v0.15.1](https://github.com/openai/openai-java/compare/v0.15.0...v0.15.1) + +### Documentation + +* builder, enum, and union comments ([#171](https://github.com/openai/openai-java/issues/171)) ([37acbbd](https://github.com/openai/openai-java/commit/37acbbd239d6b540a461084240bc266ad0491e9c)) + ## 0.15.0 (2025-01-27) Full Changelog: [v0.14.1...v0.15.0](https://github.com/openai/openai-java/compare/v0.14.1...v0.15.0) diff --git a/README.md b/README.md index 5f86d677..1aea4b99 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.15.0) -[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.15.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.15.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.15.1) +[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.15.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.15.1) @@ -25,7 +25,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor ### Gradle ```kotlin -implementation("com.openai:openai-java:0.15.0") +implementation("com.openai:openai-java:0.15.1") ``` ### Maven @@ -34,7 +34,7 @@ implementation("com.openai:openai-java:0.15.0") com.openai openai-java - 0.15.0 + 0.15.1 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 6c03b8ff..acb2afc7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.openai" - version = "0.15.0" // x-release-please-version + version = "0.15.1" // x-release-please-version } subprojects {