From d44f4664a550f4d34b2d1b14c7f376d1047514e0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 17:35:39 +0000 Subject: [PATCH 01/27] docs: clarify forwards compat behavior --- README.md | 4 +- .../client/okhttp/OpenAIOkHttpClient.kt | 3 + .../client/okhttp/OpenAIOkHttpClientAsync.kt | 3 + .../kotlin/com/openai/core/ClientOptions.kt | 6 + .../kotlin/com/openai/core/RequestOptions.kt | 9 + .../kotlin/com/openai/models/AllModels.kt | 46 ++ .../kotlin/com/openai/models/ChatModel.kt | 8 + .../com/openai/models/ComparisonFilter.kt | 95 +++ .../com/openai/models/CompoundFilter.kt | 55 ++ .../openai/models/CustomToolInputFormat.kt | 56 ++ .../kotlin/com/openai/models/ErrorObject.kt | 8 + .../com/openai/models/FunctionDefinition.kt | 8 + .../com/openai/models/FunctionParameters.kt | 8 + .../com/openai/models/OAuthErrorCode.kt | 8 + .../kotlin/com/openai/models/Reasoning.kt | 26 + .../com/openai/models/ReasoningEffort.kt | 8 + .../openai/models/ResponseFormatJsonObject.kt | 8 + .../openai/models/ResponseFormatJsonSchema.kt | 27 + .../com/openai/models/ResponseFormatText.kt | 8 + .../models/ResponseFormatTextGrammar.kt | 8 + .../openai/models/ResponseFormatTextPython.kt | 8 + .../com/openai/models/ResponsesModel.kt | 46 ++ .../organization/adminapikeys/AdminApiKey.kt | 17 + .../adminapikeys/AdminApiKeyCreateParams.kt | 9 + .../adminapikeys/AdminApiKeyCreateResponse.kt | 8 + .../adminapikeys/AdminApiKeyDeleteResponse.kt | 8 + .../AdminApiKeyListPageResponse.kt | 8 + .../adminapikeys/AdminApiKeyListParams.kt | 9 + .../auditlogs/AuditLogListPageResponse.kt | 8 + .../auditlogs/AuditLogListParams.kt | 9 + .../auditlogs/AuditLogListResponse.kt | 700 ++++++++++++++++++ .../organization/certificates/Certificate.kt | 26 + .../CertificateActivatePageResponse.kt | 8 + .../certificates/CertificateActivateParams.kt | 9 + .../CertificateActivateResponse.kt | 17 + .../certificates/CertificateCreateParams.kt | 9 + .../CertificateDeactivatePageResponse.kt | 8 + .../CertificateDeactivateParams.kt | 9 + .../CertificateDeactivateResponse.kt | 17 + .../certificates/CertificateDeleteResponse.kt | 8 + .../CertificateListPageResponse.kt | 8 + .../certificates/CertificateListParams.kt | 9 + .../certificates/CertificateListResponse.kt | 17 + .../certificates/CertificateRetrieveParams.kt | 9 + .../certificates/CertificateUpdateParams.kt | 9 + .../models/admin/organization/groups/Group.kt | 8 + .../organization/groups/GroupCreateParams.kt | 9 + .../groups/GroupDeleteResponse.kt | 8 + .../groups/GroupListPageResponse.kt | 8 + .../organization/groups/GroupListParams.kt | 9 + .../organization/groups/GroupUpdateParams.kt | 9 + .../groups/GroupUpdateResponse.kt | 8 + .../groups/roles/RoleCreateParams.kt | 9 + .../groups/roles/RoleCreateResponse.kt | 17 + .../groups/roles/RoleDeleteResponse.kt | 8 + .../groups/roles/RoleListPageResponse.kt | 8 + .../groups/roles/RoleListParams.kt | 9 + .../groups/roles/RoleListResponse.kt | 26 + .../groups/users/OrganizationGroupUser.kt | 8 + .../groups/users/UserCreateParams.kt | 9 + .../groups/users/UserCreateResponse.kt | 8 + .../groups/users/UserDeleteResponse.kt | 8 + .../groups/users/UserListPageResponse.kt | 8 + .../groups/users/UserListParams.kt | 9 + .../admin/organization/invites/Invite.kt | 45 ++ .../invites/InviteCreateParams.kt | 37 + .../invites/InviteDeleteResponse.kt | 8 + .../invites/InviteListPageResponse.kt | 8 + .../admin/organization/projects/Project.kt | 8 + .../projects/ProjectCreateParams.kt | 9 + .../projects/ProjectListPageResponse.kt | 8 + .../projects/ProjectUpdateParams.kt | 9 + .../projects/apikeys/ApiKeyDeleteResponse.kt | 8 + .../apikeys/ApiKeyListPageResponse.kt | 8 + .../projects/apikeys/ProjectApiKey.kt | 47 ++ .../CertificateActivatePageResponse.kt | 8 + .../certificates/CertificateActivateParams.kt | 9 + .../CertificateActivateResponse.kt | 17 + .../CertificateDeactivatePageResponse.kt | 8 + .../CertificateDeactivateParams.kt | 9 + .../CertificateDeactivateResponse.kt | 17 + .../CertificateListPageResponse.kt | 8 + .../certificates/CertificateListParams.kt | 9 + .../certificates/CertificateListResponse.kt | 17 + .../projects/groups/GroupCreateParams.kt | 9 + .../projects/groups/GroupDeleteResponse.kt | 8 + .../projects/groups/GroupListPageResponse.kt | 8 + .../projects/groups/GroupListParams.kt | 9 + .../projects/groups/ProjectGroup.kt | 8 + .../projects/groups/roles/RoleCreateParams.kt | 9 + .../groups/roles/RoleCreateResponse.kt | 17 + .../groups/roles/RoleDeleteResponse.kt | 8 + .../groups/roles/RoleListPageResponse.kt | 8 + .../projects/groups/roles/RoleListParams.kt | 9 + .../projects/groups/roles/RoleListResponse.kt | 26 + .../projects/ratelimits/ProjectRateLimit.kt | 8 + .../RateLimitListRateLimitsPageResponse.kt | 8 + .../RateLimitUpdateRateLimitParams.kt | 9 + .../projects/roles/RoleCreateParams.kt | 9 + .../projects/roles/RoleDeleteResponse.kt | 8 + .../projects/roles/RoleListPageResponse.kt | 8 + .../projects/roles/RoleListParams.kt | 9 + .../projects/roles/RoleUpdateParams.kt | 9 + .../serviceaccounts/ProjectServiceAccount.kt | 17 + .../ServiceAccountCreateParams.kt | 9 + .../ServiceAccountCreateResponse.kt | 17 + .../ServiceAccountDeleteResponse.kt | 8 + .../ServiceAccountListPageResponse.kt | 8 + .../projects/users/ProjectUser.kt | 8 + .../projects/users/UserCreateParams.kt | 9 + .../projects/users/UserDeleteResponse.kt | 8 + .../projects/users/UserListPageResponse.kt | 8 + .../projects/users/UserUpdateParams.kt | 9 + .../projects/users/roles/RoleCreateParams.kt | 9 + .../users/roles/RoleCreateResponse.kt | 8 + .../users/roles/RoleDeleteResponse.kt | 8 + .../users/roles/RoleListPageResponse.kt | 8 + .../projects/users/roles/RoleListParams.kt | 9 + .../projects/users/roles/RoleListResponse.kt | 26 + .../models/admin/organization/roles/Role.kt | 8 + .../organization/roles/RoleCreateParams.kt | 9 + .../organization/roles/RoleDeleteResponse.kt | 8 + .../roles/RoleListPageResponse.kt | 8 + .../organization/roles/RoleListParams.kt | 9 + .../organization/roles/RoleUpdateParams.kt | 9 + .../usage/UsageAudioSpeechesParams.kt | 18 + .../usage/UsageAudioSpeechesResponse.kt | 157 ++++ .../usage/UsageAudioTranscriptionsParams.kt | 18 + .../usage/UsageAudioTranscriptionsResponse.kt | 157 ++++ .../UsageCodeInterpreterSessionsParams.kt | 18 + .../UsageCodeInterpreterSessionsResponse.kt | 157 ++++ .../usage/UsageCompletionsParams.kt | 18 + .../usage/UsageCompletionsResponse.kt | 157 ++++ .../organization/usage/UsageCostsParams.kt | 18 + .../organization/usage/UsageCostsResponse.kt | 157 ++++ .../usage/UsageEmbeddingsParams.kt | 18 + .../usage/UsageEmbeddingsResponse.kt | 157 ++++ .../organization/usage/UsageImagesParams.kt | 36 + .../organization/usage/UsageImagesResponse.kt | 157 ++++ .../usage/UsageModerationsParams.kt | 18 + .../usage/UsageModerationsResponse.kt | 157 ++++ .../usage/UsageVectorStoresParams.kt | 18 + .../usage/UsageVectorStoresResponse.kt | 157 ++++ .../organization/users/OrganizationUser.kt | 36 + .../organization/users/UserDeleteResponse.kt | 8 + .../users/UserListPageResponse.kt | 8 + .../organization/users/UserUpdateParams.kt | 9 + .../users/roles/RoleCreateParams.kt | 9 + .../users/roles/RoleCreateResponse.kt | 8 + .../users/roles/RoleDeleteResponse.kt | 8 + .../users/roles/RoleListPageResponse.kt | 8 + .../users/roles/RoleListParams.kt | 9 + .../users/roles/RoleListResponse.kt | 26 + .../com/openai/models/audio/AudioModel.kt | 8 + .../models/audio/AudioResponseFormat.kt | 8 + .../models/audio/speech/SpeechCreateParams.kt | 85 +++ .../openai/models/audio/speech/SpeechModel.kt | 8 + .../audio/transcriptions/Transcription.kt | 85 +++ .../TranscriptionCreateParams.kt | 76 ++ .../TranscriptionCreateResponse.kt | 37 + .../transcriptions/TranscriptionDiarized.kt | 76 ++ .../TranscriptionDiarizedSegment.kt | 8 + .../transcriptions/TranscriptionInclude.kt | 8 + .../transcriptions/TranscriptionSegment.kt | 8 + .../TranscriptionStreamEvent.kt | 37 + .../TranscriptionTextDeltaEvent.kt | 17 + .../TranscriptionTextDoneEvent.kt | 36 + .../TranscriptionTextSegmentEvent.kt | 8 + .../transcriptions/TranscriptionVerbose.kt | 17 + .../audio/transcriptions/TranscriptionWord.kt | 8 + .../models/audio/translations/Translation.kt | 8 + .../translations/TranslationCreateParams.kt | 18 + .../translations/TranslationCreateResponse.kt | 37 + .../audio/translations/TranslationVerbose.kt | 8 + .../kotlin/com/openai/models/batches/Batch.kt | 35 + .../models/batches/BatchCreateParams.kt | 45 ++ .../com/openai/models/batches/BatchError.kt | 8 + .../models/batches/BatchListPageResponse.kt | 8 + .../models/batches/BatchRequestCounts.kt | 8 + .../com/openai/models/batches/BatchUsage.kt | 26 + .../models/beta/assistants/Assistant.kt | 46 ++ .../beta/assistants/AssistantCreateParams.kt | 128 ++++ .../beta/assistants/AssistantDeleted.kt | 8 + .../assistants/AssistantListPageResponse.kt | 8 + .../beta/assistants/AssistantListParams.kt | 9 + .../beta/assistants/AssistantStreamEvent.kt | 253 +++++++ .../models/beta/assistants/AssistantTool.kt | 37 + .../beta/assistants/AssistantUpdateParams.kt | 56 ++ .../beta/assistants/CodeInterpreterTool.kt | 8 + .../models/beta/assistants/FileSearchTool.kt | 37 + .../models/beta/assistants/FunctionTool.kt | 8 + .../beta/assistants/MessageStreamEvent.kt | 82 ++ .../beta/assistants/RunStepStreamEvent.kt | 100 +++ .../models/beta/assistants/RunStreamEvent.kt | 127 ++++ .../beta/assistants/ThreadStreamEvent.kt | 8 + .../models/beta/chatkit/ChatKitWorkflow.kt | 26 + .../chatkit/sessions/SessionCreateParams.kt | 9 + .../beta/chatkit/threads/ChatKitAttachment.kt | 17 + .../threads/ChatKitResponseOutputText.kt | 86 +++ .../beta/chatkit/threads/ChatKitThread.kt | 66 ++ .../ChatKitThreadAssistantMessageItem.kt | 8 + .../chatkit/threads/ChatKitThreadItemList.kt | 116 +++ .../threads/ChatKitThreadUserMessageItem.kt | 85 +++ .../beta/chatkit/threads/ChatKitWidgetItem.kt | 8 + .../beta/chatkit/threads/ChatSession.kt | 8 + .../ChatSessionAutomaticThreadTitling.kt | 8 + .../ChatSessionChatKitConfiguration.kt | 8 + .../ChatSessionChatKitConfigurationParam.kt | 35 + .../threads/ChatSessionExpiresAfterParam.kt | 8 + .../chatkit/threads/ChatSessionFileUpload.kt | 8 + .../chatkit/threads/ChatSessionHistory.kt | 8 + .../chatkit/threads/ChatSessionRateLimits.kt | 8 + .../threads/ChatSessionRateLimitsParam.kt | 8 + .../beta/chatkit/threads/ChatSessionStatus.kt | 8 + .../threads/ChatSessionWorkflowParam.kt | 26 + .../chatkit/threads/ThreadDeleteResponse.kt | 8 + .../chatkit/threads/ThreadListItemsParams.kt | 9 + .../chatkit/threads/ThreadListPageResponse.kt | 8 + .../beta/chatkit/threads/ThreadListParams.kt | 9 + .../threads/AssistantResponseFormatOption.kt | 37 + .../beta/threads/AssistantToolChoice.kt | 17 + .../threads/AssistantToolChoiceFunction.kt | 8 + .../beta/threads/AssistantToolChoiceOption.kt | 46 ++ .../com/openai/models/beta/threads/Thread.kt | 46 ++ .../beta/threads/ThreadCreateAndRunParams.kt | 317 ++++++++ .../models/beta/threads/ThreadCreateParams.kt | 247 ++++++ .../models/beta/threads/ThreadDeleted.kt | 8 + .../models/beta/threads/ThreadUpdateParams.kt | 47 ++ .../beta/threads/messages/Annotation.kt | 37 + .../beta/threads/messages/AnnotationDelta.kt | 37 + .../messages/FileCitationAnnotation.kt | 17 + .../messages/FileCitationDeltaAnnotation.kt | 17 + .../threads/messages/FilePathAnnotation.kt | 17 + .../messages/FilePathDeltaAnnotation.kt | 17 + .../models/beta/threads/messages/ImageFile.kt | 17 + .../threads/messages/ImageFileContentBlock.kt | 8 + .../beta/threads/messages/ImageFileDelta.kt | 17 + .../threads/messages/ImageFileDeltaBlock.kt | 8 + .../models/beta/threads/messages/ImageUrl.kt | 17 + .../threads/messages/ImageUrlContentBlock.kt | 8 + .../beta/threads/messages/ImageUrlDelta.kt | 17 + .../threads/messages/ImageUrlDeltaBlock.kt | 8 + .../models/beta/threads/messages/Message.kt | 103 +++ .../beta/threads/messages/MessageContent.kt | 37 + .../threads/messages/MessageContentDelta.kt | 37 + .../messages/MessageContentPartParam.kt | 37 + .../threads/messages/MessageCreateParams.kt | 114 +++ .../beta/threads/messages/MessageDeleted.kt | 8 + .../beta/threads/messages/MessageDelta.kt | 17 + .../threads/messages/MessageDeltaEvent.kt | 8 + .../messages/MessageListPageResponse.kt | 8 + .../threads/messages/MessageListParams.kt | 9 + .../threads/messages/MessageUpdateParams.kt | 18 + .../threads/messages/RefusalContentBlock.kt | 8 + .../threads/messages/RefusalDeltaBlock.kt | 8 + .../models/beta/threads/messages/Text.kt | 8 + .../beta/threads/messages/TextContentBlock.kt | 8 + .../threads/messages/TextContentBlockParam.kt | 8 + .../models/beta/threads/messages/TextDelta.kt | 8 + .../beta/threads/messages/TextDeltaBlock.kt | 8 + .../runs/RequiredActionFunctionToolCall.kt | 17 + .../openai/models/beta/threads/runs/Run.kt | 102 +++ .../beta/threads/runs/RunCreateParams.kt | 156 ++++ .../beta/threads/runs/RunListPageResponse.kt | 8 + .../models/beta/threads/runs/RunListParams.kt | 9 + .../models/beta/threads/runs/RunStatus.kt | 8 + .../runs/RunSubmitToolOutputsParams.kt | 18 + .../beta/threads/runs/RunUpdateParams.kt | 18 + .../threads/runs/steps/CodeInterpreterLogs.kt | 8 + .../runs/steps/CodeInterpreterOutputImage.kt | 17 + .../runs/steps/CodeInterpreterToolCall.kt | 87 +++ .../steps/CodeInterpreterToolCallDelta.kt | 57 ++ .../threads/runs/steps/FileSearchToolCall.kt | 67 ++ .../runs/steps/FileSearchToolCallDelta.kt | 8 + .../threads/runs/steps/FunctionToolCall.kt | 17 + .../runs/steps/FunctionToolCallDelta.kt | 17 + .../runs/steps/MessageCreationStepDetails.kt | 17 + .../models/beta/threads/runs/steps/RunStep.kt | 101 +++ .../beta/threads/runs/steps/RunStepDelta.kt | 46 ++ .../threads/runs/steps/RunStepDeltaEvent.kt | 8 + .../runs/steps/RunStepDeltaMessageDelta.kt | 17 + .../beta/threads/runs/steps/RunStepInclude.kt | 8 + .../runs/steps/StepListPageResponse.kt | 8 + .../beta/threads/runs/steps/StepListParams.kt | 9 + .../beta/threads/runs/steps/ToolCall.kt | 37 + .../beta/threads/runs/steps/ToolCallDelta.kt | 37 + .../threads/runs/steps/ToolCallDeltaObject.kt | 8 + .../runs/steps/ToolCallsStepDetails.kt | 8 + .../models/chat/completions/ChatCompletion.kt | 46 ++ .../ChatCompletionAllowedToolChoice.kt | 8 + .../completions/ChatCompletionAllowedTools.kt | 26 + .../ChatCompletionAssistantMessageParam.kt | 104 +++ .../chat/completions/ChatCompletionAudio.kt | 8 + .../completions/ChatCompletionAudioParam.kt | 75 ++ .../chat/completions/ChatCompletionChunk.kt | 106 +++ .../completions/ChatCompletionContentPart.kt | 56 ++ .../ChatCompletionContentPartImage.kt | 27 + .../ChatCompletionContentPartInputAudio.kt | 27 + .../ChatCompletionContentPartRefusal.kt | 8 + .../ChatCompletionContentPartText.kt | 8 + .../completions/ChatCompletionCreateParams.kt | 235 ++++++ .../completions/ChatCompletionCustomTool.kt | 87 +++ .../chat/completions/ChatCompletionDeleted.kt | 8 + .../ChatCompletionDeveloperMessageParam.kt | 46 ++ .../ChatCompletionFunctionCallOption.kt | 8 + .../ChatCompletionFunctionMessageParam.kt | 8 + .../completions/ChatCompletionFunctionTool.kt | 8 + .../ChatCompletionListPageResponse.kt | 8 + .../completions/ChatCompletionListParams.kt | 9 + .../chat/completions/ChatCompletionMessage.kt | 36 + .../ChatCompletionMessageCustomToolCall.kt | 17 + .../ChatCompletionMessageFunctionToolCall.kt | 17 + .../completions/ChatCompletionMessageParam.kt | 37 + .../ChatCompletionMessageToolCall.kt | 37 + .../completions/ChatCompletionModality.kt | 8 + .../ChatCompletionNamedToolChoice.kt | 17 + .../ChatCompletionNamedToolChoiceCustom.kt | 17 + .../ChatCompletionPredictionContent.kt | 46 ++ .../chat/completions/ChatCompletionRole.kt | 8 + .../completions/ChatCompletionStoreMessage.kt | 46 ++ .../ChatCompletionStreamOptions.kt | 8 + .../ChatCompletionSystemMessageParam.kt | 46 ++ .../completions/ChatCompletionTokenLogprob.kt | 17 + .../chat/completions/ChatCompletionTool.kt | 37 + .../ChatCompletionToolChoiceOption.kt | 46 ++ .../ChatCompletionToolMessageParam.kt | 46 ++ .../completions/ChatCompletionUpdateParams.kt | 18 + .../ChatCompletionUserMessageParam.kt | 46 ++ .../messages/MessageListPageResponse.kt | 8 + .../completions/messages/MessageListParams.kt | 9 + .../openai/models/completions/Completion.kt | 8 + .../models/completions/CompletionChoice.kt | 36 + .../completions/CompletionCreateParams.kt | 103 +++ .../models/completions/CompletionUsage.kt | 26 + .../containers/ContainerCreateParams.kt | 113 +++ .../containers/ContainerCreateResponse.kt | 55 ++ .../containers/ContainerListPageResponse.kt | 8 + .../models/containers/ContainerListParams.kt | 9 + .../containers/ContainerListResponse.kt | 55 ++ .../containers/ContainerRetrieveResponse.kt | 55 ++ .../containers/files/FileCreateParams.kt | 9 + .../containers/files/FileCreateResponse.kt | 8 + .../containers/files/FileListPageResponse.kt | 8 + .../models/containers/files/FileListParams.kt | 9 + .../containers/files/FileListResponse.kt | 8 + .../containers/files/FileRetrieveResponse.kt | 8 + .../ComputerScreenshotContent.kt | 17 + .../models/conversations/Conversation.kt | 8 + .../conversations/ConversationCreateParams.kt | 18 + .../conversations/ConversationDeleted.kt | 8 + .../ConversationDeletedResource.kt | 8 + .../conversations/ConversationUpdateParams.kt | 18 + .../openai/models/conversations/Message.kt | 83 +++ .../conversations/SummaryTextContent.kt | 8 + .../models/conversations/TextContent.kt | 8 + .../conversations/items/ConversationItem.kt | 170 +++++ .../items/ConversationItemList.kt | 8 + .../conversations/items/ItemCreateParams.kt | 9 + .../conversations/items/ItemListParams.kt | 9 + .../embeddings/CreateEmbeddingResponse.kt | 17 + .../com/openai/models/embeddings/Embedding.kt | 8 + .../embeddings/EmbeddingCreateParams.kt | 56 ++ .../models/embeddings/EmbeddingModel.kt | 8 + .../openai/models/evals/EvalCreateParams.kt | 335 +++++++++ .../openai/models/evals/EvalCreateResponse.kt | 153 ++++ .../evals/EvalCustomDataSourceConfig.kt | 17 + .../openai/models/evals/EvalDeleteResponse.kt | 8 + .../models/evals/EvalListPageResponse.kt | 8 + .../com/openai/models/evals/EvalListParams.kt | 18 + .../openai/models/evals/EvalListResponse.kt | 153 ++++ .../models/evals/EvalRetrieveResponse.kt | 153 ++++ .../EvalStoredCompletionsDataSourceConfig.kt | 26 + .../openai/models/evals/EvalUpdateParams.kt | 18 + .../openai/models/evals/EvalUpdateResponse.kt | 153 ++++ .../CreateEvalCompletionsRunDataSource.kt | 363 +++++++++ .../runs/CreateEvalJsonlRunDataSource.kt | 96 +++ .../openai/models/evals/runs/EvalApiError.kt | 8 + .../models/evals/runs/RunCancelResponse.kt | 414 +++++++++++ .../models/evals/runs/RunCreateParams.kt | 398 ++++++++++ .../models/evals/runs/RunCreateResponse.kt | 414 +++++++++++ .../models/evals/runs/RunDeleteResponse.kt | 8 + .../models/evals/runs/RunListPageResponse.kt | 8 + .../openai/models/evals/runs/RunListParams.kt | 18 + .../models/evals/runs/RunListResponse.kt | 414 +++++++++++ .../models/evals/runs/RunRetrieveResponse.kt | 414 +++++++++++ .../outputitems/OutputItemListPageResponse.kt | 8 + .../runs/outputitems/OutputItemListParams.kt | 18 + .../outputitems/OutputItemListResponse.kt | 75 ++ .../outputitems/OutputItemRetrieveResponse.kt | 75 ++ .../openai/models/files/FileCreateParams.kt | 18 + .../com/openai/models/files/FileDeleted.kt | 8 + .../models/files/FileListPageResponse.kt | 8 + .../com/openai/models/files/FileListParams.kt | 9 + .../com/openai/models/files/FileObject.kt | 26 + .../com/openai/models/files/FilePurpose.kt | 8 + .../alpha/graders/GraderRunParams.kt | 47 ++ .../alpha/graders/GraderRunResponse.kt | 55 ++ .../alpha/graders/GraderValidateParams.kt | 47 ++ .../alpha/graders/GraderValidateResponse.kt | 46 ++ .../PermissionCreatePageResponse.kt | 8 + .../permissions/PermissionCreateParams.kt | 9 + .../permissions/PermissionCreateResponse.kt | 8 + .../permissions/PermissionDeleteResponse.kt | 8 + .../permissions/PermissionListPageResponse.kt | 8 + .../permissions/PermissionListParams.kt | 9 + .../permissions/PermissionListResponse.kt | 8 + .../permissions/PermissionRetrieveParams.kt | 9 + .../permissions/PermissionRetrieveResponse.kt | 17 + .../models/finetuning/jobs/FineTuningJob.kt | 183 +++++ .../finetuning/jobs/FineTuningJobEvent.kt | 26 + .../jobs/FineTuningJobWandbIntegration.kt | 8 + .../FineTuningJobWandbIntegrationObject.kt | 8 + .../models/finetuning/jobs/JobCreateParams.kt | 194 +++++ .../jobs/JobListEventsPageResponse.kt | 8 + .../finetuning/jobs/JobListPageResponse.kt | 8 + .../checkpoints/CheckpointListPageResponse.kt | 8 + .../checkpoints/FineTuningJobCheckpoint.kt | 17 + .../finetuning/methods/DpoHyperparameters.kt | 160 ++++ .../models/finetuning/methods/DpoMethod.kt | 8 + .../methods/ReinforcementHyperparameters.kt | 245 ++++++ .../finetuning/methods/ReinforcementMethod.kt | 46 ++ .../methods/SupervisedHyperparameters.kt | 122 +++ .../finetuning/methods/SupervisedMethod.kt | 8 + .../graders/gradermodels/EvalContentItem.kt | 55 ++ .../graders/gradermodels/LabelModelGrader.kt | 97 +++ .../graders/gradermodels/MultiGrader.kt | 46 ++ .../graders/gradermodels/PythonGrader.kt | 8 + .../graders/gradermodels/ScoreModelGrader.kt | 106 +++ .../graders/gradermodels/StringCheckGrader.kt | 17 + .../gradermodels/TextSimilarityGrader.kt | 17 + .../kotlin/com/openai/models/images/Image.kt | 8 + .../images/ImageCreateVariationParams.kt | 27 + .../models/images/ImageEditCompletedEvent.kt | 63 ++ .../openai/models/images/ImageEditParams.kt | 101 +++ .../images/ImageEditPartialImageEvent.kt | 44 ++ .../models/images/ImageEditStreamEvent.kt | 37 + .../models/images/ImageGenCompletedEvent.kt | 63 ++ .../images/ImageGenPartialImageEvent.kt | 44 ++ .../models/images/ImageGenStreamEvent.kt | 37 + .../models/images/ImageGenerateParams.kt | 72 ++ .../com/openai/models/images/ImageModel.kt | 8 + .../openai/models/images/ImagesResponse.kt | 73 ++ .../kotlin/com/openai/models/models/Model.kt | 8 + .../com/openai/models/models/ModelDeleted.kt | 8 + .../models/models/ModelListPageResponse.kt | 8 + .../openai/models/moderations/Moderation.kt | 165 +++++ .../moderations/ModerationCreateParams.kt | 47 ++ .../moderations/ModerationCreateResponse.kt | 8 + .../moderations/ModerationImageUrlInput.kt | 17 + .../models/moderations/ModerationModel.kt | 8 + .../moderations/ModerationMultiModalInput.kt | 37 + .../models/moderations/ModerationTextInput.kt | 8 + .../models/realtime/AudioTranscription.kt | 17 + .../realtime/ConversationCreatedEvent.kt | 27 + .../models/realtime/ConversationItem.kt | 37 + .../models/realtime/ConversationItemAdded.kt | 8 + .../realtime/ConversationItemCreateEvent.kt | 8 + .../realtime/ConversationItemCreatedEvent.kt | 8 + .../realtime/ConversationItemDeleteEvent.kt | 8 + .../realtime/ConversationItemDeletedEvent.kt | 8 + .../models/realtime/ConversationItemDone.kt | 8 + ...emInputAudioTranscriptionCompletedEvent.kt | 76 ++ ...onItemInputAudioTranscriptionDeltaEvent.kt | 8 + ...nItemInputAudioTranscriptionFailedEvent.kt | 17 + ...ationItemInputAudioTranscriptionSegment.kt | 8 + .../realtime/ConversationItemRetrieveEvent.kt | 8 + .../realtime/ConversationItemTruncateEvent.kt | 8 + .../ConversationItemTruncatedEvent.kt | 8 + .../realtime/ConversationItemWithReference.kt | 63 ++ .../realtime/InputAudioBufferAppendEvent.kt | 8 + .../realtime/InputAudioBufferClearEvent.kt | 8 + .../realtime/InputAudioBufferClearedEvent.kt | 8 + .../realtime/InputAudioBufferCommitEvent.kt | 8 + .../InputAudioBufferCommittedEvent.kt | 8 + .../InputAudioBufferDtmfEventReceivedEvent.kt | 8 + .../InputAudioBufferSpeechStartedEvent.kt | 8 + .../InputAudioBufferSpeechStoppedEvent.kt | 8 + .../InputAudioBufferTimeoutTriggered.kt | 8 + .../models/realtime/LogProbProperties.kt | 8 + .../models/realtime/McpListToolsCompleted.kt | 8 + .../models/realtime/McpListToolsFailed.kt | 8 + .../models/realtime/McpListToolsInProgress.kt | 8 + .../models/realtime/NoiseReductionType.kt | 8 + .../realtime/OutputAudioBufferClearEvent.kt | 8 + .../models/realtime/RateLimitsUpdatedEvent.kt | 27 + .../models/realtime/RealtimeAudioConfig.kt | 8 + .../realtime/RealtimeAudioConfigInput.kt | 17 + .../realtime/RealtimeAudioConfigOutput.kt | 66 ++ .../models/realtime/RealtimeAudioFormats.kt | 104 +++ .../RealtimeAudioInputTurnDetection.kt | 65 ++ .../models/realtime/RealtimeClientEvent.kt | 37 + ...ealtimeConversationItemAssistantMessage.kt | 45 ++ .../RealtimeConversationItemFunctionCall.kt | 26 + ...ltimeConversationItemFunctionCallOutput.kt | 26 + .../RealtimeConversationItemSystemMessage.kt | 45 ++ .../RealtimeConversationItemUserMessage.kt | 55 ++ .../openai/models/realtime/RealtimeError.kt | 8 + .../models/realtime/RealtimeErrorEvent.kt | 8 + .../models/realtime/RealtimeFunctionTool.kt | 17 + .../realtime/RealtimeMcpApprovalRequest.kt | 8 + .../realtime/RealtimeMcpApprovalResponse.kt | 8 + .../models/realtime/RealtimeMcpListTools.kt | 17 + .../realtime/RealtimeMcpProtocolError.kt | 8 + .../models/realtime/RealtimeMcpToolCall.kt | 46 ++ .../realtime/RealtimeMcpToolExecutionError.kt | 8 + .../models/realtime/RealtimeMcphttpError.kt | 8 + .../models/realtime/RealtimeResponse.kt | 111 +++ .../RealtimeResponseCreateAudioOutput.kt | 77 ++ .../realtime/RealtimeResponseCreateMcpTool.kt | 152 ++++ .../realtime/RealtimeResponseCreateParams.kt | 149 ++++ .../models/realtime/RealtimeResponseStatus.kt | 35 + .../models/realtime/RealtimeResponseUsage.kt | 8 + .../RealtimeResponseUsageInputTokenDetails.kt | 17 + ...RealtimeResponseUsageOutputTokenDetails.kt | 8 + .../models/realtime/RealtimeServerEvent.kt | 73 ++ .../openai/models/realtime/RealtimeSession.kt | 234 ++++++ .../realtime/RealtimeSessionCreateRequest.kt | 73 ++ .../realtime/RealtimeToolChoiceConfig.kt | 37 + .../realtime/RealtimeToolsConfigUnion.kt | 196 +++++ .../models/realtime/RealtimeTracingConfig.kt | 46 ++ .../RealtimeTranscriptionSessionAudio.kt | 8 + .../RealtimeTranscriptionSessionAudioInput.kt | 17 + ...scriptionSessionAudioInputTurnDetection.kt | 65 ++ ...altimeTranscriptionSessionCreateRequest.kt | 17 + .../models/realtime/RealtimeTruncation.kt | 46 ++ .../RealtimeTruncationRetentionRatio.kt | 17 + .../realtime/ResponseAudioDeltaEvent.kt | 8 + .../models/realtime/ResponseAudioDoneEvent.kt | 8 + .../ResponseAudioTranscriptDeltaEvent.kt | 8 + .../ResponseAudioTranscriptDoneEvent.kt | 8 + .../models/realtime/ResponseCancelEvent.kt | 8 + .../realtime/ResponseContentPartAddedEvent.kt | 27 + .../realtime/ResponseContentPartDoneEvent.kt | 27 + .../models/realtime/ResponseCreateEvent.kt | 8 + .../models/realtime/ResponseCreatedEvent.kt | 8 + .../models/realtime/ResponseDoneEvent.kt | 8 + ...ResponseFunctionCallArgumentsDeltaEvent.kt | 8 + .../ResponseFunctionCallArgumentsDoneEvent.kt | 8 + .../realtime/ResponseMcpCallArgumentsDelta.kt | 8 + .../realtime/ResponseMcpCallArgumentsDone.kt | 8 + .../realtime/ResponseMcpCallCompleted.kt | 8 + .../models/realtime/ResponseMcpCallFailed.kt | 8 + .../realtime/ResponseMcpCallInProgress.kt | 8 + .../realtime/ResponseOutputItemAddedEvent.kt | 8 + .../realtime/ResponseOutputItemDoneEvent.kt | 8 + .../models/realtime/ResponseTextDeltaEvent.kt | 8 + .../models/realtime/ResponseTextDoneEvent.kt | 8 + .../models/realtime/SessionCreatedEvent.kt | 46 ++ .../models/realtime/SessionUpdateEvent.kt | 46 ++ .../models/realtime/SessionUpdatedEvent.kt | 46 ++ .../realtime/TranscriptionSessionUpdate.kt | 67 ++ .../TranscriptionSessionUpdatedEvent.kt | 47 ++ .../models/realtime/calls/CallReferParams.kt | 9 + .../models/realtime/calls/CallRejectParams.kt | 9 + .../clientsecrets/ClientSecretCreateParams.kt | 66 ++ .../ClientSecretCreateResponse.kt | 46 ++ .../RealtimeSessionClientSecret.kt | 8 + .../RealtimeSessionCreateResponse.kt | 476 ++++++++++++ ...ltimeTranscriptionSessionCreateResponse.kt | 46 ++ ...altimeTranscriptionSessionTurnDetection.kt | 8 + .../openai/models/responses/ApplyPatchTool.kt | 8 + .../models/responses/CompactedResponse.kt | 8 + .../openai/models/responses/ComputerAction.kt | 120 +++ .../openai/models/responses/ComputerTool.kt | 8 + .../responses/ComputerUsePreviewTool.kt | 17 + .../openai/models/responses/ContainerAuto.kt | 93 +++ .../ContainerNetworkPolicyAllowlist.kt | 8 + .../ContainerNetworkPolicyDisabled.kt | 8 + .../ContainerNetworkPolicyDomainSecret.kt | 8 + .../models/responses/ContainerReference.kt | 8 + .../com/openai/models/responses/CustomTool.kt | 8 + .../models/responses/EasyInputMessage.kt | 73 ++ .../openai/models/responses/FileSearchTool.kt | 75 ++ .../models/responses/FunctionShellTool.kt | 46 ++ .../openai/models/responses/FunctionTool.kt | 17 + .../openai/models/responses/InlineSkill.kt | 8 + .../models/responses/InlineSkillSource.kt | 8 + .../models/responses/LocalEnvironment.kt | 8 + .../com/openai/models/responses/LocalSkill.kt | 8 + .../openai/models/responses/NamespaceTool.kt | 56 ++ .../com/openai/models/responses/Response.kt | 148 ++++ .../responses/ResponseApplyPatchToolCall.kt | 85 +++ .../ResponseApplyPatchToolCallOutput.kt | 17 + .../responses/ResponseAudioDeltaEvent.kt | 8 + .../responses/ResponseAudioDoneEvent.kt | 8 + .../ResponseAudioTranscriptDeltaEvent.kt | 8 + .../ResponseAudioTranscriptDoneEvent.kt | 8 + ...sponseCodeInterpreterCallCodeDeltaEvent.kt | 8 + ...esponseCodeInterpreterCallCodeDoneEvent.kt | 8 + ...sponseCodeInterpreterCallCompletedEvent.kt | 8 + ...ponseCodeInterpreterCallInProgressEvent.kt | 8 + ...nseCodeInterpreterCallInterpretingEvent.kt | 8 + .../ResponseCodeInterpreterToolCall.kt | 75 ++ .../models/responses/ResponseCompactParams.kt | 65 ++ .../responses/ResponseCompactionItem.kt | 8 + .../responses/ResponseCompactionItemParam.kt | 8 + .../responses/ResponseCompletedEvent.kt | 8 + .../responses/ResponseComputerToolCall.kt | 163 ++++ .../ResponseComputerToolCallOutputItem.kt | 26 + ...esponseComputerToolCallOutputScreenshot.kt | 8 + .../responses/ResponseContainerReference.kt | 8 + .../models/responses/ResponseContent.kt | 46 ++ .../ResponseContentPartAddedEvent.kt | 56 ++ .../responses/ResponseContentPartDoneEvent.kt | 56 ++ .../responses/ResponseConversationParam.kt | 8 + .../models/responses/ResponseCreateParams.kt | 177 +++++ .../models/responses/ResponseCreatedEvent.kt | 8 + .../responses/ResponseCustomToolCall.kt | 8 + .../ResponseCustomToolCallInputDeltaEvent.kt | 8 + .../ResponseCustomToolCallInputDoneEvent.kt | 8 + .../responses/ResponseCustomToolCallItem.kt | 17 + .../responses/ResponseCustomToolCallOutput.kt | 86 +++ .../ResponseCustomToolCallOutputItem.kt | 17 + .../openai/models/responses/ResponseError.kt | 17 + .../models/responses/ResponseErrorEvent.kt | 8 + .../models/responses/ResponseFailedEvent.kt | 8 + .../ResponseFileSearchCallCompletedEvent.kt | 8 + .../ResponseFileSearchCallInProgressEvent.kt | 8 + .../ResponseFileSearchCallSearchingEvent.kt | 8 + .../responses/ResponseFileSearchToolCall.kt | 36 + .../responses/ResponseFormatTextConfig.kt | 37 + .../ResponseFormatTextJsonSchemaConfig.kt | 17 + ...ResponseFunctionCallArgumentsDeltaEvent.kt | 8 + .../ResponseFunctionCallArgumentsDoneEvent.kt | 8 + .../ResponseFunctionCallOutputItem.kt | 37 + .../ResponseFunctionShellCallOutputContent.kt | 56 ++ .../ResponseFunctionShellToolCall.kt | 64 ++ .../ResponseFunctionShellToolCallOutput.kt | 76 ++ .../responses/ResponseFunctionToolCall.kt | 17 + .../responses/ResponseFunctionToolCallItem.kt | 17 + .../ResponseFunctionToolCallOutputItem.kt | 95 +++ .../responses/ResponseFunctionWebSearch.kt | 95 +++ .../ResponseImageGenCallCompletedEvent.kt | 8 + .../ResponseImageGenCallGeneratingEvent.kt | 8 + .../ResponseImageGenCallInProgressEvent.kt | 8 + .../ResponseImageGenCallPartialImageEvent.kt | 8 + .../responses/ResponseInProgressEvent.kt | 8 + .../models/responses/ResponseIncludable.kt | 8 + .../responses/ResponseIncompleteEvent.kt | 8 + .../models/responses/ResponseInputAudio.kt | 27 + .../models/responses/ResponseInputContent.kt | 37 + .../models/responses/ResponseInputFile.kt | 17 + .../responses/ResponseInputFileContent.kt | 17 + .../models/responses/ResponseInputImage.kt | 17 + .../responses/ResponseInputImageContent.kt | 17 + .../models/responses/ResponseInputItem.kt | 541 ++++++++++++++ .../responses/ResponseInputMessageItem.kt | 26 + .../models/responses/ResponseInputText.kt | 8 + .../responses/ResponseInputTextContent.kt | 8 + .../openai/models/responses/ResponseItem.kt | 170 +++++ .../responses/ResponseLocalEnvironment.kt | 8 + .../ResponseMcpCallArgumentsDeltaEvent.kt | 8 + .../ResponseMcpCallArgumentsDoneEvent.kt | 8 + .../ResponseMcpCallCompletedEvent.kt | 8 + .../responses/ResponseMcpCallFailedEvent.kt | 8 + .../ResponseMcpCallInProgressEvent.kt | 8 + .../ResponseMcpListToolsCompletedEvent.kt | 8 + .../ResponseMcpListToolsFailedEvent.kt | 8 + .../ResponseMcpListToolsInProgressEvent.kt | 8 + .../models/responses/ResponseOutputAudio.kt | 8 + .../models/responses/ResponseOutputItem.kt | 170 +++++ .../responses/ResponseOutputItemAddedEvent.kt | 8 + .../responses/ResponseOutputItemDoneEvent.kt | 8 + .../models/responses/ResponseOutputMessage.kt | 64 ++ .../models/responses/ResponseOutputRefusal.kt | 8 + .../models/responses/ResponseOutputText.kt | 105 +++ .../ResponseOutputTextAnnotationAddedEvent.kt | 8 + .../openai/models/responses/ResponsePrompt.kt | 17 + .../models/responses/ResponseQueuedEvent.kt | 8 + .../models/responses/ResponseReasoningItem.kt | 35 + .../ResponseReasoningSummaryPartAddedEvent.kt | 17 + .../ResponseReasoningSummaryPartDoneEvent.kt | 17 + .../ResponseReasoningSummaryTextDeltaEvent.kt | 8 + .../ResponseReasoningSummaryTextDoneEvent.kt | 8 + .../ResponseReasoningTextDeltaEvent.kt | 8 + .../ResponseReasoningTextDoneEvent.kt | 8 + .../responses/ResponseRefusalDeltaEvent.kt | 8 + .../responses/ResponseRefusalDoneEvent.kt | 8 + .../openai/models/responses/ResponseStatus.kt | 8 + .../models/responses/ResponseStreamEvent.kt | 37 + .../models/responses/ResponseTextConfig.kt | 17 + .../responses/ResponseTextDeltaEvent.kt | 27 + .../models/responses/ResponseTextDoneEvent.kt | 27 + .../responses/ResponseToolSearchCall.kt | 26 + .../responses/ResponseToolSearchOutputItem.kt | 26 + .../ResponseToolSearchOutputItemParam.kt | 26 + .../openai/models/responses/ResponseUsage.kt | 26 + .../ResponseWebSearchCallCompletedEvent.kt | 8 + .../ResponseWebSearchCallInProgressEvent.kt | 8 + .../ResponseWebSearchCallSearchingEvent.kt | 8 + .../models/responses/ResponsesClientEvent.kt | 176 +++++ .../models/responses/ResponsesServerEvent.kt | 37 + .../openai/models/responses/SkillReference.kt | 8 + .../com/openai/models/responses/Tool.kt | 405 ++++++++++ .../models/responses/ToolChoiceAllowed.kt | 26 + .../models/responses/ToolChoiceApplyPatch.kt | 8 + .../models/responses/ToolChoiceCustom.kt | 8 + .../models/responses/ToolChoiceFunction.kt | 8 + .../openai/models/responses/ToolChoiceMcp.kt | 8 + .../models/responses/ToolChoiceOptions.kt | 8 + .../models/responses/ToolChoiceShell.kt | 8 + .../models/responses/ToolChoiceTypes.kt | 17 + .../openai/models/responses/ToolSearchTool.kt | 17 + .../models/responses/WebSearchPreviewTool.kt | 44 ++ .../openai/models/responses/WebSearchTool.kt | 54 ++ .../inputitems/InputItemListParams.kt | 9 + .../responses/inputitems/ResponseItemList.kt | 8 + .../inputtokens/InputTokenCountParams.kt | 151 ++++ .../inputtokens/InputTokenCountResponse.kt | 8 + .../com/openai/models/skills/DeletedSkill.kt | 8 + .../kotlin/com/openai/models/skills/Skill.kt | 8 + .../openai/models/skills/SkillCreateParams.kt | 47 ++ .../com/openai/models/skills/SkillList.kt | 8 + .../openai/models/skills/SkillListParams.kt | 9 + .../openai/models/skills/SkillUpdateParams.kt | 9 + .../skills/versions/DeletedSkillVersion.kt | 8 + .../models/skills/versions/SkillVersion.kt | 8 + .../skills/versions/SkillVersionList.kt | 8 + .../skills/versions/VersionCreateParams.kt | 47 ++ .../skills/versions/VersionListParams.kt | 9 + .../com/openai/models/uploads/Upload.kt | 17 + .../models/uploads/UploadCompleteParams.kt | 9 + .../models/uploads/UploadCreateParams.kt | 18 + .../models/uploads/parts/PartCreateParams.kt | 9 + .../openai/models/uploads/parts/UploadPart.kt | 8 + .../AutoFileChunkingStrategyParam.kt | 8 + .../vectorstores/FileChunkingStrategy.kt | 37 + .../vectorstores/FileChunkingStrategyParam.kt | 37 + .../OtherFileChunkingStrategyObject.kt | 8 + .../StaticFileChunkingStrategy.kt | 8 + .../StaticFileChunkingStrategyObject.kt | 8 + .../StaticFileChunkingStrategyObjectParam.kt | 8 + .../openai/models/vectorstores/VectorStore.kt | 44 ++ .../vectorstores/VectorStoreCreateParams.kt | 27 + .../models/vectorstores/VectorStoreDeleted.kt | 8 + .../VectorStoreListPageResponse.kt | 8 + .../vectorstores/VectorStoreListParams.kt | 9 + .../VectorStoreSearchPageResponse.kt | 8 + .../vectorstores/VectorStoreSearchParams.kt | 104 +++ .../vectorstores/VectorStoreSearchResponse.kt | 36 + .../vectorstores/VectorStoreUpdateParams.kt | 27 + .../filebatches/FileBatchCreateParams.kt | 37 + .../FileBatchListFilesPageResponse.kt | 8 + .../filebatches/FileBatchListFilesParams.kt | 18 + .../filebatches/VectorStoreFileBatch.kt | 26 + .../files/FileContentPageResponse.kt | 8 + .../vectorstores/files/FileContentResponse.kt | 8 + .../vectorstores/files/FileCreateParams.kt | 18 + .../files/FileListPageResponse.kt | 8 + .../vectorstores/files/FileListParams.kt | 18 + .../vectorstores/files/FileUpdateParams.kt | 18 + .../vectorstores/files/VectorStoreFile.kt | 45 ++ .../files/VectorStoreFileDeleted.kt | 8 + .../models/videos/ImageInputReferenceParam.kt | 8 + .../kotlin/com/openai/models/videos/Video.kt | 17 + .../videos/VideoCreateCharacterParams.kt | 9 + .../videos/VideoCreateCharacterResponse.kt | 8 + .../openai/models/videos/VideoCreateError.kt | 8 + .../openai/models/videos/VideoCreateParams.kt | 47 ++ .../models/videos/VideoDeleteResponse.kt | 8 + .../videos/VideoDownloadContentParams.kt | 9 + .../openai/models/videos/VideoEditParams.kt | 57 ++ .../openai/models/videos/VideoExtendParams.kt | 57 ++ .../videos/VideoGetCharacterResponse.kt | 8 + .../models/videos/VideoListPageResponse.kt | 8 + .../openai/models/videos/VideoListParams.kt | 9 + .../com/openai/models/videos/VideoModel.kt | 8 + .../openai/models/videos/VideoRemixParams.kt | 9 + .../com/openai/models/videos/VideoSeconds.kt | 8 + .../com/openai/models/videos/VideoSize.kt | 8 + .../webhooks/BatchCancelledWebhookEvent.kt | 26 + .../webhooks/BatchCompletedWebhookEvent.kt | 26 + .../webhooks/BatchExpiredWebhookEvent.kt | 26 + .../webhooks/BatchFailedWebhookEvent.kt | 26 + .../webhooks/EvalRunCanceledWebhookEvent.kt | 26 + .../webhooks/EvalRunFailedWebhookEvent.kt | 26 + .../webhooks/EvalRunSucceededWebhookEvent.kt | 26 + .../FineTuningJobCancelledWebhookEvent.kt | 26 + .../FineTuningJobFailedWebhookEvent.kt | 26 + .../FineTuningJobSucceededWebhookEvent.kt | 26 + .../RealtimeCallIncomingWebhookEvent.kt | 36 + .../webhooks/ResponseCancelledWebhookEvent.kt | 26 + .../webhooks/ResponseCompletedWebhookEvent.kt | 26 + .../webhooks/ResponseFailedWebhookEvent.kt | 26 + .../ResponseIncompleteWebhookEvent.kt | 26 + .../models/webhooks/UnwrapWebhookEvent.kt | 37 + 786 files changed, 27859 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e80eae21..85783c2d6 100644 --- a/README.md +++ b/README.md @@ -1837,7 +1837,9 @@ In rare cases, the API may return a response that doesn't match the expected typ By default, the SDK will not throw an exception in this case. It will throw [`OpenAIInvalidDataException`](openai-java-core/src/main/kotlin/com/openai/errors/OpenAIInvalidDataException.kt) only if you directly access the property. -If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: +Validating the response is _not_ forwards compatible with new types from the API for existing fields. + +If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`: ```java import com.openai.models.chat.completions.ChatCompletion; 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 eca395985..b54580de4 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 @@ -233,6 +233,9 @@ class OpenAIOkHttpClient private constructor() { /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ 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 e3350fb77..4879818e1 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 @@ -233,6 +233,9 @@ class OpenAIOkHttpClientAsync private constructor() { /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ 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 ebacbca2f..af1bb5431 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 @@ -90,6 +90,9 @@ private constructor( /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for existing + * fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -301,6 +304,9 @@ private constructor( /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt b/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt index 1d97b7bba..bf5b28b09 100644 --- a/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt +++ b/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt @@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t private var responseValidation: Boolean? = null private var timeout: Timeout? = null + /** + * Whether to call `validate` on the response before returning it. + * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * + * Defaults to false, which means the shape of the response will not be validated upfront. + * Instead, validation will only occur for the parts of the response that are accessed. + */ fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt b/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt index 318a68e6e..60e555625 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt @@ -52,6 +52,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = allModels.accept(new AllModels.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -62,6 +91,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllModels = apply { if (validated) { return@apply @@ -380,6 +417,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsesOnlyModel = apply { if (validated) { return@apply 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 6ae3ba181..16bf07847 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 @@ -550,6 +550,14 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -509,6 +555,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -709,6 +764,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = comparisonFilterValueItem.accept(new ComparisonFilterValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -718,6 +803,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComparisonFilterValueItem = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt index 36e7ce715..84f7ce186 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt @@ -203,6 +203,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CompoundFilter = apply { if (validated) { return@apply @@ -266,6 +274,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = filter.accept(new Filter.Visitor>() { + * @Override + * public Optional visitComparison(ComparisonFilter comparison) { + * return Optional.of(comparison.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { comparison != null -> visitor.visitComparison(comparison) @@ -275,6 +312,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Filter = apply { if (validated) { return@apply @@ -510,6 +556,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt b/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt index 1f0d125dc..0d2d1170f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt @@ -56,6 +56,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = customToolInputFormat.accept(new CustomToolInputFormat.Visitor>() { + * @Override + * public Optional visitText(JsonValue text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -65,6 +94,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CustomToolInputFormat = apply { if (validated) { return@apply @@ -397,6 +434,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Grammar = apply { if (validated) { return@apply @@ -524,6 +570,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Syntax = apply { if (validated) { return@apply 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 88cf53223..14773f348 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 @@ -225,6 +225,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ErrorObject = apply { if (validated) { return@apply 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 e30b1e4de..8087c7d3e 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 @@ -274,6 +274,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionDefinition = apply { if (validated) { return@apply 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 cac22f8ff..02ac1b915 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 @@ -76,6 +76,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionParameters = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt b/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt index 704517d03..ba07f450f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt @@ -94,6 +94,14 @@ class OAuthErrorCode @JsonCreator private constructor(private val value: JsonFie private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OAuthErrorCode = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt b/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt index 685342fb2..224a76108 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Reasoning = apply { if (validated) { return@apply @@ -382,6 +390,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GenerateSummary = apply { if (validated) { return@apply @@ -520,6 +537,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Summary = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt b/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt index 183297e01..0bead0c0a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt @@ -131,6 +131,14 @@ class ReasoningEffort @JsonCreator private constructor(private val value: JsonFi private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReasoningEffort = apply { if (validated) { return@apply 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 a67417617..78df68e0a 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 @@ -117,6 +117,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatJsonObject = apply { if (validated) { return@apply 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 1c18860fd..be7db8d1c 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 @@ -174,6 +174,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatJsonSchema = apply { if (validated) { return@apply @@ -455,6 +463,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): JsonSchema = apply { if (validated) { return@apply @@ -553,6 +570,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply 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 cd8a35d81..b64967b33 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 @@ -113,6 +113,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatText = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt index 556dcb6c7..d40fd646b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt @@ -166,6 +166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatTextGrammar = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt index edfa99ea6..87116f2da 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt @@ -117,6 +117,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatTextPython = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt index ba197e098..cafdcc85e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt @@ -51,6 +51,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responsesModel.accept(new ResponsesModel.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -61,6 +90,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsesModel = apply { if (validated) { return@apply @@ -379,6 +416,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsesOnlyModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt index e6806ea5f..feb025044 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt @@ -345,6 +345,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AdminApiKey = apply { if (validated) { return@apply @@ -643,6 +651,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Owner = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt index 05770b2f4..f40398276 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt @@ -348,6 +348,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt index b8f53d7ce..c7acdc7ed 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt @@ -392,6 +392,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AdminApiKeyCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt index 24f6cc024..5524cbe80 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AdminApiKeyDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt index 3956d0699..e03698123 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt @@ -268,6 +268,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AdminApiKeyListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt index d60f3ee93..f5e5d5a5b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt @@ -304,6 +304,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt index 314f496d0..9e1d17adb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt @@ -270,6 +270,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuditLogListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt index e9ae6df46..ad4518903 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt @@ -981,6 +981,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EventType = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt index 69361e29a..851ac96ed 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt @@ -2166,6 +2166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuditLogListResponse = apply { if (validated) { return@apply @@ -2672,6 +2680,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -2871,6 +2888,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Actor = apply { if (validated) { return@apply @@ -3107,6 +3133,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKey = apply { if (validated) { return@apply @@ -3245,6 +3281,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ServiceAccount = apply { if (validated) { return@apply @@ -3381,6 +3427,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -3555,6 +3611,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): User = apply { if (validated) { return@apply @@ -3764,6 +3830,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply @@ -3929,6 +4005,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): User = apply { if (validated) { return@apply @@ -4088,6 +4174,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -4279,6 +4375,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKeyCreated = apply { if (validated) { return@apply @@ -4429,6 +4534,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -4590,6 +4705,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKeyDeleted = apply { if (validated) { return@apply @@ -4773,6 +4897,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKeyUpdated = apply { if (validated) { return@apply @@ -4924,6 +5057,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -5119,6 +5262,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateCreated = apply { if (validated) { return@apply @@ -5334,6 +5486,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDeleted = apply { if (validated) { return@apply @@ -5518,6 +5679,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateUpdated = apply { if (validated) { return@apply @@ -5687,6 +5857,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificatesActivated = apply { if (validated) { return@apply @@ -5847,6 +6026,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Certificate = apply { if (validated) { return@apply @@ -6034,6 +6223,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificatesDeactivated = apply { if (validated) { return@apply @@ -6194,6 +6392,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Certificate = apply { if (validated) { return@apply @@ -6396,6 +6604,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CheckpointPermissionCreated = apply { if (validated) { return@apply @@ -6572,6 +6789,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -6745,6 +6972,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CheckpointPermissionDeleted = apply { if (validated) { return@apply @@ -6907,6 +7143,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExternalKeyRegistered = apply { if (validated) { return@apply @@ -7051,6 +7296,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExternalKeyRemoved = apply { if (validated) { return@apply @@ -7224,6 +7478,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupCreated = apply { if (validated) { return@apply @@ -7359,6 +7622,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -7521,6 +7794,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupDeleted = apply { if (validated) { return@apply @@ -7703,6 +7985,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupUpdated = apply { if (validated) { return@apply @@ -7840,6 +8131,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -8004,6 +8305,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InviteAccepted = apply { if (validated) { return@apply @@ -8146,6 +8456,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InviteDeleted = apply { if (validated) { return@apply @@ -8319,6 +8638,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InviteSent = apply { if (validated) { return@apply @@ -8480,6 +8808,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -8669,6 +9007,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IpAllowlistConfigActivated = apply { if (validated) { return@apply @@ -8828,6 +9175,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Config = apply { if (validated) { return@apply @@ -9016,6 +9373,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IpAllowlistConfigDeactivated = apply { if (validated) { return@apply @@ -9175,6 +9541,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Config = apply { if (validated) { return@apply @@ -9425,6 +9801,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IpAllowlistCreated = apply { if (validated) { return@apply @@ -9663,6 +10048,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IpAllowlistDeleted = apply { if (validated) { return@apply @@ -9869,6 +10263,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IpAllowlistUpdated = apply { if (validated) { return@apply @@ -10056,6 +10459,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LoginFailed = apply { if (validated) { return@apply @@ -10246,6 +10658,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogoutFailed = apply { if (validated) { return@apply @@ -10436,6 +10857,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OrganizationUpdated = apply { if (validated) { return@apply @@ -10830,6 +11260,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -11058,6 +11498,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Project = apply { if (validated) { return@apply @@ -11204,6 +11653,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectArchived = apply { if (validated) { return@apply @@ -11378,6 +11836,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectCreated = apply { if (validated) { return@apply @@ -11539,6 +12006,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -11704,6 +12181,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectDeleted = apply { if (validated) { return@apply @@ -11887,6 +12373,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectUpdated = apply { if (validated) { return@apply @@ -12019,6 +12514,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -12183,6 +12688,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RateLimitDeleted = apply { if (validated) { return@apply @@ -12366,6 +12880,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RateLimitUpdated = apply { if (validated) { return@apply @@ -12724,6 +13247,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -13072,6 +13605,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleAssignmentCreated = apply { if (validated) { return@apply @@ -13395,6 +13937,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleAssignmentDeleted = apply { if (validated) { return@apply @@ -13723,6 +14274,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleCreated = apply { if (validated) { return@apply @@ -13881,6 +14441,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleted = apply { if (validated) { return@apply @@ -14063,6 +14632,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleUpdated = apply { if (validated) { return@apply @@ -14453,6 +15031,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -14645,6 +15233,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScimDisabled = apply { if (validated) { return@apply @@ -14786,6 +15383,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScimEnabled = apply { if (validated) { return@apply @@ -14961,6 +15567,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccountCreated = apply { if (validated) { return@apply @@ -15091,6 +15706,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -15254,6 +15879,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccountDeleted = apply { if (validated) { return@apply @@ -15439,6 +16073,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccountUpdated = apply { if (validated) { return@apply @@ -15571,6 +16214,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply @@ -15765,6 +16418,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserAdded = apply { if (validated) { return@apply @@ -15895,6 +16557,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -16055,6 +16727,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserDeleted = apply { if (validated) { return@apply @@ -16237,6 +16918,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserUpdated = apply { if (validated) { return@apply @@ -16369,6 +17059,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangesRequested = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt index 7a574e0b1..006b12dee 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt @@ -324,6 +324,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Certificate = apply { if (validated) { return@apply @@ -523,6 +531,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply @@ -677,6 +694,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt index ca98c0ad6..81f58e6f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt @@ -184,6 +184,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateActivatePageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt index 1a7cc6abd..3b57b19d6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt @@ -390,6 +390,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt index f0d91f36f..47d41c0ac 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt @@ -307,6 +307,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateActivateResponse = apply { if (validated) { return@apply @@ -479,6 +487,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt index dda207632..32ab58ff9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt @@ -429,6 +429,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt index c13084861..aee9f2cfc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt @@ -184,6 +184,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDeactivatePageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt index 195a18e06..553388411 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt @@ -390,6 +390,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt index 917395c3d..0ae4ac038 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt @@ -308,6 +308,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDeactivateResponse = apply { if (validated) { return@apply @@ -480,6 +488,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt index cf7d3b742..4604f242c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt @@ -162,6 +162,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt index dafd89652..0366b1741 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt index d81d05e88..ccbc9bfe6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt @@ -328,6 +328,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt index 3a6dcb2ca..2ae56e63c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt @@ -307,6 +307,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateListResponse = apply { if (validated) { return@apply @@ -479,6 +487,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt index 467927cc3..6b3aea914 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt @@ -302,6 +302,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt index e77f17499..9233c6ead 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt @@ -346,6 +346,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt index 1f28507e9..5f5422d00 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt @@ -271,6 +271,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Group = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt index 01667dfb3..3b9b41fdb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt @@ -355,6 +355,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt index 223501c99..93afb68f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt index ad0d18c06..ae556e625 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt @@ -251,6 +251,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt index b39f07dff..4ac584867 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt @@ -319,6 +319,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt index 15d80b70c..89b9cc424 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt @@ -374,6 +374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt index 05df311c0..7711fef7e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt @@ -237,6 +237,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupUpdateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt index 07936ac22..7a7ba11b9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt @@ -374,6 +374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt index 5ead2920b..b0efd3080 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt @@ -198,6 +198,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleCreateResponse = apply { if (validated) { return@apply @@ -491,6 +499,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Group = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt index 128301d61..5c9001a5b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt index be269f45d..6cac445a5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt @@ -255,6 +255,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt index febdba7cb..10b990602 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt @@ -327,6 +327,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt index 87de26d82..aabc3da55 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt @@ -559,6 +559,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListResponse = apply { if (validated) { return@apply @@ -664,6 +672,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreatedByUserObj = apply { if (validated) { return@apply @@ -764,6 +781,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt index 4c1029925..df7543043 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt @@ -202,6 +202,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OrganizationGroupUser = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt index 3695f7a9e..15fd6abd0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt @@ -374,6 +374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt index 4d2d6c61b..de4bc4a21 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt index b6edac4d9..4d47508a1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt index ff4d1fed1..6dca007e8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt @@ -255,6 +255,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt index 6675ca176..4829ecb9a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt @@ -333,6 +333,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt index df6608518..bf5923f77 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt @@ -443,6 +443,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Invite = apply { if (validated) { return@apply @@ -639,6 +647,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Project = apply { if (validated) { return@apply @@ -757,6 +774,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -902,6 +929,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1034,6 +1070,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt index 233c6c2be..aa78bf78b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt @@ -525,6 +525,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -666,6 +675,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -854,6 +872,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Project = apply { if (validated) { return@apply @@ -972,6 +999,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt index 42bf52f0b..691e88ce5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt @@ -189,6 +189,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InviteDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt index 0b0ae39c7..762af682d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt @@ -281,6 +281,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InviteListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt index 0601b646d..2bee5db8d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt @@ -350,6 +350,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Project = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt index b31b09680..4c75e2795 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt @@ -524,6 +524,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt index b1dddc616..5d26f8d20 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt @@ -268,6 +268,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt index c70c1668c..61e6f3f05 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt @@ -496,6 +496,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt index bb577842f..f5a22b9e9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKeyDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt index bae1d695b..9abbbc687 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt @@ -270,6 +270,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKeyListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt index 8be7f65ac..ad430525b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt @@ -347,6 +347,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectApiKey = apply { if (validated) { return@apply @@ -559,6 +567,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Owner = apply { if (validated) { return@apply @@ -821,6 +838,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccount = apply { if (validated) { return@apply @@ -967,6 +994,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1271,6 +1308,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): User = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt index e52aac909..59e1910f2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt @@ -185,6 +185,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateActivatePageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt index 6934f83ee..9b0b6f577 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt @@ -408,6 +408,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt index e0b7e03e1..e7761291b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt @@ -307,6 +307,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateActivateResponse = apply { if (validated) { return@apply @@ -479,6 +487,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt index 8d40b4603..937df49dc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt @@ -185,6 +185,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDeactivatePageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt index 9d628537d..22484edea 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt @@ -407,6 +407,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt index 1935f2435..37b912afc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt @@ -308,6 +308,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDeactivateResponse = apply { if (validated) { return@apply @@ -480,6 +488,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt index d0e836504..e501f84cb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt index b50dbcea1..6e1422a64 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt @@ -345,6 +345,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt index 0dd5347cf..ed4f1e593 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt @@ -307,6 +307,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateListResponse = apply { if (validated) { return@apply @@ -479,6 +487,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CertificateDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt index 122230a4e..ad942b84a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt @@ -440,6 +440,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt index bfae1911c..55f3fb9c9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt index e9c52bc89..c48ec1faf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt @@ -253,6 +253,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt index e85a33a87..4ef505c27 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt @@ -327,6 +327,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt index 78fd2c09f..d1ac52444 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt @@ -298,6 +298,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectGroup = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt index 326146afe..c303f0e5d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt @@ -385,6 +385,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt index d5ecbdc16..1b39b3703 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt @@ -198,6 +198,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleCreateResponse = apply { if (validated) { return@apply @@ -491,6 +499,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Group = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt index 1b93e5bdd..22cd6692f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt index 46dfad409..b03e38470 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt @@ -255,6 +255,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt index a7d8f2963..45873c8ee 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt @@ -349,6 +349,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt index f8fb98ad3..76aa79864 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt @@ -559,6 +559,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListResponse = apply { if (validated) { return@apply @@ -664,6 +672,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreatedByUserObj = apply { if (validated) { return@apply @@ -764,6 +781,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt index 39c659b14..bb94290e8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt @@ -457,6 +457,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectRateLimit = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt index e5503e989..826283c5b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt @@ -274,6 +274,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RateLimitListRateLimitsPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt index 0c047fa3b..28293716b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt @@ -765,6 +765,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt index 755267a53..0e822d193 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt @@ -544,6 +544,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt index cb8370fa7..3e84ac52d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt index 971c70203..ec64f0fe8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt @@ -253,6 +253,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt index 5b9d8f17b..bedf9e02c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt @@ -327,6 +327,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt index 954e38819..879a609b6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt @@ -549,6 +549,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt index 871deb288..9f70e6ac5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt @@ -264,6 +264,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectServiceAccount = apply { if (validated) { return@apply @@ -392,6 +400,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt index a54637ca6..193d76a08 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt @@ -376,6 +376,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt index 4e8ca7b66..abd593d58 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt @@ -284,6 +284,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccountCreateResponse = apply { if (validated) { return@apply @@ -571,6 +579,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApiKey = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt index 7c7198b05..62c43169d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt @@ -188,6 +188,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccountDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt index 30783d2ef..397924312 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt @@ -272,6 +272,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceAccountListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt index 160142210..01def33c1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt @@ -299,6 +299,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ProjectUser = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt index e753bfa69..fb9531778 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt @@ -509,6 +509,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt index 517cafc84..27b42c272 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt index 0e5ee9909..11f329ffd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt @@ -268,6 +268,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt index daa0151c0..8a7042bea 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt @@ -373,6 +373,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt index ff977cd02..43f3368dd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt @@ -385,6 +385,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt index f1c6b1451..0be3ef292 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt @@ -200,6 +200,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt index 2e6d906f4..1250dac58 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt index 14c00a585..32c1d8c5b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt @@ -255,6 +255,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt index 1cd29af26..ed56f72a2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt @@ -349,6 +349,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt index 13a30650a..096b63fec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt @@ -559,6 +559,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListResponse = apply { if (validated) { return@apply @@ -664,6 +672,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreatedByUserObj = apply { if (validated) { return@apply @@ -764,6 +781,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt index c3b6001fe..d03717dba 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt @@ -380,6 +380,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt index 6bb2ce7f7..dc070b962 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt @@ -523,6 +523,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt index 5360eeb0a..b92dd295a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt index 0c90ac8c0..8499fc26d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt @@ -252,6 +252,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt index 1feb32fda..5fdb0fa62 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt @@ -310,6 +310,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt index 6bab4882b..dae5bcc00 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt @@ -527,6 +527,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt index 12932b64b..a7e99598c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt @@ -509,6 +509,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -646,6 +655,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt index 5335640f4..73a640ce2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageAudioSpeechesResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt index 9237bcaf7..a338e3c8b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt @@ -510,6 +510,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -647,6 +656,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt index c2513c557..ae8b5f578 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt @@ -251,6 +251,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageAudioTranscriptionsResponse = apply { if (validated) { return@apply @@ -618,6 +626,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -783,6 +800,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -811,6 +858,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1923,6 +1980,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2417,6 +2484,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2887,6 +2964,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3440,6 +3527,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3917,6 +4014,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4387,6 +4494,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4683,6 +4800,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4957,6 +5084,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5305,6 +5442,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5491,6 +5638,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt index e672252be..be717480f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt @@ -435,6 +435,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -554,6 +563,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt index 61f3f7b76..96d7ee4a1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt @@ -252,6 +252,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageCodeInterpreterSessionsResponse = apply { if (validated) { return@apply @@ -619,6 +627,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -784,6 +801,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -812,6 +859,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1924,6 +1981,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2418,6 +2485,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2888,6 +2965,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3441,6 +3528,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3918,6 +4015,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4388,6 +4495,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4684,6 +4801,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4958,6 +5085,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5306,6 +5443,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5492,6 +5639,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt index b9ad2fb9f..8b262f689 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt @@ -536,6 +536,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -685,6 +694,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt index f7b054541..2ae786151 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageCompletionsResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsParams.kt index 744ade25d..58d8abf4f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsParams.kt @@ -440,6 +440,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -571,6 +580,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsResponse.kt index 185806862..06e624a71 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCostsResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageCostsResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsParams.kt index bd7a575d1..a18f8810f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsParams.kt @@ -509,6 +509,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -646,6 +655,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsResponse.kt index db87d1d63..b1f3e834d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageEmbeddingsResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageEmbeddingsResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesParams.kt index 6a154e60c..575a40f01 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesParams.kt @@ -565,6 +565,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -714,6 +723,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply @@ -857,6 +875,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply @@ -988,6 +1015,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Source = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesResponse.kt index 312c3fae0..b94eaeaae 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageImagesResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageImagesResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsParams.kt index 7e90d33e1..eddd66967 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsParams.kt @@ -509,6 +509,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -646,6 +655,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsResponse.kt index eea4fbfd7..6dfea4628 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageModerationsResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageModerationsResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresParams.kt index 73804ddb2..8d4ac6d7f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresParams.kt @@ -432,6 +432,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BucketWidth = apply { if (validated) { return@apply @@ -551,6 +560,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GroupBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresResponse.kt index c0aaf50b2..fc92b56ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageVectorStoresResponse.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageVectorStoresResponse = apply { if (validated) { return@apply @@ -615,6 +623,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -780,6 +797,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = result.accept(new Result.Visitor>() { + * @Override + * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) { + * return Optional.of(organizationUsageCompletions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { organizationUsageCompletions != null -> @@ -808,6 +855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1920,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCompletionsResult = apply { if (validated) { return@apply @@ -2414,6 +2481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageEmbeddingsResult = apply { if (validated) { return@apply @@ -2884,6 +2961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageModerationsResult = apply { if (validated) { return@apply @@ -3437,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageImagesResult = apply { if (validated) { return@apply @@ -3914,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioSpeechesResult = apply { if (validated) { return@apply @@ -4384,6 +4491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageAudioTranscriptionsResult = apply { if (validated) { return@apply @@ -4680,6 +4797,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageVectorStoresResult = apply { if (validated) { return@apply @@ -4954,6 +5081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply { if (validated) { return@apply @@ -5302,6 +5439,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OrganizationCostsResult = apply { if (validated) { return@apply @@ -5488,6 +5635,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Amount = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/OrganizationUser.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/OrganizationUser.kt index 57c77a5cf..f93cddd0b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/OrganizationUser.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/OrganizationUser.kt @@ -724,6 +724,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OrganizationUser = apply { if (validated) { return@apply @@ -942,6 +950,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Projects = apply { if (validated) { return@apply @@ -1138,6 +1155,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -1565,6 +1592,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): User = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserDeleteResponse.kt index cc5c73737..a9ee7965c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserDeleteResponse.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserListPageResponse.kt index 7d57674cb..8cfa6993a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserListPageResponse.kt @@ -270,6 +270,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserUpdateParams.kt index e1158617b..cf81ba4ce 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/UserUpdateParams.kt @@ -581,6 +581,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateParams.kt index aaff4a596..fb869b5b0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateParams.kt @@ -374,6 +374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateResponse.kt index 30e27da98..f41a17181 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleCreateResponse.kt @@ -200,6 +200,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleDeleteResponse.kt index f9a12fd30..685607c90 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleDeleteResponse.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListPageResponse.kt index c02544f71..df48519bc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListPageResponse.kt @@ -255,6 +255,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListParams.kt index 086f850d9..863d095c5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListParams.kt @@ -327,6 +327,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListResponse.kt index d7d00cd95..10c626e05 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/users/roles/RoleListResponse.kt @@ -559,6 +559,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RoleListResponse = apply { if (validated) { return@apply @@ -664,6 +672,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreatedByUserObj = apply { if (validated) { return@apply @@ -764,6 +781,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/AudioModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/AudioModel.kt index a666e028d..9426089e3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/AudioModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/AudioModel.kt @@ -110,6 +110,14 @@ class AudioModel @JsonCreator private constructor(private val value: JsonField = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = voice.accept(new Voice.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -997,6 +1035,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply @@ -1296,6 +1343,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnionMember1 = apply { if (validated) { return@apply @@ -1451,6 +1508,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Id = apply { if (validated) { return@apply @@ -1612,6 +1679,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply @@ -1744,6 +1820,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StreamFormat = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/speech/SpeechModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/speech/SpeechModel.kt index fb2a23044..23e963f56 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/speech/SpeechModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/speech/SpeechModel.kt @@ -104,6 +104,14 @@ class SpeechModel @JsonCreator private constructor(private val value: JsonField< private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SpeechModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/Transcription.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/Transcription.kt index c88c829f6..0a5c60f00 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/Transcription.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/Transcription.kt @@ -247,6 +247,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Transcription = apply { if (validated) { return@apply @@ -459,6 +467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprob = apply { if (validated) { return@apply @@ -540,6 +557,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = usage.accept(new Usage.Visitor>() { + * @Override + * public Optional visitTokens(Tokens tokens) { + * return Optional.of(tokens.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { tokens != null -> visitor.visitTokens(tokens) @@ -549,6 +595,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply @@ -976,6 +1031,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tokens = apply { if (validated) { return@apply @@ -1170,6 +1235,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputTokenDetails = apply { if (validated) { return@apply @@ -1406,6 +1481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Duration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParams.kt index 2efe394d5..37d96b18c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParams.kt @@ -1394,6 +1394,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1495,6 +1504,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chunkingStrategy.accept(new ChunkingStrategy.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1504,6 +1542,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChunkingStrategy = apply { if (validated) { return@apply @@ -1846,6 +1893,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VadConfig = apply { if (validated) { return@apply @@ -1953,6 +2010,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -2114,6 +2181,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TimestampGranularity = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateResponse.kt index e68d73158..a935a9a7d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateResponse.kt @@ -67,6 +67,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = transcriptionCreateResponse.accept(new TranscriptionCreateResponse.Visitor>() { + * @Override + * public Optional visitTranscription(Transcription transcription) { + * return Optional.of(transcription.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { transcription != null -> visitor.visitTranscription(transcription) @@ -77,6 +106,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarized.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarized.kt index 1f2dcbc68..f8a368ef3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarized.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarized.kt @@ -314,6 +314,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionDiarized = apply { if (validated) { return@apply @@ -380,6 +388,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = usage.accept(new Usage.Visitor>() { + * @Override + * public Optional visitTokens(Tokens tokens) { + * return Optional.of(tokens.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { tokens != null -> visitor.visitTokens(tokens) @@ -389,6 +426,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply @@ -816,6 +862,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tokens = apply { if (validated) { return@apply @@ -1010,6 +1066,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputTokenDetails = apply { if (validated) { return@apply @@ -1246,6 +1312,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Duration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarizedSegment.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarizedSegment.kt index 28eb420d9..f76d9f829 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarizedSegment.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionDiarizedSegment.kt @@ -301,6 +301,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionDiarizedSegment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionInclude.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionInclude.kt index 351d8191b..3d33c1321 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionInclude.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionInclude.kt @@ -90,6 +90,14 @@ class TranscriptionInclude @JsonCreator private constructor(private val value: J private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionInclude = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionSegment.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionSegment.kt index 146972834..6a6f2c45b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionSegment.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionSegment.kt @@ -490,6 +490,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionSegment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionStreamEvent.kt index 4a34a8d21..7a7ebf584 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionStreamEvent.kt @@ -96,6 +96,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = transcriptionStreamEvent.accept(new TranscriptionStreamEvent.Visitor>() { + * @Override + * public Optional visitTranscriptTextSegment(TranscriptionTextSegmentEvent transcriptTextSegment) { + * return Optional.of(transcriptTextSegment.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { transcriptTextSegment != null -> @@ -107,6 +136,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionStreamEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDeltaEvent.kt index 7c367169a..5273f10c8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDeltaEvent.kt @@ -262,6 +262,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionTextDeltaEvent = apply { if (validated) { return@apply @@ -478,6 +486,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprob = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDoneEvent.kt index 795b8190b..6af55660d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextDoneEvent.kt @@ -257,6 +257,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionTextDoneEvent = apply { if (validated) { return@apply @@ -473,6 +481,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprob = apply { if (validated) { return@apply @@ -799,6 +816,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply @@ -986,6 +1012,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputTokenDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextSegmentEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextSegmentEvent.kt index b1436e530..e723a65c3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextSegmentEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionTextSegmentEvent.kt @@ -301,6 +301,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionTextSegmentEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionVerbose.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionVerbose.kt index 86478afbc..46980eaf9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionVerbose.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionVerbose.kt @@ -330,6 +330,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionVerbose = apply { if (validated) { return@apply @@ -511,6 +519,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionWord.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionWord.kt index 4f0f84cd5..71afaddbe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionWord.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionWord.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionWord = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/Translation.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/Translation.kt index 246c67536..dbdd26240 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/Translation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/Translation.kt @@ -124,6 +124,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Translation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateParams.kt index 3f806de73..a136e1cd0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateParams.kt @@ -730,6 +730,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -888,6 +897,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateResponse.kt index 2cad0ebd7..f4f8e002e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateResponse.kt @@ -41,6 +41,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = translationCreateResponse.accept(new TranslationCreateResponse.Visitor>() { + * @Override + * public Optional visitTranslation(Translation translation) { + * return Optional.of(translation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { translation != null -> visitor.visitTranslation(translation) @@ -50,6 +79,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranslationCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationVerbose.kt b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationVerbose.kt index 431a97eb2..e6f41007c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationVerbose.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationVerbose.kt @@ -251,6 +251,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranslationVerbose = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/Batch.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/Batch.kt index 6b855904c..3d2c4c67f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/batches/Batch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/Batch.kt @@ -900,6 +900,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Batch = apply { if (validated) { return@apply @@ -1096,6 +1104,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1281,6 +1298,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Errors = apply { if (validated) { return@apply @@ -1395,6 +1421,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt index eabb949ec..0806260f7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt @@ -753,6 +753,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -907,6 +916,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CompletionWindow = apply { if (validated) { return@apply @@ -1075,6 +1093,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Endpoint = apply { if (validated) { return@apply @@ -1179,6 +1206,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1375,6 +1411,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputExpiresAfter = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchError.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchError.kt index 17b864ac5..db33d1f52 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchError.kt @@ -217,6 +217,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchListPageResponse.kt index aab947bfe..788c08cab 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchListPageResponse.kt @@ -262,6 +262,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchRequestCounts.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchRequestCounts.kt index 697fabbad..790860097 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchRequestCounts.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchRequestCounts.kt @@ -197,6 +197,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchRequestCounts = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchUsage.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchUsage.kt index 28176d096..d8f4bec54 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchUsage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchUsage.kt @@ -305,6 +305,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchUsage = apply { if (validated) { return@apply @@ -467,6 +475,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputTokensDetails = apply { if (validated) { return@apply @@ -636,6 +653,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputTokensDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/Assistant.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/Assistant.kt index becdbe0bb..3c4516f61 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/Assistant.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/Assistant.kt @@ -762,6 +762,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Assistant = apply { if (validated) { return@apply @@ -882,6 +890,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1067,6 +1084,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -1225,6 +1251,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -1402,6 +1438,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt index d7410edb8..0613798c1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt @@ -1498,6 +1498,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1654,6 +1663,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1839,6 +1857,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -1997,6 +2024,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -2235,6 +2272,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply @@ -2514,6 +2561,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): VectorStore = apply { if (validated) { return@apply @@ -2580,6 +2637,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not + * known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chunkingStrategy.accept(new ChunkingStrategy.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -2589,6 +2677,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ChunkingStrategy = apply { if (validated) { return@apply @@ -2906,6 +3004,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Static = apply { if (validated) { return@apply @@ -3136,6 +3244,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerStatic = apply { if (validated) { return@apply @@ -3282,6 +3400,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantDeleted.kt index f5fc11ebd..538c1cee7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListPageResponse.kt index dac2fc72b..95fe99372 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListPageResponse.kt @@ -265,6 +265,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListParams.kt index 1a1acfc2c..3a388753b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantListParams.kt @@ -352,6 +352,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantStreamEvent.kt index f8d6765b3..94747f623 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantStreamEvent.kt @@ -447,6 +447,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = assistantStreamEvent.accept(new AssistantStreamEvent.Visitor>() { + * @Override + * public Optional visitThreadCreated(ThreadCreated threadCreated) { + * return Optional.of(threadCreated.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { threadCreated != null -> visitor.visitThreadCreated(threadCreated) @@ -485,6 +514,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantStreamEvent = apply { if (validated) { return@apply @@ -1552,6 +1589,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadCreated = apply { if (validated) { return@apply @@ -1763,6 +1809,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCreated = apply { if (validated) { return@apply @@ -1969,6 +2024,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunQueued = apply { if (validated) { return@apply @@ -2175,6 +2239,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunInProgress = apply { if (validated) { return@apply @@ -2381,6 +2454,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunRequiresAction = apply { if (validated) { return@apply @@ -2586,6 +2668,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCompleted = apply { if (validated) { return@apply @@ -2792,6 +2883,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunIncomplete = apply { if (validated) { return@apply @@ -2995,6 +3095,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunFailed = apply { if (validated) { return@apply @@ -3201,6 +3310,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCancelling = apply { if (validated) { return@apply @@ -3406,6 +3524,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCancelled = apply { if (validated) { return@apply @@ -3609,6 +3736,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunExpired = apply { if (validated) { return@apply @@ -3811,6 +3947,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepCreated = apply { if (validated) { return@apply @@ -4014,6 +4159,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepInProgress = apply { if (validated) { return@apply @@ -4221,6 +4375,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepDelta = apply { if (validated) { return@apply @@ -4424,6 +4587,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepCompleted = apply { if (validated) { return@apply @@ -4626,6 +4798,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepFailed = apply { if (validated) { return@apply @@ -4829,6 +5010,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepCancelled = apply { if (validated) { return@apply @@ -5031,6 +5221,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepExpired = apply { if (validated) { return@apply @@ -5237,6 +5436,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageCreated = apply { if (validated) { return@apply @@ -5443,6 +5651,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageInProgress = apply { if (validated) { return@apply @@ -5647,6 +5864,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageDelta = apply { if (validated) { return@apply @@ -5853,6 +6079,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageCompleted = apply { if (validated) { return@apply @@ -6059,6 +6294,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageIncomplete = apply { if (validated) { return@apply @@ -6254,6 +6498,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ErrorEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantTool.kt index a9429e4bc..4f7c98368 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantTool.kt @@ -48,6 +48,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = assistantTool.accept(new AssistantTool.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -58,6 +87,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantUpdateParams.kt index 79536e6dd..93e6ecff9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantUpdateParams.kt @@ -1478,6 +1478,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1634,6 +1643,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2008,6 +2026,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -2190,6 +2217,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -2349,6 +2385,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -2526,6 +2572,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/CodeInterpreterTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/CodeInterpreterTool.kt index 49efcafd1..46765cc4d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/CodeInterpreterTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/CodeInterpreterTool.kt @@ -112,6 +112,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreterTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FileSearchTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FileSearchTool.kt index 5326e56e7..56275abfc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FileSearchTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FileSearchTool.kt @@ -152,6 +152,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearchTool = apply { if (validated) { return@apply @@ -358,6 +366,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply @@ -562,6 +579,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RankingOptions = apply { if (validated) { return@apply @@ -687,6 +714,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Ranker = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FunctionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FunctionTool.kt index 9b80bac25..759d28d9c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FunctionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/FunctionTool.kt @@ -166,6 +166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/MessageStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/MessageStreamEvent.kt index 29e2e73f5..b123466c2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/MessageStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/MessageStreamEvent.kt @@ -126,6 +126,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = messageStreamEvent.accept(new MessageStreamEvent.Visitor>() { + * @Override + * public Optional visitThreadMessageCreated(ThreadMessageCreated threadMessageCreated) { + * return Optional.of(threadMessageCreated.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { threadMessageCreated != null -> visitor.visitThreadMessageCreated(threadMessageCreated) @@ -141,6 +170,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageStreamEvent = apply { if (validated) { return@apply @@ -566,6 +603,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageCreated = apply { if (validated) { return@apply @@ -772,6 +818,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageInProgress = apply { if (validated) { return@apply @@ -976,6 +1031,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageDelta = apply { if (validated) { return@apply @@ -1182,6 +1246,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageCompleted = apply { if (validated) { return@apply @@ -1388,6 +1461,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadMessageIncomplete = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStepStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStepStreamEvent.kt index f8bed71d6..3ea6ed58e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStepStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStepStreamEvent.kt @@ -168,6 +168,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = runStepStreamEvent.accept(new RunStepStreamEvent.Visitor>() { + * @Override + * public Optional visitThreadRunStepCreated(ThreadRunStepCreated threadRunStepCreated) { + * return Optional.of(threadRunStepCreated.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { threadRunStepCreated != null -> visitor.visitThreadRunStepCreated(threadRunStepCreated) @@ -185,6 +214,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStepStreamEvent = apply { if (validated) { return@apply @@ -678,6 +715,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepCreated = apply { if (validated) { return@apply @@ -881,6 +927,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepInProgress = apply { if (validated) { return@apply @@ -1088,6 +1143,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepDelta = apply { if (validated) { return@apply @@ -1291,6 +1355,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepCompleted = apply { if (validated) { return@apply @@ -1493,6 +1566,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepFailed = apply { if (validated) { return@apply @@ -1696,6 +1778,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepCancelled = apply { if (validated) { return@apply @@ -1898,6 +1989,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunStepExpired = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStreamEvent.kt index 0bef42b96..01e48fb91 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/RunStreamEvent.kt @@ -184,6 +184,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = runStreamEvent.accept(new RunStreamEvent.Visitor>() { + * @Override + * public Optional visitThreadRunCreated(ThreadRunCreated threadRunCreated) { + * return Optional.of(threadRunCreated.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { threadRunCreated != null -> visitor.visitThreadRunCreated(threadRunCreated) @@ -202,6 +231,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStreamEvent = apply { if (validated) { return@apply @@ -763,6 +800,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCreated = apply { if (validated) { return@apply @@ -969,6 +1015,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunQueued = apply { if (validated) { return@apply @@ -1175,6 +1230,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunInProgress = apply { if (validated) { return@apply @@ -1381,6 +1445,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunRequiresAction = apply { if (validated) { return@apply @@ -1586,6 +1659,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCompleted = apply { if (validated) { return@apply @@ -1792,6 +1874,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunIncomplete = apply { if (validated) { return@apply @@ -1995,6 +2086,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunFailed = apply { if (validated) { return@apply @@ -2201,6 +2301,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCancelling = apply { if (validated) { return@apply @@ -2406,6 +2515,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunCancelled = apply { if (validated) { return@apply @@ -2609,6 +2727,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadRunExpired = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/ThreadStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/ThreadStreamEvent.kt index a412c8182..323d245e0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/ThreadStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/ThreadStreamEvent.kt @@ -202,6 +202,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadStreamEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt index 972434f9e..9ab97a831 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt @@ -256,6 +256,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitWorkflow = apply { if (validated) { return@apply @@ -350,6 +358,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StateVariables = apply { if (validated) { return@apply @@ -505,6 +522,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tracing = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCreateParams.kt index f5880fdae..12e66290f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCreateParams.kt @@ -678,6 +678,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitAttachment.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitAttachment.kt index 7ea32ab81..96f21daaf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitAttachment.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitAttachment.kt @@ -272,6 +272,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitAttachment = apply { if (validated) { return@apply @@ -394,6 +402,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitResponseOutputText.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitResponseOutputText.kt index 0a822a092..177d5de96 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitResponseOutputText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitResponseOutputText.kt @@ -257,6 +257,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitResponseOutputText = apply { if (validated) { return@apply @@ -319,6 +327,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = annotation.accept(new Annotation.Visitor>() { + * @Override + * public Optional visitFile(File file) { + * return Optional.of(file.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { file != null -> visitor.visitFile(file) @@ -328,6 +365,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Annotation = apply { if (validated) { return@apply @@ -616,6 +662,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): File = apply { if (validated) { return@apply @@ -807,6 +863,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1031,6 +1097,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Url = apply { if (validated) { return@apply @@ -1213,6 +1289,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThread.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThread.kt index e5e685039..d17446d42 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThread.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThread.kt @@ -349,6 +349,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitThread = apply { if (validated) { return@apply @@ -426,6 +434,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = status.accept(new Status.Visitor>() { + * @Override + * public Optional visitActive(JsonValue active) { + * return Optional.of(active.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { active != null -> visitor.visitActive(active) @@ -436,6 +473,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -759,6 +805,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Locked = apply { if (validated) { return@apply @@ -970,6 +1026,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Closed = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadAssistantMessageItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadAssistantMessageItem.kt index c04443860..22725278a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadAssistantMessageItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadAssistantMessageItem.kt @@ -319,6 +319,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitThreadAssistantMessageItem = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadItemList.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadItemList.kt index 54ff0c872..7f022f0d2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadItemList.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadItemList.kt @@ -324,6 +324,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitThreadItemList = apply { if (validated) { return@apply @@ -432,6 +440,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = data.accept(new Data.Visitor>() { + * @Override + * public Optional visitChatKitUserMessage(ChatKitThreadUserMessageItem chatkitUserMessage) { + * return Optional.of(chatkitUserMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatkitUserMessage != null -> visitor.visitChatKitUserMessage(chatkitUserMessage) @@ -447,6 +484,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -1174,6 +1220,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitClientToolCall = apply { if (validated) { return@apply @@ -1321,6 +1377,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1791,6 +1857,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitTask = apply { if (validated) { return@apply @@ -1934,6 +2010,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): TaskType = apply { if (validated) { return@apply @@ -2323,6 +2409,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitTaskGroup = apply { if (validated) { return@apply @@ -2575,6 +2671,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Task = apply { if (validated) { return@apply @@ -2701,6 +2807,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadUserMessageItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadUserMessageItem.kt index c761a8ae6..19c9b7d78 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadUserMessageItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitThreadUserMessageItem.kt @@ -462,6 +462,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitThreadUserMessageItem = apply { if (validated) { return@apply @@ -538,6 +546,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitInputText(InputText inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -547,6 +584,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -839,6 +885,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputText = apply { if (validated) { return@apply @@ -1044,6 +1100,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): QuotedText = apply { if (validated) { return@apply @@ -1263,6 +1329,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InferenceOptions = apply { if (validated) { return@apply @@ -1410,6 +1485,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitWidgetItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitWidgetItem.kt index 4c5fff24d..3e3290b75 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitWidgetItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatKitWidgetItem.kt @@ -294,6 +294,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatKitWidgetItem = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSession.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSession.kt index 5617c3253..9509651a1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSession.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSession.kt @@ -482,6 +482,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSession = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionAutomaticThreadTitling.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionAutomaticThreadTitling.kt index f738d438b..f64eb3bfe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionAutomaticThreadTitling.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionAutomaticThreadTitling.kt @@ -134,6 +134,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionAutomaticThreadTitling = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfiguration.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfiguration.kt index c3237097e..763c38765 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfiguration.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfiguration.kt @@ -222,6 +222,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionChatKitConfiguration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfigurationParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfigurationParam.kt index d0106f3d6..f6d97f1ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfigurationParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionChatKitConfigurationParam.kt @@ -214,6 +214,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionChatKitConfigurationParam = apply { if (validated) { return@apply @@ -349,6 +357,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AutomaticThreadTitling = apply { if (validated) { return@apply @@ -565,6 +582,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileUpload = apply { if (validated) { return@apply @@ -762,6 +788,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): History = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionExpiresAfterParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionExpiresAfterParam.kt index 38206ebba..85667dba2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionExpiresAfterParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionExpiresAfterParam.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionExpiresAfterParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionFileUpload.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionFileUpload.kt index 4b5996b59..0e48c1c99 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionFileUpload.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionFileUpload.kt @@ -222,6 +222,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionFileUpload = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionHistory.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionHistory.kt index 56eae92ef..5da3dcf69 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionHistory.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionHistory.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionHistory = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimits.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimits.kt index dec64882f..0c2d3afea 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimits.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimits.kt @@ -141,6 +141,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionRateLimits = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimitsParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimitsParam.kt index d399be01a..66566d87e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimitsParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionRateLimitsParam.kt @@ -126,6 +126,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionRateLimitsParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionStatus.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionStatus.kt index 933752012..2cd206074 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionStatus.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionStatus.kt @@ -102,6 +102,14 @@ class ChatSessionStatus @JsonCreator private constructor(private val value: Json private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionStatus = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionWorkflowParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionWorkflowParam.kt index 3eb2472be..e3bee01a3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionWorkflowParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ChatSessionWorkflowParam.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatSessionWorkflowParam = apply { if (validated) { return@apply @@ -337,6 +345,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StateVariables = apply { if (validated) { return@apply @@ -480,6 +497,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tracing = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadDeleteResponse.kt index 75c5e3de6..055094102 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadDeleteResponse.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListItemsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListItemsParams.kt index ebbeef984..99145fd74 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListItemsParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListItemsParams.kt @@ -337,6 +337,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListPageResponse.kt index 85ecab1d4..d6a827179 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListPageResponse.kt @@ -289,6 +289,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListParams.kt index d4f277f59..481ae56f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/threads/ThreadListParams.kt @@ -336,6 +336,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantResponseFormatOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantResponseFormatOption.kt index d89496131..9e9f99d7b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantResponseFormatOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantResponseFormatOption.kt @@ -105,6 +105,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = assistantResponseFormatOption.accept(new AssistantResponseFormatOption.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -118,6 +147,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantResponseFormatOption = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoice.kt index 7869a7635..203260a72 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoice.kt @@ -169,6 +169,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantToolChoice = apply { if (validated) { return@apply @@ -291,6 +299,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceFunction.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceFunction.kt index e041a6258..691226534 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceFunction.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceFunction.kt @@ -130,6 +130,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantToolChoiceFunction = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceOption.kt index 73b986113..e1ec817dc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/AssistantToolChoiceOption.kt @@ -66,6 +66,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = assistantToolChoiceOption.accept(new AssistantToolChoiceOption.Visitor>() { + * @Override + * public Optional visitAuto(Auto auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -75,6 +104,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssistantToolChoiceOption = apply { if (validated) { return@apply @@ -337,6 +374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Auto = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/Thread.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/Thread.kt index 60fc6d733..e0ed5140e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/Thread.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/Thread.kt @@ -304,6 +304,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Thread = apply { if (validated) { return@apply @@ -408,6 +416,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -593,6 +610,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -751,6 +777,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -928,6 +964,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt index 0202733b9..8d188c876 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt @@ -1926,6 +1926,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -2098,6 +2107,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2368,6 +2386,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Thread = apply { if (validated) { return@apply @@ -2687,6 +2714,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Message = apply { if (validated) { return@apply @@ -2758,6 +2795,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -2768,6 +2835,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -3036,6 +3113,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -3240,6 +3327,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Attachment = apply { if (validated) { return@apply @@ -3294,6 +3391,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not + * known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -3303,6 +3431,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -3553,6 +3691,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -3688,6 +3836,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -3878,6 +4036,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -4039,6 +4207,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -4278,6 +4456,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply @@ -4569,6 +4757,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): VectorStore = apply { if (validated) { return@apply @@ -4635,6 +4833,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chunkingStrategy.accept(new ChunkingStrategy.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -4644,6 +4873,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): ChunkingStrategy = apply { if (validated) { return@apply @@ -4973,6 +5212,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Static = apply { if (validated) { return@apply @@ -5210,6 +5459,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): InnerStatic = apply { if (validated) { return@apply @@ -5359,6 +5618,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -5634,6 +5903,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -5792,6 +6070,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -5969,6 +6257,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply @@ -6215,6 +6513,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TruncationStrategy = apply { if (validated) { return@apply @@ -6339,6 +6646,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt index d6f87f2b3..f8f7c2395 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt @@ -575,6 +575,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -902,6 +911,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Message = apply { if (validated) { return@apply @@ -973,6 +991,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -983,6 +1031,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1243,6 +1301,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1443,6 +1511,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attachment = apply { if (validated) { return@apply @@ -1497,6 +1575,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -1506,6 +1614,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -1750,6 +1868,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1880,6 +2008,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2065,6 +2202,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -2223,6 +2369,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -2461,6 +2617,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply @@ -2740,6 +2906,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): VectorStore = apply { if (validated) { return@apply @@ -2806,6 +2982,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not + * known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chunkingStrategy.accept(new ChunkingStrategy.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -2815,6 +3022,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ChunkingStrategy = apply { if (validated) { return@apply @@ -3132,6 +3349,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Static = apply { if (validated) { return@apply @@ -3362,6 +3589,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerStatic = apply { if (validated) { return@apply @@ -3508,6 +3745,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadDeleted.kt index 8914152cf..919dcd1d4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ThreadDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadUpdateParams.kt index 3be9ac6f0..5be2c82cf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadUpdateParams.kt @@ -475,6 +475,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -591,6 +600,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -776,6 +794,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolResources = apply { if (validated) { return@apply @@ -934,6 +961,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -1111,6 +1148,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Annotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Annotation.kt index bf4c31446..c8472d7ee 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Annotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Annotation.kt @@ -64,6 +64,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = annotation.accept(new Annotation.Visitor>() { + * @Override + * public Optional visitFileCitation(FileCitationAnnotation fileCitation) { + * return Optional.of(fileCitation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileCitation != null -> visitor.visitFileCitation(fileCitation) @@ -73,6 +102,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Annotation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/AnnotationDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/AnnotationDelta.kt index b68755eed..dc6886166 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/AnnotationDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/AnnotationDelta.kt @@ -64,6 +64,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = annotationDelta.accept(new AnnotationDelta.Visitor>() { + * @Override + * public Optional visitFileCitation(FileCitationDeltaAnnotation fileCitation) { + * return Optional.of(fileCitation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileCitation != null -> visitor.visitFileCitation(fileCitation) @@ -73,6 +102,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AnnotationDelta = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationAnnotation.kt index 05fdf9756..c221249a5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationAnnotation.kt @@ -265,6 +265,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCitationAnnotation = apply { if (validated) { return@apply @@ -416,6 +424,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCitation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationDeltaAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationDeltaAnnotation.kt index b4985847b..f51feb40a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationDeltaAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FileCitationDeltaAnnotation.kt @@ -291,6 +291,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCitationDeltaAnnotation = apply { if (validated) { return@apply @@ -461,6 +469,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCitation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathAnnotation.kt index d20dbea28..897043f5a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathAnnotation.kt @@ -258,6 +258,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FilePathAnnotation = apply { if (validated) { return@apply @@ -409,6 +417,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FilePath = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathDeltaAnnotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathDeltaAnnotation.kt index 08fc1ea69..ece6691d8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathDeltaAnnotation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/FilePathDeltaAnnotation.kt @@ -284,6 +284,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FilePathDeltaAnnotation = apply { if (validated) { return@apply @@ -422,6 +430,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FilePath = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFile.kt index 55db7d15d..326aaa7d5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFile.kt @@ -170,6 +170,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageFile = apply { if (validated) { return@apply @@ -294,6 +302,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileContentBlock.kt index a4a162e6f..619076507 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileContentBlock.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageFileContentBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDelta.kt index c01b77f3c..da1e05405 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDelta.kt @@ -155,6 +155,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageFileDelta = apply { if (validated) { return@apply @@ -279,6 +287,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDeltaBlock.kt index 7489a3cd5..224ec5067 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageFileDeltaBlock.kt @@ -201,6 +201,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageFileDeltaBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrl.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrl.kt index 118148b0d..072c88675 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrl.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageUrl = apply { if (validated) { return@apply @@ -291,6 +299,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlContentBlock.kt index 7d0e31e78..fe5fe025c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlContentBlock.kt @@ -162,6 +162,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageUrlContentBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDelta.kt index 39ad14169..e030074ff 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDelta.kt @@ -148,6 +148,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageUrlDelta = apply { if (validated) { return@apply @@ -272,6 +280,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDeltaBlock.kt index d664180c5..9723779d2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/ImageUrlDeltaBlock.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageUrlDeltaBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Message.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Message.kt index d571fe4a9..06b4194cb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Message.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Message.kt @@ -782,6 +782,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Message = apply { if (validated) { return@apply @@ -994,6 +1002,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attachment = apply { if (validated) { return@apply @@ -1051,6 +1068,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -1063,6 +1110,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -1371,6 +1428,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IncompleteDetails = apply { if (validated) { return@apply @@ -1506,6 +1572,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Reason = apply { if (validated) { return@apply @@ -1628,6 +1704,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1757,6 +1842,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1891,6 +1985,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContent.kt index e9119e6aa..101cbd8cc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContent.kt @@ -73,6 +73,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = messageContent.accept(new MessageContent.Visitor>() { + * @Override + * public Optional visitImageFile(ImageFileContentBlock imageFile) { + * return Optional.of(imageFile.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { imageFile != null -> visitor.visitImageFile(imageFile) @@ -84,6 +113,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageContent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentDelta.kt index 13bc49cf5..a7b3113c2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentDelta.kt @@ -73,6 +73,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = messageContentDelta.accept(new MessageContentDelta.Visitor>() { + * @Override + * public Optional visitImageFile(ImageFileDeltaBlock imageFile) { + * return Optional.of(imageFile.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { imageFile != null -> visitor.visitImageFile(imageFile) @@ -84,6 +113,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageContentDelta = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentPartParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentPartParam.kt index 2b556b4a0..4890698c4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentPartParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageContentPartParam.kt @@ -64,6 +64,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = messageContentPartParam.accept(new MessageContentPartParam.Visitor>() { + * @Override + * public Optional visitImageFile(ImageFileContentBlock imageFile) { + * return Optional.of(imageFile.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { imageFile != null -> visitor.visitImageFile(imageFile) @@ -74,6 +103,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageContentPartParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageCreateParams.kt index 65fa37483..5f762e00a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageCreateParams.kt @@ -684,6 +684,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -778,6 +787,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -787,6 +825,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1040,6 +1087,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1233,6 +1289,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attachment = apply { if (validated) { return@apply @@ -1287,6 +1352,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -1296,6 +1391,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -1532,6 +1637,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeleted.kt index fe6e2a711..cd6b51e72 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDelta.kt index 3e348fe6d..7415b75fa 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDelta.kt @@ -229,6 +229,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageDelta = apply { if (validated) { return@apply @@ -345,6 +353,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeltaEvent.kt index bff6c5528..ebbe83b72 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageDeltaEvent.kt @@ -198,6 +198,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListPageResponse.kt index c37c51beb..bffca9945 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListPageResponse.kt @@ -265,6 +265,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListParams.kt index 602b26f1a..476698863 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageListParams.kt @@ -383,6 +383,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageUpdateParams.kt index 7e9a11f12..1dc34892c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/MessageUpdateParams.kt @@ -402,6 +402,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -512,6 +521,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalContentBlock.kt index 7c5de4f4b..33406e5ca 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalContentBlock.kt @@ -160,6 +160,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RefusalContentBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalDeltaBlock.kt index 9f67ae7ba..36d3a7a65 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/RefusalDeltaBlock.kt @@ -192,6 +192,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RefusalDeltaBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Text.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Text.kt index c492dcc2a..39272754e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Text.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/Text.kt @@ -190,6 +190,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Text = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlock.kt index 9a0447dcc..262510ae7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlock.kt @@ -157,6 +157,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextContentBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlockParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlockParam.kt index bbcc3af1a..2e4168315 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlockParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextContentBlockParam.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextContentBlockParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDelta.kt index 37c89daa6..540824e98 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDelta.kt @@ -198,6 +198,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextDelta = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDeltaBlock.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDeltaBlock.kt index 1eca37381..49678d901 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDeltaBlock.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/messages/TextDeltaBlock.kt @@ -193,6 +193,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextDeltaBlock = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RequiredActionFunctionToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RequiredActionFunctionToolCall.kt index 324b1930f..06a0a86f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RequiredActionFunctionToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RequiredActionFunctionToolCall.kt @@ -208,6 +208,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RequiredActionFunctionToolCall = apply { if (validated) { return@apply @@ -395,6 +403,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/Run.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/Run.kt index 9849f0d19..b372cceb6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/Run.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/Run.kt @@ -1439,6 +1439,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Run = apply { if (validated) { return@apply @@ -1625,6 +1633,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IncompleteDetails = apply { if (validated) { return@apply @@ -1745,6 +1762,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Reason = apply { if (validated) { return@apply @@ -1952,6 +1979,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LastError = apply { if (validated) { return@apply @@ -2077,6 +2113,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Code = apply { if (validated) { return@apply @@ -2200,6 +2246,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2401,6 +2456,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RequiredAction = apply { if (validated) { return@apply @@ -2577,6 +2641,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SubmitToolOutputs = apply { if (validated) { return@apply @@ -2824,6 +2898,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TruncationStrategy = apply { if (validated) { return@apply @@ -2948,6 +3031,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -3212,6 +3305,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunCreateParams.kt index 883e9d743..e8e5d679f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunCreateParams.kt @@ -2174,6 +2174,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -2558,6 +2567,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AdditionalMessage = apply { if (validated) { return@apply @@ -2629,6 +2647,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -2639,6 +2687,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -2899,6 +2957,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -3099,6 +3167,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attachment = apply { if (validated) { return@apply @@ -3153,6 +3231,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -3162,6 +3270,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -3406,6 +3524,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -3536,6 +3664,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -3758,6 +3895,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TruncationStrategy = apply { if (validated) { return@apply @@ -3882,6 +4028,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListPageResponse.kt index 03d8eba21..78f78e893 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListPageResponse.kt @@ -262,6 +262,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListParams.kt index 6492316c5..1944ea092 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunListParams.kt @@ -369,6 +369,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunStatus.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunStatus.kt index c28c6584e..0bcacd483 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunStatus.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/RunStatus.kt @@ -138,6 +138,14 @@ class RunStatus @JsonCreator private constructor(private val value: JsonField = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = output.accept(new Output.Visitor>() { + * @Override + * public Optional visitLogs(LogsOutput logs) { + * return Optional.of(logs.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { logs != null -> visitor.visitLogs(logs) @@ -518,6 +565,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -809,6 +866,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): LogsOutput = apply { if (validated) { return@apply @@ -1013,6 +1080,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ImageOutput = apply { if (validated) { return@apply @@ -1176,6 +1253,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Image = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/CodeInterpreterToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/CodeInterpreterToolCallDelta.kt index 4df9b2964..44652ee9f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/CodeInterpreterToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/CodeInterpreterToolCallDelta.kt @@ -249,6 +249,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreterToolCallDelta = apply { if (validated) { return@apply @@ -470,6 +478,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -525,6 +542,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = output.accept(new Output.Visitor>() { + * @Override + * public Optional visitLogs(CodeInterpreterLogs logs) { + * return Optional.of(logs.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { logs != null -> visitor.visitLogs(logs) @@ -534,6 +581,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCall.kt index 81e2c3aad..09a526e8e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCall.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearchToolCall = apply { if (validated) { return@apply @@ -399,6 +407,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearch = apply { if (validated) { return@apply @@ -601,6 +618,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RankingOptions = apply { if (validated) { return@apply @@ -726,6 +753,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Ranker = apply { if (validated) { return@apply @@ -1038,6 +1075,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -1207,6 +1254,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1325,6 +1382,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCallDelta.kt index 36c1e94bc..64c05e59e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FileSearchToolCallDelta.kt @@ -214,6 +214,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearchToolCallDelta = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCall.kt index f6e9771c1..50d144806 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCall.kt @@ -198,6 +198,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionToolCall = apply { if (validated) { return@apply @@ -427,6 +435,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCallDelta.kt index 2a59c6f33..5698202da 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/FunctionToolCallDelta.kt @@ -227,6 +227,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionToolCallDelta = apply { if (validated) { return@apply @@ -435,6 +443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/MessageCreationStepDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/MessageCreationStepDetails.kt index 9b22b55b9..1db485140 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/MessageCreationStepDetails.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/MessageCreationStepDetails.kt @@ -169,6 +169,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageCreationStepDetails = apply { if (validated) { return@apply @@ -319,6 +327,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageCreation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStep.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStep.kt index ac122777b..48ad4a436 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStep.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStep.kt @@ -799,6 +799,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStep = apply { if (validated) { return@apply @@ -1010,6 +1018,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LastError = apply { if (validated) { return@apply @@ -1129,6 +1146,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Code = apply { if (validated) { return@apply @@ -1252,6 +1279,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1402,6 +1438,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1470,6 +1515,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = stepDetails.accept(new StepDetails.Visitor>() { + * @Override + * public Optional visitMessageCreation(MessageCreationStepDetails messageCreation) { + * return Optional.of(messageCreation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { messageCreation != null -> visitor.visitMessageCreation(messageCreation) @@ -1479,6 +1553,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StepDetails = apply { if (validated) { return@apply @@ -1713,6 +1796,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1958,6 +2050,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDelta.kt index 76c55b136..dd58c97c6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDelta.kt @@ -141,6 +141,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStepDelta = apply { if (validated) { return@apply @@ -196,6 +204,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = stepDetails.accept(new StepDetails.Visitor>() { + * @Override + * public Optional visitMessageCreation(RunStepDeltaMessageDelta messageCreation) { + * return Optional.of(messageCreation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { messageCreation != null -> visitor.visitMessageCreation(messageCreation) @@ -205,6 +242,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StepDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaEvent.kt index 7a4a07c87..53ab73b65 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaEvent.kt @@ -198,6 +198,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStepDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaMessageDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaMessageDelta.kt index 98234d42b..dad1a3e86 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaMessageDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepDeltaMessageDelta.kt @@ -152,6 +152,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStepDeltaMessageDelta = apply { if (validated) { return@apply @@ -285,6 +293,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageCreation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepInclude.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepInclude.kt index 451088fc4..6f25b7c53 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepInclude.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/RunStepInclude.kt @@ -92,6 +92,14 @@ class RunStepInclude @JsonCreator private constructor(private val value: JsonFie private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunStepInclude = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListPageResponse.kt index a8d80fe7a..3822683ac 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListPageResponse.kt @@ -265,6 +265,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StepListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListParams.kt index da4616564..997e7f31a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/StepListParams.kt @@ -433,6 +433,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCall.kt index c410289a6..a7dddbe6a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCall.kt @@ -51,6 +51,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolCall.accept(new ToolCall.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterToolCall codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -61,6 +90,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolCall = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDelta.kt index 82a738b79..05de8fdf2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDelta.kt @@ -53,6 +53,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolCallDelta.accept(new ToolCallDelta.Visitor>() { + * @Override + * public Optional visitCodeInterpreter(CodeInterpreterToolCallDelta codeInterpreter) { + * return Optional.of(codeInterpreter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter) @@ -63,6 +92,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolCallDelta = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDeltaObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDeltaObject.kt index 85c4593b5..f8f2d6d71 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDeltaObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallDeltaObject.kt @@ -211,6 +211,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolCallDeltaObject = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallsStepDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallsStepDetails.kt index c69ff8826..d27e03b85 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallsStepDetails.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/runs/steps/ToolCallsStepDetails.kt @@ -200,6 +200,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolCallsStepDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletion.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletion.kt index 25b34f489..8a1861eaa 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletion.kt @@ -446,6 +446,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletion = apply { if (validated) { return@apply @@ -736,6 +744,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Choice = apply { if (validated) { return@apply @@ -887,6 +904,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FinishReason = apply { if (validated) { return@apply @@ -1127,6 +1154,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprobs = apply { if (validated) { return@apply @@ -1323,6 +1360,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceTier = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedToolChoice.kt index 569efc119..5cea7098c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedToolChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedToolChoice.kt @@ -175,6 +175,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionAllowedToolChoice = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedTools.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedTools.kt index 03bb6b733..f47dfa0ed 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedTools.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAllowedTools.kt @@ -209,6 +209,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionAllowedTools = apply { if (validated) { return@apply @@ -331,6 +339,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mode = apply { if (validated) { return@apply @@ -428,6 +445,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAssistantMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAssistantMessageParam.kt index 725f75a89..2667584cd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAssistantMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAssistantMessageParam.kt @@ -411,6 +411,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionAssistantMessageParam = apply { if (validated) { return@apply @@ -569,6 +577,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Audio = apply { if (validated) { return@apply @@ -652,6 +669,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -661,6 +707,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -857,6 +912,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chatCompletionRequestAssistantMessageContentPart.accept(new ChatCompletionRequestAssistantMessageContentPart.Visitor>() { + * @Override + * public Optional visitText(ChatCompletionContentPartText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -866,6 +951,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionRequestAssistantMessageContentPart = apply { if (validated) { return@apply @@ -1216,6 +1311,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionCall = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudio.kt index b055d90d1..3bbd35ca3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudio.kt @@ -241,6 +241,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionAudio = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParam.kt index 94eec100d..306e53122 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParam.kt @@ -200,6 +200,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionAudioParam = apply { if (validated) { return@apply @@ -342,6 +350,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Format = apply { if (validated) { return@apply @@ -417,6 +434,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = voice.accept(new Voice.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -427,6 +473,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply @@ -726,6 +781,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnionMember1 = apply { if (validated) { return@apply @@ -881,6 +946,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Id = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionChunk.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionChunk.kt index aada9f9c5..599e172f8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionChunk.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionChunk.kt @@ -472,6 +472,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionChunk = apply { if (validated) { return@apply @@ -759,6 +767,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Choice = apply { if (validated) { return@apply @@ -1068,6 +1085,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Delta = apply { if (validated) { return@apply @@ -1257,6 +1284,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): FunctionCall = apply { if (validated) { return@apply @@ -1418,6 +1455,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1675,6 +1722,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ToolCall = apply { if (validated) { return@apply @@ -1860,6 +1917,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Function = apply { if (validated) { return@apply @@ -1999,6 +2066,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -2203,6 +2280,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FinishReason = apply { if (validated) { return@apply @@ -2443,6 +2530,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprobs = apply { if (validated) { return@apply @@ -2639,6 +2736,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceTier = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt index cff589e89..005dc662b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt @@ -78,6 +78,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chatCompletionContentPart.accept(new ChatCompletionContentPart.Visitor>() { + * @Override + * public Optional visitText(ChatCompletionContentPartText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -89,6 +118,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionContentPart = apply { if (validated) { return@apply @@ -430,6 +467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): File = apply { if (validated) { return@apply @@ -638,6 +684,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileObject = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt index 48e9efbb0..c784800b8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt @@ -166,6 +166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionContentPartImage = apply { if (validated) { return@apply @@ -346,6 +354,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageUrl = apply { if (validated) { return@apply @@ -476,6 +493,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt index dcf2a01c7..f7ed7b5d5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt @@ -171,6 +171,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionContentPartInputAudio = apply { if (validated) { return@apply @@ -353,6 +361,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudio = apply { if (validated) { return@apply @@ -474,6 +491,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Format = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartRefusal.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartRefusal.kt index c0055b8ff..fa4debe0f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartRefusal.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartRefusal.kt @@ -165,6 +165,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionContentPartRefusal = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt index 382c40ca5..276b4d0fe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt @@ -164,6 +164,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionContentPartText = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt index a972f9f37..b44b732a4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt @@ -4300,6 +4300,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -4539,6 +4548,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = functionCall.accept(new FunctionCall.Visitor>() { + * @Override + * public Optional visitMode(FunctionCallMode mode) { + * return Optional.of(mode.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mode != null -> visitor.visitMode(mode) @@ -4548,6 +4586,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionCall = apply { if (validated) { return@apply @@ -4812,6 +4859,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionCallMode = apply { if (validated) { return@apply @@ -5064,6 +5121,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply @@ -5184,6 +5250,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogitBias = apply { if (validated) { return@apply @@ -5291,6 +5366,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -5419,6 +5503,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Modality = apply { if (validated) { return@apply @@ -5555,6 +5648,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PromptCacheRetention = apply { if (validated) { return@apply @@ -5654,6 +5756,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseFormat.accept(new ResponseFormat.Visitor>() { + * @Override + * public Optional visitText(ResponseFormatText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -5664,6 +5795,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply @@ -5970,6 +6110,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceTier = apply { if (validated) { return@apply @@ -6037,6 +6186,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = stop.accept(new Stop.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -6046,6 +6224,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Stop = apply { if (validated) { return@apply @@ -6280,6 +6467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Verbosity = apply { if (validated) { return@apply @@ -6481,6 +6677,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebSearchOptions = apply { if (validated) { return@apply @@ -6615,6 +6820,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SearchContextSize = apply { if (validated) { return@apply @@ -6813,6 +7028,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserLocation = apply { if (validated) { return@apply @@ -7070,6 +7295,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Approximate = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCustomTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCustomTool.kt index bbc3e8ebd..667a733df 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCustomTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCustomTool.kt @@ -176,6 +176,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionCustomTool = apply { if (validated) { return@apply @@ -412,6 +420,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Custom = apply { if (validated) { return@apply @@ -471,6 +488,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = format.accept(new Format.Visitor>() { + * @Override + * public Optional visitText(JsonValue text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -480,6 +527,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Format = apply { if (validated) { return@apply @@ -782,6 +839,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Grammar = apply { if (validated) { return@apply @@ -984,6 +1051,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): InnerGrammar = apply { if (validated) { return@apply @@ -1111,6 +1188,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Syntax = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeleted.kt index e129b9ac7..48f00d035 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeleted.kt @@ -195,6 +195,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeveloperMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeveloperMessageParam.kt index 9db1c7567..c8641c322 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeveloperMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionDeveloperMessageParam.kt @@ -228,6 +228,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionDeveloperMessageParam = apply { if (validated) { return@apply @@ -298,6 +306,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -307,6 +344,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionCallOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionCallOption.kt index 7e480d8b6..defef2693 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionCallOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionCallOption.kt @@ -137,6 +137,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionFunctionCallOption = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionMessageParam.kt index f1455a2a5..846418cbc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionMessageParam.kt @@ -204,6 +204,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionFunctionMessageParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionTool.kt index c1fafc656..9803a0490 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionFunctionTool.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionFunctionTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListPageResponse.kt index a186241df..e8c69e144 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListPageResponse.kt @@ -284,6 +284,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListParams.kt index 302f3fa32..56c3d7ccd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionListParams.kt @@ -461,6 +461,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessage.kt index cdd540b6a..76b39ac91 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessage.kt @@ -432,6 +432,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionMessage = apply { if (validated) { return@apply @@ -629,6 +637,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Annotation = apply { if (validated) { return@apply @@ -896,6 +913,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UrlCitation = apply { if (validated) { return@apply @@ -1136,6 +1163,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionCall = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageCustomToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageCustomToolCall.kt index 28479a973..25e2c9045 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageCustomToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageCustomToolCall.kt @@ -201,6 +201,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionMessageCustomToolCall = apply { if (validated) { return@apply @@ -386,6 +394,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Custom = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt index e3fd2ac65..3ebf99940 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt @@ -203,6 +203,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionMessageFunctionToolCall = apply { if (validated) { return@apply @@ -414,6 +422,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageParam.kt index fa9e3e32f..d5e0848ba 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageParam.kt @@ -97,6 +97,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chatCompletionMessageParam.accept(new ChatCompletionMessageParam.Visitor>() { + * @Override + * public Optional visitDeveloper(ChatCompletionDeveloperMessageParam developer) { + * return Optional.of(developer.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { developer != null -> visitor.visitDeveloper(developer) @@ -110,6 +139,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionMessageParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageToolCall.kt index 7501fa591..522746b89 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageToolCall.kt @@ -46,6 +46,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chatCompletionMessageToolCall.accept(new ChatCompletionMessageToolCall.Visitor>() { + * @Override + * public Optional visitFunction(ChatCompletionMessageFunctionToolCall function) { + * return Optional.of(function.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { function != null -> visitor.visitFunction(function) @@ -55,6 +84,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionMessageToolCall = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionModality.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionModality.kt index 6d75b4cb7..35f7b889c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionModality.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionModality.kt @@ -97,6 +97,14 @@ private constructor(private val value: JsonField) : Enum { private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionModality = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoice.kt index 438292e7b..81a12f66e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoice.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionNamedToolChoice = apply { if (validated) { return@apply @@ -308,6 +316,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoiceCustom.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoiceCustom.kt index c1553c9db..e01706a57 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoiceCustom.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionNamedToolChoiceCustom.kt @@ -165,6 +165,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionNamedToolChoiceCustom = apply { if (validated) { return@apply @@ -310,6 +318,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Custom = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionPredictionContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionPredictionContent.kt index 09fa2bd01..52f5d2a96 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionPredictionContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionPredictionContent.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionPredictionContent = apply { if (validated) { return@apply @@ -275,6 +283,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -284,6 +321,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionRole.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionRole.kt index 30b47c14e..ac1ca0cd3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionRole.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionRole.kt @@ -121,6 +121,14 @@ class ChatCompletionRole @JsonCreator private constructor(private val value: Jso private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionRole = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessage.kt index 107150a02..50f2ed5e6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessage.kt @@ -559,6 +559,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionStoreMessage = apply { if (validated) { return@apply @@ -637,6 +645,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = contentPart.accept(new ContentPart.Visitor>() { + * @Override + * public Optional visitChatCompletionContentPartText(ChatCompletionContentPartText chatCompletionContentPartText) { + * return Optional.of(chatCompletionContentPartText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatCompletionContentPartText != null -> @@ -648,6 +685,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContentPart = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStreamOptions.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStreamOptions.kt index ac3bf9066..7bfde6e27 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStreamOptions.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionStreamOptions.kt @@ -193,6 +193,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionStreamOptions = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionSystemMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionSystemMessageParam.kt index 1b87abd09..bb871bb00 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionSystemMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionSystemMessageParam.kt @@ -227,6 +227,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionSystemMessageParam = apply { if (validated) { return@apply @@ -297,6 +305,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -306,6 +343,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTokenLogprob.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTokenLogprob.kt index aecc073ba..e7e33a39d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTokenLogprob.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTokenLogprob.kt @@ -284,6 +284,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionTokenLogprob = apply { if (validated) { return@apply @@ -529,6 +537,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TopLogprob = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTool.kt index 8a31caa71..6fd1a00b1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionTool.kt @@ -46,6 +46,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chatCompletionTool.accept(new ChatCompletionTool.Visitor>() { + * @Override + * public Optional visitFunction(ChatCompletionFunctionTool function) { + * return Optional.of(function.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { function != null -> visitor.visitFunction(function) @@ -55,6 +84,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolChoiceOption.kt index b35392952..2921ff310 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolChoiceOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolChoiceOption.kt @@ -97,6 +97,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = chatCompletionToolChoiceOption.accept(new ChatCompletionToolChoiceOption.Visitor>() { + * @Override + * public Optional visitAuto(Auto auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -109,6 +138,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionToolChoiceOption = apply { if (validated) { return@apply @@ -437,6 +474,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Auto = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt index 9331d62f4..7964135c4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt @@ -232,6 +232,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionToolMessageParam = apply { if (validated) { return@apply @@ -302,6 +310,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -311,6 +348,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUpdateParams.kt index ba81c82e4..674300252 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUpdateParams.kt @@ -411,6 +411,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -521,6 +530,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUserMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUserMessageParam.kt index 524dff634..6746c69b1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUserMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionUserMessageParam.kt @@ -223,6 +223,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatCompletionUserMessageParam = apply { if (validated) { return@apply @@ -295,6 +303,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -304,6 +341,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponse.kt index 34e4234b6..600edb9c9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponse.kt @@ -285,6 +285,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MessageListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListParams.kt index c4924203e..c61578b6a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/messages/MessageListParams.kt @@ -333,6 +333,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/completions/Completion.kt b/openai-java-core/src/main/kotlin/com/openai/models/completions/Completion.kt index 9d116cea8..69e3ad9b0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/completions/Completion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/completions/Completion.kt @@ -368,6 +368,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Completion = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionChoice.kt index e7c5ca159..7ced7613b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionChoice.kt @@ -244,6 +244,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CompletionChoice = apply { if (validated) { return@apply @@ -378,6 +386,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FinishReason = apply { if (validated) { return@apply @@ -674,6 +691,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprobs = apply { if (validated) { return@apply @@ -768,6 +794,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TopLogprob = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionCreateParams.kt index 3bac4ec72..b44336ddd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionCreateParams.kt @@ -2027,6 +2027,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -2240,6 +2249,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -2324,6 +2342,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = prompt.accept(new Prompt.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -2335,6 +2382,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Prompt = apply { if (validated) { return@apply @@ -2581,6 +2637,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogitBias = apply { if (validated) { return@apply @@ -2651,6 +2716,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = stop.accept(new Stop.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -2660,6 +2754,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Stop = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionUsage.kt b/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionUsage.kt index 41c962210..7acabe460 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionUsage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/completions/CompletionUsage.kt @@ -306,6 +306,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CompletionUsage = apply { if (validated) { return@apply @@ -588,6 +596,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CompletionTokensDetails = apply { if (validated) { return@apply @@ -792,6 +809,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PromptTokensDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateParams.kt index 9cfad3130..148cab8ae 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateParams.kt @@ -827,6 +827,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1047,6 +1056,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -1162,6 +1180,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Anchor = apply { if (validated) { return@apply @@ -1322,6 +1350,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MemoryLimit = apply { if (validated) { return@apply @@ -1384,6 +1421,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = networkPolicy.accept(new NetworkPolicy.Visitor>() { + * @Override + * public Optional visitDisabled(ContainerNetworkPolicyDisabled disabled) { + * return Optional.of(disabled.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { disabled != null -> visitor.visitDisabled(disabled) @@ -1393,6 +1459,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NetworkPolicy = apply { if (validated) { return@apply @@ -1565,6 +1640,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = skill.accept(new Skill.Visitor>() { + * @Override + * public Optional visitReference(SkillReference reference) { + * return Optional.of(reference.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { reference != null -> visitor.visitReference(reference) @@ -1574,6 +1678,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Skill = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateResponse.kt index f55604448..507a850a3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerCreateResponse.kt @@ -434,6 +434,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerCreateResponse = apply { if (validated) { return@apply @@ -611,6 +619,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -726,6 +743,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Anchor = apply { if (validated) { return@apply @@ -886,6 +913,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MemoryLimit = apply { if (validated) { return@apply @@ -1093,6 +1129,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NetworkPolicy = apply { if (validated) { return@apply @@ -1212,6 +1257,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListPageResponse.kt index 85e9a8c77..0cb31d06c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListPageResponse.kt @@ -281,6 +281,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListParams.kt index a81fb2210..ca2c15b6d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListParams.kt @@ -342,6 +342,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListResponse.kt index e1b54962b..ac1065d61 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerListResponse.kt @@ -434,6 +434,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerListResponse = apply { if (validated) { return@apply @@ -611,6 +619,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -726,6 +743,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Anchor = apply { if (validated) { return@apply @@ -886,6 +913,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MemoryLimit = apply { if (validated) { return@apply @@ -1093,6 +1129,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NetworkPolicy = apply { if (validated) { return@apply @@ -1212,6 +1257,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerRetrieveResponse.kt index 9c05fc02d..8d34bd90f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/ContainerRetrieveResponse.kt @@ -434,6 +434,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerRetrieveResponse = apply { if (validated) { return@apply @@ -611,6 +619,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -726,6 +743,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Anchor = apply { if (validated) { return@apply @@ -886,6 +913,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MemoryLimit = apply { if (validated) { return@apply @@ -1093,6 +1129,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NetworkPolicy = apply { if (validated) { return@apply @@ -1212,6 +1257,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateParams.kt index 745c25afa..f3403d16b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateParams.kt @@ -426,6 +426,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateResponse.kt index 243b2b472..a499364b2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateResponse.kt @@ -332,6 +332,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListPageResponse.kt index 5980b196c..84ec340f9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListPageResponse.kt @@ -281,6 +281,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListParams.kt index 054617dcf..22fcc0cdd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListParams.kt @@ -345,6 +345,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListResponse.kt index 2b1e6da77..e4904b1cb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileListResponse.kt @@ -332,6 +332,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileListResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileRetrieveResponse.kt index 7077abba2..323a31ce7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileRetrieveResponse.kt @@ -332,6 +332,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileRetrieveResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt index 1db895140..3159c5a1b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComputerScreenshotContent = apply { if (validated) { return@apply @@ -382,6 +390,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/Conversation.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/Conversation.kt index cc6075c5c..392330370 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/Conversation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/Conversation.kt @@ -225,6 +225,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt index 408c0653a..c5f016f47 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt @@ -924,6 +924,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1038,6 +1047,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleted.kt index 3dd4ab476..fb11b97ca 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeletedResource.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeletedResource.kt index a4c5012db..d5b1e2df2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeletedResource.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeletedResource.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationDeletedResource = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt index 386e0cfea..22ef906d7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt @@ -408,6 +408,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -518,6 +527,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/Message.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/Message.kt index bd0496273..b6fdd1907 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/Message.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/Message.kt @@ -448,6 +448,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Message = apply { if (validated) { return@apply @@ -587,6 +595,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitInputText(ResponseInputText inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -603,6 +640,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1070,6 +1116,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReasoningText = apply { if (validated) { return@apply @@ -1250,6 +1306,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1385,6 +1450,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1516,6 +1590,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Phase = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/SummaryTextContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/SummaryTextContent.kt index caae797cb..fb96bc82e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/SummaryTextContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/SummaryTextContent.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SummaryTextContent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/TextContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/TextContent.kt index d1a1736bd..f5afcd35e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/TextContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/TextContent.kt @@ -154,6 +154,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextContent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt index edb3b96c8..dfa3cdf6c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt @@ -348,6 +348,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = conversationItem.accept(new ConversationItem.Visitor>() { + * @Override + * public Optional visitMessage(Message message) { + * return Optional.of(message.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { message != null -> visitor.visitMessage(message) @@ -380,6 +409,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItem = apply { if (validated) { return@apply @@ -1371,6 +1408,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenerationCall = apply { if (validated) { return@apply @@ -1512,6 +1558,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1824,6 +1880,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCall = apply { if (validated) { return@apply @@ -2199,6 +2264,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -2302,6 +2377,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Env = apply { if (validated) { return@apply @@ -2476,6 +2561,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -2756,6 +2851,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCallOutput = apply { if (validated) { return@apply @@ -2891,6 +2995,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3224,6 +3338,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListTools = apply { if (validated) { return@apply @@ -3474,6 +3597,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -3809,6 +3942,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalRequest = apply { if (validated) { return@apply @@ -4132,6 +4274,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalResponse = apply { if (validated) { return@apply @@ -4624,6 +4775,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpCall = apply { if (validated) { return@apply @@ -4784,6 +4944,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt index c8d4ee41f..b9cc66a6f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt @@ -430,6 +430,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemList = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt index 9f4c47777..ef58c910e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt @@ -903,6 +903,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemListParams.kt index fc7a780c9..7fd883572 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemListParams.kt @@ -397,6 +397,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/CreateEmbeddingResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/CreateEmbeddingResponse.kt index cea66c5a3..61f498e02 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/CreateEmbeddingResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/CreateEmbeddingResponse.kt @@ -246,6 +246,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreateEmbeddingResponse = apply { if (validated) { return@apply @@ -444,6 +452,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt index 89732240f..ff616ce31 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt @@ -257,6 +257,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Embedding = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt index 65c817d3d..d60d83d59 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt @@ -755,6 +755,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -870,6 +879,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -881,6 +919,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -1159,6 +1206,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EncodingFormat = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingModel.kt index 34c7ecc85..45fa23f08 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingModel.kt @@ -100,6 +100,14 @@ class EmbeddingModel @JsonCreator private constructor(private val value: JsonFie private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EmbeddingModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt index 3987a8bda..2ca46e6d7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt @@ -790,6 +790,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -906,6 +915,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSourceConfig.accept(new DataSourceConfig.Visitor>() { + * @Override + * public Optional visitCustom(Custom custom) { + * return Optional.of(custom.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { custom != null -> visitor.visitCustom(custom) @@ -916,6 +954,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSourceConfig = apply { if (validated) { return@apply @@ -1311,6 +1358,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Custom = apply { if (validated) { return@apply @@ -1408,6 +1465,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ItemSchema = apply { if (validated) { return@apply @@ -1614,6 +1681,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logs = apply { if (validated) { return@apply @@ -1709,6 +1786,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1913,6 +2000,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StoredCompletions = apply { if (validated) { return@apply @@ -2008,6 +2105,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2140,6 +2247,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = testingCriterion.accept(new TestingCriterion.Visitor>() { + * @Override + * public Optional visitLabelModel(LabelModel labelModel) { + * return Optional.of(labelModel.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { labelModel != null -> visitor.visitLabelModel(labelModel) @@ -2152,6 +2288,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TestingCriterion = apply { if (validated) { return@apply @@ -2735,6 +2880,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LabelModel = apply { if (validated) { return@apply @@ -2819,6 +2974,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitSimpleInputMessage(SimpleInputMessage simpleInputMessage) { + * return Optional.of(simpleInputMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { simpleInputMessage != null -> @@ -2829,6 +3014,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -3160,6 +3355,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): SimpleInputMessage = apply { if (validated) { return@apply @@ -3457,6 +3662,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -3568,6 +3783,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -3583,6 +3829,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -4023,6 +4279,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -4290,6 +4556,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -4462,6 +4738,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -4592,6 +4878,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -5010,6 +5306,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextSimilarity = apply { if (validated) { return@apply @@ -5357,6 +5663,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Python = apply { if (validated) { return@apply @@ -5806,6 +6122,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScoreModel = apply { if (validated) { return@apply @@ -5951,6 +6277,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateResponse.kt index d76a9720b..fab8eb4cf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateResponse.kt @@ -498,6 +498,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalCreateResponse = apply { if (validated) { return@apply @@ -601,6 +609,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSourceConfig.accept(new DataSourceConfig.Visitor>() { + * @Override + * public Optional visitCustom(EvalCustomDataSourceConfig custom) { + * return Optional.of(custom.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { custom != null -> visitor.visitCustom(custom) @@ -611,6 +648,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSourceConfig = apply { if (validated) { return@apply @@ -1023,6 +1069,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logs = apply { if (validated) { return@apply @@ -1123,6 +1179,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -1235,6 +1301,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1367,6 +1443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1483,6 +1568,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = testingCriterion.accept(new TestingCriterion.Visitor>() { + * @Override + * public Optional visitLabelModelGrader(LabelModelGrader labelModelGrader) { + * return Optional.of(labelModelGrader.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { labelModelGrader != null -> visitor.visitLabelModelGrader(labelModelGrader) @@ -1497,6 +1611,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TestingCriterion = apply { if (validated) { return@apply @@ -2077,6 +2200,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderTextSimilarity = apply { if (validated) { return@apply @@ -2424,6 +2557,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderPython = apply { if (validated) { return@apply @@ -2873,6 +3016,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderScoreModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCustomDataSourceConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCustomDataSourceConfig.kt index 0f1384894..903c4c797 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCustomDataSourceConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCustomDataSourceConfig.kt @@ -174,6 +174,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalCustomDataSourceConfig = apply { if (validated) { return@apply @@ -268,6 +276,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalDeleteResponse.kt index 3594faa12..d50d6da4d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalDeleteResponse.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListPageResponse.kt index 46c6ff8ce..2b357d021 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListPageResponse.kt @@ -282,6 +282,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListParams.kt index 1b4ee0ec7..2d5abef5f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListParams.kt @@ -333,6 +333,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply @@ -462,6 +471,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OrderBy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListResponse.kt index 49f7c34e7..27f57f2e6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalListResponse.kt @@ -498,6 +498,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalListResponse = apply { if (validated) { return@apply @@ -601,6 +609,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSourceConfig.accept(new DataSourceConfig.Visitor>() { + * @Override + * public Optional visitCustom(EvalCustomDataSourceConfig custom) { + * return Optional.of(custom.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { custom != null -> visitor.visitCustom(custom) @@ -611,6 +648,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSourceConfig = apply { if (validated) { return@apply @@ -1023,6 +1069,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logs = apply { if (validated) { return@apply @@ -1123,6 +1179,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -1235,6 +1301,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1367,6 +1443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1483,6 +1568,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = testingCriterion.accept(new TestingCriterion.Visitor>() { + * @Override + * public Optional visitLabelModelGrader(LabelModelGrader labelModelGrader) { + * return Optional.of(labelModelGrader.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { labelModelGrader != null -> visitor.visitLabelModelGrader(labelModelGrader) @@ -1497,6 +1611,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TestingCriterion = apply { if (validated) { return@apply @@ -2077,6 +2200,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderTextSimilarity = apply { if (validated) { return@apply @@ -2424,6 +2557,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderPython = apply { if (validated) { return@apply @@ -2873,6 +3016,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderScoreModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalRetrieveResponse.kt index 2f89b702c..a611ed335 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalRetrieveResponse.kt @@ -498,6 +498,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalRetrieveResponse = apply { if (validated) { return@apply @@ -601,6 +609,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSourceConfig.accept(new DataSourceConfig.Visitor>() { + * @Override + * public Optional visitCustom(EvalCustomDataSourceConfig custom) { + * return Optional.of(custom.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { custom != null -> visitor.visitCustom(custom) @@ -611,6 +648,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSourceConfig = apply { if (validated) { return@apply @@ -1023,6 +1069,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logs = apply { if (validated) { return@apply @@ -1123,6 +1179,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -1235,6 +1301,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1367,6 +1443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1483,6 +1568,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = testingCriterion.accept(new TestingCriterion.Visitor>() { + * @Override + * public Optional visitLabelModelGrader(LabelModelGrader labelModelGrader) { + * return Optional.of(labelModelGrader.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { labelModelGrader != null -> visitor.visitLabelModelGrader(labelModelGrader) @@ -1497,6 +1611,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TestingCriterion = apply { if (validated) { return@apply @@ -2077,6 +2200,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderTextSimilarity = apply { if (validated) { return@apply @@ -2424,6 +2557,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderPython = apply { if (validated) { return@apply @@ -2873,6 +3016,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderScoreModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalStoredCompletionsDataSourceConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalStoredCompletionsDataSourceConfig.kt index 7132027fb..3bd3b0823 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalStoredCompletionsDataSourceConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalStoredCompletionsDataSourceConfig.kt @@ -222,6 +222,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalStoredCompletionsDataSourceConfig = apply { if (validated) { return@apply @@ -318,6 +326,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -425,6 +442,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateParams.kt index 21dd04055..c46215444 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateParams.kt @@ -437,6 +437,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -551,6 +560,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateResponse.kt index afd92d5f7..4fa25596f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalUpdateResponse.kt @@ -498,6 +498,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalUpdateResponse = apply { if (validated) { return@apply @@ -601,6 +609,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSourceConfig.accept(new DataSourceConfig.Visitor>() { + * @Override + * public Optional visitCustom(EvalCustomDataSourceConfig custom) { + * return Optional.of(custom.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { custom != null -> visitor.visitCustom(custom) @@ -611,6 +648,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSourceConfig = apply { if (validated) { return@apply @@ -1023,6 +1069,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logs = apply { if (validated) { return@apply @@ -1123,6 +1179,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -1235,6 +1301,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1367,6 +1443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1483,6 +1568,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = testingCriterion.accept(new TestingCriterion.Visitor>() { + * @Override + * public Optional visitLabelModelGrader(LabelModelGrader labelModelGrader) { + * return Optional.of(labelModelGrader.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { labelModelGrader != null -> visitor.visitLabelModelGrader(labelModelGrader) @@ -1497,6 +1611,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TestingCriterion = apply { if (validated) { return@apply @@ -2077,6 +2200,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderTextSimilarity = apply { if (validated) { return@apply @@ -2424,6 +2557,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderPython = apply { if (validated) { return@apply @@ -2873,6 +3016,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalGraderScoreModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt index ea9b67b58..1af34990e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt @@ -368,6 +368,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreateEvalCompletionsRunDataSource = apply { if (validated) { return@apply @@ -437,6 +445,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -447,6 +484,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -775,6 +821,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -958,6 +1014,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1049,6 +1115,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -1154,6 +1230,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -1385,6 +1471,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply @@ -1776,6 +1872,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StoredCompletions = apply { if (validated) { return@apply @@ -1886,6 +1992,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2045,6 +2161,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -2111,6 +2236,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputMessages.accept(new InputMessages.Visitor>() { + * @Override + * public Optional visitTemplate(Template template) { + * return Optional.of(template.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { template != null -> visitor.visitTemplate(template) @@ -2120,6 +2274,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputMessages = apply { if (validated) { return@apply @@ -2445,6 +2608,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Template = apply { if (validated) { return@apply @@ -2537,6 +2710,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = innerTemplate.accept(new InnerTemplate.Visitor>() { + * @Override + * public Optional visitEasyInputMessage(EasyInputMessage easyInputMessage) { + * return Optional.of(easyInputMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { easyInputMessage != null -> visitor.visitEasyInputMessage(easyInputMessage) @@ -2546,6 +2749,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InnerTemplate = apply { if (validated) { return@apply @@ -2972,6 +3185,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -3083,6 +3306,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -3098,6 +3352,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -3538,6 +3802,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -3805,6 +4079,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -3977,6 +4261,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -4107,6 +4401,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -4350,6 +4654,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -4828,6 +5142,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply @@ -4930,6 +5253,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseFormat.accept(new ResponseFormat.Visitor>() { + * @Override + * public Optional visitText(ResponseFormatText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -4940,6 +5293,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalJsonlRunDataSource.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalJsonlRunDataSource.kt index 9b6a08a70..868d11e9a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalJsonlRunDataSource.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalJsonlRunDataSource.kt @@ -204,6 +204,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreateEvalJsonlRunDataSource = apply { if (validated) { return@apply @@ -260,6 +268,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -269,6 +306,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -571,6 +617,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -754,6 +810,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -845,6 +911,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -950,6 +1026,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -1181,6 +1267,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/EvalApiError.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/EvalApiError.kt index bed615b66..8c7cdb174 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/EvalApiError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/EvalApiError.kt @@ -164,6 +164,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalApiError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt index 310b9b65d..85165ccb7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt @@ -887,6 +887,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunCancelResponse = apply { if (validated) { return@apply @@ -983,6 +991,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSource.accept(new DataSource.Visitor>() { + * @Override + * public Optional visitJsonl(CreateEvalJsonlRunDataSource jsonl) { + * return Optional.of(jsonl.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { jsonl != null -> visitor.visitJsonl(jsonl) @@ -993,6 +1030,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSource = apply { if (validated) { return@apply @@ -1502,6 +1548,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Responses = apply { if (validated) { return@apply @@ -1574,6 +1630,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -1584,6 +1670,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1917,6 +2013,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -2106,6 +2212,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -2202,6 +2318,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -2316,6 +2442,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -2559,6 +2695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply @@ -3268,6 +3414,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): InnerResponses = apply { if (validated) { return@apply @@ -3390,6 +3546,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputMessages.accept(new InputMessages.Visitor>() { + * @Override + * public Optional visitTemplate(Template template) { + * return Optional.of(template.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { template != null -> visitor.visitTemplate(template) @@ -3399,6 +3585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputMessages = apply { if (validated) { return@apply @@ -3733,6 +3929,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Template = apply { if (validated) { return@apply @@ -3810,6 +4016,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = innerTemplate.accept(new InnerTemplate.Visitor>() { + * @Override + * public Optional visitChatMessage(ChatMessage chatMessage) { + * return Optional.of(chatMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatMessage != null -> visitor.visitChatMessage(chatMessage) @@ -3819,6 +4056,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerTemplate = apply { if (validated) { return@apply @@ -4160,6 +4407,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): ChatMessage = apply { if (validated) { return@apply @@ -4479,6 +4736,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -4592,6 +4859,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -4608,6 +4906,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -5094,6 +5402,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -5377,6 +5695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -5558,6 +5886,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -5696,6 +6034,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -5942,6 +6290,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -6544,6 +6902,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply @@ -6745,6 +7113,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Text = apply { if (validated) { return@apply @@ -6922,6 +7300,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -7293,6 +7680,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerModelUsage = apply { if (validated) { return@apply @@ -7555,6 +7951,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerTestingCriteriaResult = apply { if (validated) { return@apply @@ -7827,6 +8232,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResultCounts = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt index a4cfb63ac..8a30d2adb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt @@ -618,6 +618,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -714,6 +723,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSource.accept(new DataSource.Visitor>() { + * @Override + * public Optional visitCreateEvalJsonlRun(CreateEvalJsonlRunDataSource createEvalJsonlRun) { + * return Optional.of(createEvalJsonlRun.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { createEvalJsonlRun != null -> visitor.visitCreateEvalJsonlRun(createEvalJsonlRun) @@ -726,6 +764,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSource = apply { if (validated) { return@apply @@ -1270,6 +1317,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreateEvalResponsesRunDataSource = apply { if (validated) { return@apply @@ -1338,6 +1395,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -1348,6 +1435,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1679,6 +1776,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -1868,6 +1975,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1964,6 +2081,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -2078,6 +2205,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -2321,6 +2458,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply @@ -3028,6 +3175,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Responses = apply { if (validated) { return@apply @@ -3208,6 +3365,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -3275,6 +3442,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputMessages.accept(new InputMessages.Visitor>() { + * @Override + * public Optional visitTemplate(Template template) { + * return Optional.of(template.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { template != null -> visitor.visitTemplate(template) @@ -3284,6 +3481,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputMessages = apply { if (validated) { return@apply @@ -3618,6 +3825,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Template = apply { if (validated) { return@apply @@ -3695,6 +3912,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = innerTemplate.accept(new InnerTemplate.Visitor>() { + * @Override + * public Optional visitChatMessage(ChatMessage chatMessage) { + * return Optional.of(chatMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatMessage != null -> visitor.visitChatMessage(chatMessage) @@ -3704,6 +3952,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerTemplate = apply { if (validated) { return@apply @@ -4045,6 +4303,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): ChatMessage = apply { if (validated) { return@apply @@ -4364,6 +4632,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -4477,6 +4755,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -4493,6 +4802,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -4979,6 +5298,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -5262,6 +5591,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -5443,6 +5782,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -5581,6 +5930,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -5827,6 +6186,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -6429,6 +6798,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply @@ -6630,6 +7009,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Text = apply { if (validated) { return@apply @@ -6807,6 +7196,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt index 7908c481f..175106920 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt @@ -887,6 +887,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunCreateResponse = apply { if (validated) { return@apply @@ -983,6 +991,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSource.accept(new DataSource.Visitor>() { + * @Override + * public Optional visitJsonl(CreateEvalJsonlRunDataSource jsonl) { + * return Optional.of(jsonl.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { jsonl != null -> visitor.visitJsonl(jsonl) @@ -993,6 +1030,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSource = apply { if (validated) { return@apply @@ -1502,6 +1548,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Responses = apply { if (validated) { return@apply @@ -1574,6 +1630,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -1584,6 +1670,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1917,6 +2013,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -2106,6 +2212,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -2202,6 +2318,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -2316,6 +2442,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -2559,6 +2695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply @@ -3268,6 +3414,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): InnerResponses = apply { if (validated) { return@apply @@ -3390,6 +3546,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputMessages.accept(new InputMessages.Visitor>() { + * @Override + * public Optional visitTemplate(Template template) { + * return Optional.of(template.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { template != null -> visitor.visitTemplate(template) @@ -3399,6 +3585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputMessages = apply { if (validated) { return@apply @@ -3733,6 +3929,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Template = apply { if (validated) { return@apply @@ -3810,6 +4016,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = innerTemplate.accept(new InnerTemplate.Visitor>() { + * @Override + * public Optional visitChatMessage(ChatMessage chatMessage) { + * return Optional.of(chatMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatMessage != null -> visitor.visitChatMessage(chatMessage) @@ -3819,6 +4056,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerTemplate = apply { if (validated) { return@apply @@ -4160,6 +4407,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): ChatMessage = apply { if (validated) { return@apply @@ -4479,6 +4736,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -4592,6 +4859,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -4608,6 +4906,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -5094,6 +5402,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -5377,6 +5695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -5558,6 +5886,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -5696,6 +6034,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -5942,6 +6290,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -6544,6 +6902,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply @@ -6745,6 +7113,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Text = apply { if (validated) { return@apply @@ -6922,6 +7300,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -7293,6 +7680,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerModelUsage = apply { if (validated) { return@apply @@ -7555,6 +7951,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerTestingCriteriaResult = apply { if (validated) { return@apply @@ -7827,6 +8232,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResultCounts = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunDeleteResponse.kt index 061c3822e..cd2f1f3e6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunDeleteResponse.kt @@ -164,6 +164,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListPageResponse.kt index 49d9a7584..021cd833d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListPageResponse.kt @@ -282,6 +282,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListParams.kt index 1fa950c30..a6876f1a4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListParams.kt @@ -349,6 +349,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply @@ -495,6 +504,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt index 1bba7278a..11c9a0a4c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt @@ -887,6 +887,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunListResponse = apply { if (validated) { return@apply @@ -983,6 +991,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSource.accept(new DataSource.Visitor>() { + * @Override + * public Optional visitJsonl(CreateEvalJsonlRunDataSource jsonl) { + * return Optional.of(jsonl.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { jsonl != null -> visitor.visitJsonl(jsonl) @@ -993,6 +1030,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSource = apply { if (validated) { return@apply @@ -1502,6 +1548,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Responses = apply { if (validated) { return@apply @@ -1574,6 +1630,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -1584,6 +1670,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1917,6 +2013,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -2106,6 +2212,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -2202,6 +2318,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -2316,6 +2442,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -2559,6 +2695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply @@ -3268,6 +3414,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): InnerResponses = apply { if (validated) { return@apply @@ -3390,6 +3546,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputMessages.accept(new InputMessages.Visitor>() { + * @Override + * public Optional visitTemplate(Template template) { + * return Optional.of(template.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { template != null -> visitor.visitTemplate(template) @@ -3399,6 +3585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputMessages = apply { if (validated) { return@apply @@ -3733,6 +3929,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Template = apply { if (validated) { return@apply @@ -3810,6 +4016,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = innerTemplate.accept(new InnerTemplate.Visitor>() { + * @Override + * public Optional visitChatMessage(ChatMessage chatMessage) { + * return Optional.of(chatMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatMessage != null -> visitor.visitChatMessage(chatMessage) @@ -3819,6 +4056,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerTemplate = apply { if (validated) { return@apply @@ -4160,6 +4407,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): ChatMessage = apply { if (validated) { return@apply @@ -4479,6 +4736,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -4592,6 +4859,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -4608,6 +4906,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -5094,6 +5402,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -5377,6 +5695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -5558,6 +5886,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -5696,6 +6034,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -5942,6 +6290,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -6544,6 +6902,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply @@ -6745,6 +7113,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Text = apply { if (validated) { return@apply @@ -6922,6 +7300,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -7293,6 +7680,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerModelUsage = apply { if (validated) { return@apply @@ -7555,6 +7951,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerTestingCriteriaResult = apply { if (validated) { return@apply @@ -7827,6 +8232,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResultCounts = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt index a0456b581..e2d659fce 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt @@ -887,6 +887,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RunRetrieveResponse = apply { if (validated) { return@apply @@ -983,6 +991,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = dataSource.accept(new DataSource.Visitor>() { + * @Override + * public Optional visitJsonl(CreateEvalJsonlRunDataSource jsonl) { + * return Optional.of(jsonl.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { jsonl != null -> visitor.visitJsonl(jsonl) @@ -993,6 +1030,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DataSource = apply { if (validated) { return@apply @@ -1502,6 +1548,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Responses = apply { if (validated) { return@apply @@ -1574,6 +1630,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = source.accept(new Source.Visitor>() { + * @Override + * public Optional visitFileContent(FileContent fileContent) { + * return Optional.of(fileContent.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileContent != null -> visitor.visitFileContent(fileContent) @@ -1584,6 +1670,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1917,6 +2013,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileContent = apply { if (validated) { return@apply @@ -2106,6 +2212,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -2202,6 +2318,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Item = apply { if (validated) { return@apply @@ -2316,6 +2442,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -2559,6 +2695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): FileId = apply { if (validated) { return@apply @@ -3268,6 +3414,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): InnerResponses = apply { if (validated) { return@apply @@ -3390,6 +3546,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputMessages.accept(new InputMessages.Visitor>() { + * @Override + * public Optional visitTemplate(Template template) { + * return Optional.of(template.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { template != null -> visitor.visitTemplate(template) @@ -3399,6 +3585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputMessages = apply { if (validated) { return@apply @@ -3733,6 +3929,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Template = apply { if (validated) { return@apply @@ -3810,6 +4016,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from + * the API, unless [visitor] overrides [Visitor.unknown]. To handle variants + * not known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = innerTemplate.accept(new InnerTemplate.Visitor>() { + * @Override + * public Optional visitChatMessage(ChatMessage chatMessage) { + * return Optional.of(chatMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { chatMessage != null -> visitor.visitChatMessage(chatMessage) @@ -3819,6 +4056,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): InnerTemplate = apply { if (validated) { return@apply @@ -4160,6 +4407,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): ChatMessage = apply { if (validated) { return@apply @@ -4479,6 +4736,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): EvalItem = apply { if (validated) { return@apply @@ -4592,6 +4859,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -4608,6 +4906,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -5094,6 +5402,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -5377,6 +5695,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match + * their expected types recursively. + * + * This method is _not_ forwards compatible with new types from + * the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -5558,6 +5886,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -5696,6 +6034,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -5942,6 +6290,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -6544,6 +6902,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply @@ -6745,6 +7113,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Text = apply { if (validated) { return@apply @@ -6922,6 +7300,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -7293,6 +7680,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerModelUsage = apply { if (validated) { return@apply @@ -7555,6 +7951,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PerTestingCriteriaResult = apply { if (validated) { return@apply @@ -7827,6 +8232,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResultCounts = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListPageResponse.kt index bbc42b78e..ca3eef1f9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListPageResponse.kt @@ -284,6 +284,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputItemListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListParams.kt index 454272089..244ae33cc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListParams.kt @@ -372,6 +372,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply @@ -501,6 +510,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListResponse.kt index 04852007a..b83219e4f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemListResponse.kt @@ -478,6 +478,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputItemListResponse = apply { if (validated) { return@apply @@ -585,6 +593,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DatasourceItem = apply { if (validated) { return@apply @@ -878,6 +895,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -975,6 +1001,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -1528,6 +1564,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -1731,6 +1776,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -1913,6 +1968,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -2216,6 +2281,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemRetrieveResponse.kt index 9b99cb25b..6f496b67a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/outputitems/OutputItemRetrieveResponse.kt @@ -478,6 +478,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputItemRetrieveResponse = apply { if (validated) { return@apply @@ -585,6 +593,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DatasourceItem = apply { if (validated) { return@apply @@ -878,6 +895,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -975,6 +1001,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -1528,6 +1564,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Sample = apply { if (validated) { return@apply @@ -1731,6 +1776,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -1913,6 +1968,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -2216,6 +2281,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/files/FileCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/files/FileCreateParams.kt index 150d8a669..9f5bf9895 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/files/FileCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/files/FileCreateParams.kt @@ -563,6 +563,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -755,6 +764,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/files/FileDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/files/FileDeleted.kt index 9fd2a4d65..c7862d57d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/files/FileDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/files/FileDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/files/FileListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/files/FileListPageResponse.kt index c39e12d14..e9b1d86b6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/files/FileListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/files/FileListPageResponse.kt @@ -265,6 +265,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/files/FileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/files/FileListParams.kt index c04abe7cf..43c0504e4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/files/FileListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/files/FileListParams.kt @@ -342,6 +342,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/files/FileObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/files/FileObject.kt index 927db21a2..47a31fa35 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/files/FileObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/files/FileObject.kt @@ -431,6 +431,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileObject = apply { if (validated) { return@apply @@ -604,6 +612,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Purpose = apply { if (validated) { return@apply @@ -740,6 +757,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/files/FilePurpose.kt b/openai-java-core/src/main/kotlin/com/openai/models/files/FilePurpose.kt index 74449f5af..9dd0f42c3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/files/FilePurpose.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/files/FilePurpose.kt @@ -125,6 +125,14 @@ class FilePurpose @JsonCreator private constructor(private val value: JsonField< private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FilePurpose = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunParams.kt index f63d07d99..9b4aba1f1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunParams.kt @@ -529,6 +529,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -645,6 +654,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = grader.accept(new Grader.Visitor>() { + * @Override + * public Optional visitStringCheck(StringCheckGrader stringCheck) { + * return Optional.of(stringCheck.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { stringCheck != null -> visitor.visitStringCheck(stringCheck) @@ -657,6 +695,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Grader = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunResponse.kt index f3226ed15..ab6bb52f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderRunResponse.kt @@ -238,6 +238,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GraderRunResponse = apply { if (validated) { return@apply @@ -612,6 +620,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1354,6 +1371,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Errors = apply { if (validated) { return@apply @@ -1517,6 +1544,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Scores = apply { if (validated) { return@apply @@ -1657,6 +1694,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ModelGraderTokenUsagePerModel = apply { if (validated) { return@apply @@ -1758,6 +1804,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SubRewards = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateParams.kt index b877def0b..889eb314c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateParams.kt @@ -403,6 +403,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -510,6 +519,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = grader.accept(new Grader.Visitor>() { + * @Override + * public Optional visitStringCheck(StringCheckGrader stringCheck) { + * return Optional.of(stringCheck.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { stringCheck != null -> visitor.visitStringCheck(stringCheck) @@ -522,6 +560,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Grader = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateResponse.kt index 9cb597799..9f725f508 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/alpha/graders/GraderValidateResponse.kt @@ -146,6 +146,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GraderValidateResponse = apply { if (validated) { return@apply @@ -235,6 +243,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = grader.accept(new Grader.Visitor>() { + * @Override + * public Optional visitStringCheck(StringCheckGrader stringCheck) { + * return Optional.of(stringCheck.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { stringCheck != null -> visitor.visitStringCheck(stringCheck) @@ -247,6 +284,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Grader = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreatePageResponse.kt index 50f581f1f..5373545d9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreatePageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreatePageResponse.kt @@ -272,6 +272,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PermissionCreatePageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateParams.kt index 8f7b9f6ea..d07953c8a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateParams.kt @@ -415,6 +415,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateResponse.kt index e1b1a87f9..6c94fe102 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionCreateResponse.kt @@ -230,6 +230,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PermissionCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionDeleteResponse.kt index a2ff688ca..75c16cca1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionDeleteResponse.kt @@ -195,6 +195,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PermissionDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListPageResponse.kt index 33899dd60..7656ca588 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListPageResponse.kt @@ -272,6 +272,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PermissionListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListParams.kt index 6da26132b..cbbb75b8a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListParams.kt @@ -346,6 +346,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListResponse.kt index e69caa0f4..14787610d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionListResponse.kt @@ -230,6 +230,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PermissionListResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveParams.kt index 10b1f0e7e..9d2f2aa06 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveParams.kt @@ -347,6 +347,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveResponse.kt index a020adda4..73b82927d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/checkpoints/permissions/PermissionRetrieveResponse.kt @@ -267,6 +267,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PermissionRetrieveResponse = apply { if (validated) { return@apply @@ -528,6 +536,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJob.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJob.kt index dbc107c16..38c6b38f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJob.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJob.kt @@ -967,6 +967,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FineTuningJob = apply { if (validated) { return@apply @@ -1228,6 +1236,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -1505,6 +1522,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Hyperparameters = apply { if (validated) { return@apply @@ -1563,6 +1589,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = batchSize.accept(new BatchSize.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1572,6 +1628,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchSize = apply { if (validated) { return@apply @@ -1746,6 +1812,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = learningRateMultiplier.accept(new LearningRateMultiplier.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1755,6 +1851,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LearningRateMultiplier = apply { if (validated) { return@apply @@ -1933,6 +2039,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = nEpochs.accept(new NEpochs.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1942,6 +2078,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NEpochs = apply { if (validated) { return@apply @@ -2226,6 +2372,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -2330,6 +2485,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2599,6 +2763,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Method = apply { if (validated) { return@apply @@ -2728,6 +2901,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobEvent.kt index ccf6ff05d..b2a4908d7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobEvent.kt @@ -314,6 +314,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FineTuningJobEvent = apply { if (validated) { return@apply @@ -448,6 +456,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Level = apply { if (validated) { return@apply @@ -574,6 +591,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegration.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegration.kt index eb7c29488..68a3bee09 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegration.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegration.kt @@ -263,6 +263,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FineTuningJobWandbIntegration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegrationObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegrationObject.kt index 27de8138a..486647234 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegrationObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/FineTuningJobWandbIntegrationObject.kt @@ -180,6 +180,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FineTuningJobWandbIntegrationObject = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobCreateParams.kt index e75bf0aea..205445e5b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobCreateParams.kt @@ -1188,6 +1188,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1373,6 +1382,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -1633,6 +1651,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Hyperparameters = apply { if (validated) { return@apply @@ -1691,6 +1718,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = batchSize.accept(new BatchSize.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1700,6 +1757,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchSize = apply { if (validated) { return@apply @@ -1874,6 +1941,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = learningRateMultiplier.accept(new LearningRateMultiplier.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1883,6 +1980,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LearningRateMultiplier = apply { if (validated) { return@apply @@ -2061,6 +2168,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = nEpochs.accept(new NEpochs.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -2070,6 +2207,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NEpochs = apply { if (validated) { return@apply @@ -2396,6 +2543,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Integration = apply { if (validated) { return@apply @@ -2692,6 +2848,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Wandb = apply { if (validated) { return@apply @@ -2833,6 +2999,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -3102,6 +3277,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Method = apply { if (validated) { return@apply @@ -3231,6 +3415,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListEventsPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListEventsPageResponse.kt index 37dbe99ed..929489d54 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListEventsPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListEventsPageResponse.kt @@ -207,6 +207,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): JobListEventsPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListPageResponse.kt index deada0104..f9c0217b7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/JobListPageResponse.kt @@ -207,6 +207,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): JobListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/CheckpointListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/CheckpointListPageResponse.kt index 7bed8a97c..ba1af80a8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/CheckpointListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/CheckpointListPageResponse.kt @@ -272,6 +272,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CheckpointListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/FineTuningJobCheckpoint.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/FineTuningJobCheckpoint.kt index cdc6962a9..b8037d42b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/FineTuningJobCheckpoint.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/jobs/checkpoints/FineTuningJobCheckpoint.kt @@ -360,6 +360,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FineTuningJobCheckpoint = apply { if (validated) { return@apply @@ -723,6 +731,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metrics = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoHyperparameters.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoHyperparameters.kt index 25611ec96..fd7e0a6fe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoHyperparameters.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoHyperparameters.kt @@ -280,6 +280,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DpoHyperparameters = apply { if (validated) { return@apply @@ -339,6 +347,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = batchSize.accept(new BatchSize.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -348,6 +385,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchSize = apply { if (validated) { return@apply @@ -519,6 +565,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = beta.accept(new Beta.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -528,6 +603,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Beta = apply { if (validated) { return@apply @@ -696,6 +780,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = learningRateMultiplier.accept(new LearningRateMultiplier.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -705,6 +818,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LearningRateMultiplier = apply { if (validated) { return@apply @@ -879,6 +1001,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = nEpochs.accept(new NEpochs.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -888,6 +1039,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NEpochs = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoMethod.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoMethod.kt index 859d9486a..118431ca4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoMethod.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/DpoMethod.kt @@ -123,6 +123,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DpoMethod = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementHyperparameters.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementHyperparameters.kt index af0131200..8d5ea07d9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementHyperparameters.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementHyperparameters.kt @@ -427,6 +427,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReinforcementHyperparameters = apply { if (validated) { return@apply @@ -492,6 +500,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = batchSize.accept(new BatchSize.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -501,6 +538,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchSize = apply { if (validated) { return@apply @@ -669,6 +715,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = computeMultiplier.accept(new ComputeMultiplier.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -678,6 +753,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComputeMultiplier = apply { if (validated) { return@apply @@ -848,6 +932,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = evalInterval.accept(new EvalInterval.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -857,6 +970,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalInterval = apply { if (validated) { return@apply @@ -1026,6 +1148,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = evalSamples.accept(new EvalSamples.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1035,6 +1186,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalSamples = apply { if (validated) { return@apply @@ -1207,6 +1367,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = learningRateMultiplier.accept(new LearningRateMultiplier.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1216,6 +1405,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LearningRateMultiplier = apply { if (validated) { return@apply @@ -1390,6 +1588,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = nEpochs.accept(new NEpochs.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -1399,6 +1626,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NEpochs = apply { if (validated) { return@apply @@ -1647,6 +1883,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReasoningEffort = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementMethod.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementMethod.kt index 289773161..41a3f3e4c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementMethod.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/ReinforcementMethod.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReinforcementMethod = apply { if (validated) { return@apply @@ -298,6 +306,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = grader.accept(new Grader.Visitor>() { + * @Override + * public Optional visitStringCheck(StringCheckGrader stringCheck) { + * return Optional.of(stringCheck.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { stringCheck != null -> visitor.visitStringCheck(stringCheck) @@ -310,6 +347,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Grader = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedHyperparameters.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedHyperparameters.kt index 15d28d9c5..24a4dbfb7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedHyperparameters.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedHyperparameters.kt @@ -241,6 +241,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SupervisedHyperparameters = apply { if (validated) { return@apply @@ -298,6 +306,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = batchSize.accept(new BatchSize.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -307,6 +344,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BatchSize = apply { if (validated) { return@apply @@ -478,6 +524,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = learningRateMultiplier.accept(new LearningRateMultiplier.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -487,6 +562,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LearningRateMultiplier = apply { if (validated) { return@apply @@ -661,6 +745,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = nEpochs.accept(new NEpochs.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -670,6 +783,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NEpochs = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedMethod.kt b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedMethod.kt index c459677ec..2c88cbd6f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedMethod.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/finetuning/methods/SupervisedMethod.kt @@ -124,6 +124,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SupervisedMethod = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/EvalContentItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/EvalContentItem.kt index 885f678b0..5f8e99b73 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/EvalContentItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/EvalContentItem.kt @@ -85,6 +85,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = evalContentItem.accept(new EvalContentItem.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -97,6 +126,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvalContentItem = apply { if (validated) { return@apply @@ -448,6 +485,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -687,6 +733,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt index b090130b6..e61f5c4dc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt @@ -359,6 +359,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LabelModelGrader = apply { if (validated) { return@apply @@ -618,6 +626,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -726,6 +743,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -740,6 +787,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1143,6 +1200,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -1392,6 +1459,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -1552,6 +1629,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1674,6 +1761,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/MultiGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/MultiGrader.kt index c95c690a3..ae80f0bba 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/MultiGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/MultiGrader.kt @@ -275,6 +275,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MultiGrader = apply { if (validated) { return@apply @@ -385,6 +393,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = graders.accept(new Graders.Visitor>() { + * @Override + * public Optional visitStringCheckGrader(StringCheckGrader stringCheckGrader) { + * return Optional.of(stringCheckGrader.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { stringCheckGrader != null -> visitor.visitStringCheckGrader(stringCheckGrader) @@ -398,6 +435,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Graders = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/PythonGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/PythonGrader.kt index 20ae48ae4..232674b1f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/PythonGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/PythonGrader.kt @@ -228,6 +228,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PythonGrader = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt index 8b0165922..8fb6c2a95 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt @@ -352,6 +352,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScoreModelGrader = apply { if (validated) { return@apply @@ -611,6 +619,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -719,6 +736,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -733,6 +780,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -1136,6 +1193,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): OutputText = apply { if (validated) { return@apply @@ -1385,6 +1452,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputImage = apply { if (validated) { return@apply @@ -1545,6 +1622,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1667,6 +1754,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -2055,6 +2152,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SamplingParams = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/StringCheckGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/StringCheckGrader.kt index 6b19bbf89..a9782bd99 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/StringCheckGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/StringCheckGrader.kt @@ -271,6 +271,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StringCheckGrader = apply { if (validated) { return@apply @@ -411,6 +419,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Operation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/TextSimilarityGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/TextSimilarityGrader.kt index 082eda2b2..1688175bc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/TextSimilarityGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/TextSimilarityGrader.kt @@ -278,6 +278,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextSimilarityGrader = apply { if (validated) { return@apply @@ -465,6 +473,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EvaluationMetric = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/Image.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/Image.kt index e3192cbc3..7b3268b0a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/Image.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/Image.kt @@ -189,6 +189,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Image = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageCreateVariationParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageCreateVariationParams.kt index 67e140900..28792f815 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageCreateVariationParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageCreateVariationParams.kt @@ -793,6 +793,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -935,6 +944,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply @@ -1067,6 +1085,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditCompletedEvent.kt index ebc631d0d..c1417fac4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditCompletedEvent.kt @@ -385,6 +385,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageEditCompletedEvent = apply { if (validated) { return@apply @@ -525,6 +533,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -660,6 +677,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -798,6 +824,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -936,6 +971,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply @@ -1217,6 +1261,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply @@ -1418,6 +1471,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputTokensDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt index c4b54c3a2..866b2d25d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt @@ -1639,6 +1639,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1750,6 +1759,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = image.accept(new Image.Visitor>() { + * @Override + * public Optional visitInputStream(InputStream inputStream) { + * return Optional.of(inputStream.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputStream != null -> visitor.visitInputStream(inputStream) @@ -1759,6 +1797,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Image = apply { if (validated) { return@apply @@ -1955,6 +2002,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -2090,6 +2146,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputFidelity = apply { if (validated) { return@apply @@ -2228,6 +2293,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -2372,6 +2446,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -2507,6 +2590,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply @@ -2661,6 +2753,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditPartialImageEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditPartialImageEvent.kt index 03f9a4b00..43dc1202e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditPartialImageEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditPartialImageEvent.kt @@ -394,6 +394,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageEditPartialImageEvent = apply { if (validated) { return@apply @@ -534,6 +542,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -669,6 +686,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -807,6 +833,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -945,6 +980,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditStreamEvent.kt index 50b6ed4f0..a8301534e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditStreamEvent.kt @@ -46,6 +46,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = imageEditStreamEvent.accept(new ImageEditStreamEvent.Visitor>() { + * @Override + * public Optional visitPartialImage(ImageEditPartialImageEvent partialImage) { + * return Optional.of(partialImage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { partialImage != null -> visitor.visitPartialImage(partialImage) @@ -55,6 +84,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageEditStreamEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenCompletedEvent.kt index cc119f3ff..2de70515a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenCompletedEvent.kt @@ -385,6 +385,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenCompletedEvent = apply { if (validated) { return@apply @@ -525,6 +533,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -660,6 +677,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -798,6 +824,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -936,6 +971,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply @@ -1217,6 +1261,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply @@ -1418,6 +1471,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputTokensDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenPartialImageEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenPartialImageEvent.kt index 7ea2497fb..363f770a0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenPartialImageEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenPartialImageEvent.kt @@ -394,6 +394,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenPartialImageEvent = apply { if (validated) { return@apply @@ -534,6 +542,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -669,6 +686,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -807,6 +833,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -945,6 +980,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenStreamEvent.kt index c456ba9e3..d47e47e23 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenStreamEvent.kt @@ -50,6 +50,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = imageGenStreamEvent.accept(new ImageGenStreamEvent.Visitor>() { + * @Override + * public Optional visitGenerationPartialImage(ImageGenPartialImageEvent generationPartialImage) { + * return Optional.of(generationPartialImage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { generationPartialImage != null -> @@ -60,6 +89,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenStreamEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt index ad39d5f0a..df188aabf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt @@ -1467,6 +1467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1669,6 +1678,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -1800,6 +1818,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Moderation = apply { if (validated) { return@apply @@ -1938,6 +1965,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -2094,6 +2130,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -2229,6 +2274,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply @@ -2396,6 +2450,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply @@ -2527,6 +2590,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Style = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt index f94c0c4d0..fdfcd557f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt @@ -110,6 +110,14 @@ class ImageModel @JsonCreator private constructor(private val value: JsonField = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -599,6 +637,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationCreateResponse.kt index 409009c10..d64c32ce4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationCreateResponse.kt @@ -217,6 +217,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ModerationCreateResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationImageUrlInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationImageUrlInput.kt index 77ed3ac4c..080bf0716 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationImageUrlInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationImageUrlInput.kt @@ -165,6 +165,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ModerationImageUrlInput = apply { if (validated) { return@apply @@ -311,6 +319,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageUrl = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationModel.kt index 20ed335b2..8b30ab941 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationModel.kt @@ -107,6 +107,14 @@ class ModerationModel @JsonCreator private constructor(private val value: JsonFi private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ModerationModel = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationMultiModalInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationMultiModalInput.kt index 08eb90d15..efa3f9cb8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationMultiModalInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationMultiModalInput.kt @@ -46,6 +46,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = moderationMultiModalInput.accept(new ModerationMultiModalInput.Visitor>() { + * @Override + * public Optional visitImageUrl(ModerationImageUrlInput imageUrl) { + * return Optional.of(imageUrl.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { imageUrl != null -> visitor.visitImageUrl(imageUrl) @@ -55,6 +84,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ModerationMultiModalInput = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationTextInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationTextInput.kt index 12738958f..d91bdf1fe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationTextInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/moderations/ModerationTextInput.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ModerationTextInput = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt index 7e6dfe950..ae575fd8e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt @@ -206,6 +206,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AudioTranscription = apply { if (validated) { return@apply @@ -348,6 +356,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationCreatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationCreatedEvent.kt index 131eccae4..d4323bec6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationCreatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationCreatedEvent.kt @@ -206,6 +206,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationCreatedEvent = apply { if (validated) { return@apply @@ -371,6 +379,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply @@ -486,6 +503,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt index eddd6e5da..e91ca594e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt @@ -145,6 +145,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = conversationItem.accept(new ConversationItem.Visitor>() { + * @Override + * public Optional visitRealtimeConversationItemSystemMessage(RealtimeConversationItemSystemMessage realtimeConversationItemSystemMessage) { + * return Optional.of(realtimeConversationItemSystemMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtimeConversationItemSystemMessage != null -> @@ -170,6 +199,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItem = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt index 6ded19089..9bf74701b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt @@ -362,6 +362,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemAdded = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt index 3e065c39f..8116ae624 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt @@ -360,6 +360,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemCreateEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt index d03efbe7c..b73ae0532 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt @@ -358,6 +358,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemCreatedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeleteEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeleteEvent.kt index a52e9d5f2..8047a9bdb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeleteEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeleteEvent.kt @@ -199,6 +199,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemDeleteEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeletedEvent.kt index 7f501da3f..e9c715313 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDeletedEvent.kt @@ -200,6 +200,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemDeletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt index feb9ac0af..a51286cf0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt @@ -354,6 +354,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemDone = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionCompletedEvent.kt index 9cbfd9a8b..2c589e9a2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionCompletedEvent.kt @@ -408,6 +408,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemInputAudioTranscriptionCompletedEvent = apply { if (validated) { return@apply @@ -488,6 +496,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = usage.accept(new Usage.Visitor>() { + * @Override + * public Optional visitTranscriptTextUsageTokens(TranscriptTextUsageTokens transcriptTextUsageTokens) { + * return Optional.of(transcriptTextUsageTokens.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { transcriptTextUsageTokens != null -> @@ -499,6 +536,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply @@ -958,6 +1004,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptTextUsageTokens = apply { if (validated) { return@apply @@ -1152,6 +1208,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): InputTokenDetails = apply { if (validated) { return@apply @@ -1391,6 +1457,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptTextUsageDuration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt index 173d83e68..5597e45c7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt @@ -343,6 +343,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemInputAudioTranscriptionDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionFailedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionFailedEvent.kt index 4ece094a6..232962256 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionFailedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionFailedEvent.kt @@ -280,6 +280,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemInputAudioTranscriptionFailedEvent = apply { if (validated) { return@apply @@ -514,6 +522,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionSegment.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionSegment.kt index 05a517399..b0dc237a6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionSegment.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionSegment.kt @@ -405,6 +405,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemInputAudioTranscriptionSegment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemRetrieveEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemRetrieveEvent.kt index 3b9a35181..b1c64823d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemRetrieveEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemRetrieveEvent.kt @@ -201,6 +201,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemRetrieveEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncateEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncateEvent.kt index 2cc0f9506..77b888f9a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncateEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncateEvent.kt @@ -287,6 +287,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemTruncateEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncatedEvent.kt index bafdf3694..b9b9b6638 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemTruncatedEvent.kt @@ -278,6 +278,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemTruncatedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemWithReference.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemWithReference.kt index 2d395fc35..780c64d81 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemWithReference.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemWithReference.kt @@ -472,6 +472,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemWithReference = apply { if (validated) { return@apply @@ -748,6 +756,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -885,6 +902,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1029,6 +1056,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -1164,6 +1200,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1300,6 +1345,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1440,6 +1494,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferAppendEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferAppendEvent.kt index be187fdcf..2d5d0fb80 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferAppendEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferAppendEvent.kt @@ -212,6 +212,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferAppendEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearEvent.kt index 951a97544..1951b485e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearEvent.kt @@ -150,6 +150,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferClearEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearedEvent.kt index 65feab3dd..5f164911d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferClearedEvent.kt @@ -166,6 +166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferClearedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommitEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommitEvent.kt index ce8fce21b..8f6834758 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommitEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommitEvent.kt @@ -156,6 +156,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferCommitEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommittedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommittedEvent.kt index 34d124976..2ad51abaa 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommittedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferCommittedEvent.kt @@ -251,6 +251,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferCommittedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferDtmfEventReceivedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferDtmfEventReceivedEvent.kt index 01f67ebf5..369eb0153 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferDtmfEventReceivedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferDtmfEventReceivedEvent.kt @@ -204,6 +204,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferDtmfEventReceivedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStartedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStartedEvent.kt index e563352ed..434930586 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStartedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStartedEvent.kt @@ -253,6 +253,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferSpeechStartedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStoppedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStoppedEvent.kt index deb08ef25..059c299ad 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStoppedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferSpeechStoppedEvent.kt @@ -244,6 +244,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferSpeechStoppedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferTimeoutTriggered.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferTimeoutTriggered.kt index 9dd23ad8d..048e25d9e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferTimeoutTriggered.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/InputAudioBufferTimeoutTriggered.kt @@ -294,6 +294,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioBufferTimeoutTriggered = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/LogProbProperties.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/LogProbProperties.kt index 81e6eb5fc..2bfe59576 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/LogProbProperties.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/LogProbProperties.kt @@ -213,6 +213,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogProbProperties = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsCompleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsCompleted.kt index 25b28a240..b7234cc4c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsCompleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsCompleted.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListToolsCompleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsFailed.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsFailed.kt index 4bae5c849..93fdf5573 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsFailed.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsFailed.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListToolsFailed = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsInProgress.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsInProgress.kt index fa895aa9a..2a2dec032 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsInProgress.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/McpListToolsInProgress.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListToolsInProgress = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/NoiseReductionType.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/NoiseReductionType.kt index 7b9326ba5..c77521894 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/NoiseReductionType.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/NoiseReductionType.kt @@ -100,6 +100,14 @@ class NoiseReductionType @JsonCreator private constructor(private val value: Jso private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NoiseReductionType = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/OutputAudioBufferClearEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/OutputAudioBufferClearEvent.kt index f07856af0..3a7c07af0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/OutputAudioBufferClearEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/OutputAudioBufferClearEvent.kt @@ -152,6 +152,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputAudioBufferClearEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RateLimitsUpdatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RateLimitsUpdatedEvent.kt index 00584b0ff..afcf97331 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RateLimitsUpdatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RateLimitsUpdatedEvent.kt @@ -224,6 +224,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RateLimitsUpdatedEvent = apply { if (validated) { return@apply @@ -459,6 +467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RateLimit = apply { if (validated) { return@apply @@ -582,6 +599,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Name = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfig.kt index 0cfe1036d..a54c24e0b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfig.kt @@ -147,6 +147,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeAudioConfig = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt index 511a96e6b..b93ce9159 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt @@ -313,6 +313,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeAudioConfigInput = apply { if (validated) { return@apply @@ -457,6 +465,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NoiseReduction = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutput.kt index c7c2e6528..1959d3fac 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutput.kt @@ -235,6 +235,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeAudioConfigOutput = apply { if (validated) { return@apply @@ -304,6 +312,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = voice.accept(new Voice.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -314,6 +351,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply @@ -613,6 +659,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnionMember1 = apply { if (validated) { return@apply @@ -768,6 +824,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Id = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioFormats.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioFormats.kt index 05771f6c3..9069d1aad 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioFormats.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioFormats.kt @@ -64,6 +64,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeAudioFormats.accept(new RealtimeAudioFormats.Visitor>() { + * @Override + * public Optional visitAudioPcm(AudioPcm audioPcm) { + * return Optional.of(audioPcm.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { audioPcm != null -> visitor.visitAudioPcm(audioPcm) @@ -74,6 +103,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeAudioFormats = apply { if (validated) { return@apply @@ -366,6 +403,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AudioPcm = apply { if (validated) { return@apply @@ -476,6 +522,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Rate = apply { if (validated) { return@apply @@ -598,6 +654,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -754,6 +820,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AudioPcmu = apply { if (validated) { return@apply @@ -863,6 +938,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1018,6 +1103,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AudioPcma = apply { if (validated) { return@apply @@ -1127,6 +1221,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt index 198924a6a..2ec4b51bb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt @@ -79,6 +79,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeAudioInputTurnDetection.accept(new RealtimeAudioInputTurnDetection.Visitor>() { + * @Override + * public Optional visitServerVad(ServerVad serverVad) { + * return Optional.of(serverVad.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { serverVad != null -> visitor.visitServerVad(serverVad) @@ -88,6 +117,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeAudioInputTurnDetection = apply { if (validated) { return@apply @@ -670,6 +707,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServerVad = apply { if (validated) { return@apply @@ -983,6 +1029,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SemanticVad = apply { if (validated) { return@apply @@ -1131,6 +1186,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Eagerness = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeClientEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeClientEvent.kt index 897150aaf..dee76b952 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeClientEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeClientEvent.kt @@ -335,6 +335,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeClientEvent.accept(new RealtimeClientEvent.Visitor>() { + * @Override + * public Optional visitConversationItemCreate(ConversationItemCreateEvent conversationItemCreate) { + * return Optional.of(conversationItemCreate.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { conversationItemCreate != null -> @@ -361,6 +390,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeClientEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemAssistantMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemAssistantMessage.kt index 97d947199..71b3f82f2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemAssistantMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemAssistantMessage.kt @@ -320,6 +320,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeConversationItemAssistantMessage = apply { if (validated) { return@apply @@ -573,6 +581,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -699,6 +716,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -845,6 +872,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -977,6 +1013,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCall.kt index 48960cc68..ec20253b4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCall.kt @@ -338,6 +338,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeConversationItemFunctionCall = apply { if (validated) { return@apply @@ -465,6 +473,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -597,6 +614,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCallOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCallOutput.kt index ca8558ae7..0f03fa82d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCallOutput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemFunctionCallOutput.kt @@ -306,6 +306,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeConversationItemFunctionCallOutput = apply { if (validated) { return@apply @@ -431,6 +439,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -563,6 +580,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemSystemMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemSystemMessage.kt index c44061569..d2607533e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemSystemMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemSystemMessage.kt @@ -326,6 +326,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeConversationItemSystemMessage = apply { if (validated) { return@apply @@ -499,6 +507,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -611,6 +628,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -753,6 +780,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -885,6 +921,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemUserMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemUserMessage.kt index 7b5db5e96..2532f0703 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemUserMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeConversationItemUserMessage.kt @@ -320,6 +320,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeConversationItemUserMessage = apply { if (validated) { return@apply @@ -647,6 +655,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -782,6 +799,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply @@ -916,6 +943,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1064,6 +1101,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -1196,6 +1242,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeError.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeError.kt index 6f5c0965c..f71204615 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeError.kt @@ -268,6 +268,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt index 087486059..c1beb86a8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt @@ -202,6 +202,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeErrorEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeFunctionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeFunctionTool.kt index 8a0b9a269..afb58eafb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeFunctionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeFunctionTool.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeFunctionTool = apply { if (validated) { return@apply @@ -317,6 +325,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalRequest.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalRequest.kt index ee20412f0..d3e727ff6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalRequest.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalRequest.kt @@ -268,6 +268,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcpApprovalRequest = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalResponse.kt index 897c11bd2..ff683c442 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpApprovalResponse.kt @@ -274,6 +274,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcpApprovalResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpListTools.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpListTools.kt index 68341039a..641a5fce1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpListTools.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpListTools.kt @@ -249,6 +249,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcpListTools = apply { if (validated) { return@apply @@ -481,6 +489,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpProtocolError.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpProtocolError.kt index d1de831aa..2177f6c1f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpProtocolError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpProtocolError.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcpProtocolError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt index e3f3c6a50..2d5a5a65c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt @@ -423,6 +423,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcpToolCall = apply { if (validated) { return@apply @@ -500,6 +508,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = error.accept(new Error.Visitor>() { + * @Override + * public Optional visitProtocol(RealtimeMcpProtocolError protocol) { + * return Optional.of(protocol.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { protocol != null -> visitor.visitProtocol(protocol) @@ -510,6 +547,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolExecutionError.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolExecutionError.kt index 1e708c391..d705195d4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolExecutionError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolExecutionError.kt @@ -158,6 +158,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcpToolExecutionError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcphttpError.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcphttpError.kt index 5ebe0acd8..1e6e4297b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcphttpError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcphttpError.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeMcphttpError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt index bf5c7b22c..5bf170892 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt @@ -684,6 +684,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponse = apply { if (validated) { return@apply @@ -826,6 +834,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Audio = apply { if (validated) { return@apply @@ -1020,6 +1037,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -1196,6 +1223,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply @@ -1298,6 +1335,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxOutputTokens.accept(new MaxOutputTokens.Visitor>() { + * @Override + * public Optional visitInteger(Long integer) { + * return Optional.of(integer.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { integer != null -> visitor.visitInteger(integer) @@ -1307,6 +1373,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MaxOutputTokens = apply { if (validated) { return@apply @@ -1518,6 +1593,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1641,6 +1725,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -1770,6 +1863,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputModality = apply { if (validated) { return@apply @@ -1917,6 +2019,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutput.kt index a5b636cbd..5c961e2b1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutput.kt @@ -130,6 +130,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseCreateAudioOutput = apply { if (validated) { return@apply @@ -318,6 +326,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -386,6 +403,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = voice.accept(new Voice.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -396,6 +443,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply @@ -699,6 +756,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): UnionMember1 = apply { if (validated) { return@apply @@ -855,6 +922,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Id = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt index 7eb9809c5..34a6fad2a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt @@ -563,6 +563,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseCreateMcpTool = apply { if (validated) { return@apply @@ -639,6 +647,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = allowedTools.accept(new AllowedTools.Visitor>() { + * @Override + * public Optional visitMcp(List mcp) { + * return Optional.of(mcp.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcp != null -> visitor.visitMcp(mcp) @@ -648,6 +685,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllowedTools = apply { if (validated) { return@apply @@ -963,6 +1009,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpToolFilter = apply { if (validated) { return@apply @@ -1155,6 +1211,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConnectorId = apply { if (validated) { return@apply @@ -1254,6 +1319,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -1341,6 +1415,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = requireApproval.accept(new RequireApproval.Visitor>() { + * @Override + * public Optional visitMcpToolApprovalFilter(McpToolApprovalFilter mcpToolApprovalFilter) { + * return Optional.of(mcpToolApprovalFilter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcpToolApprovalFilter != null -> @@ -1352,6 +1455,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RequireApproval = apply { if (validated) { return@apply @@ -1671,6 +1783,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpToolApprovalFilter = apply { if (validated) { return@apply @@ -1870,6 +1992,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Always = apply { if (validated) { return@apply @@ -2090,6 +2222,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Never = apply { if (validated) { return@apply @@ -2261,6 +2403,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpToolApprovalSetting = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt index 9aa9c556e..628ef17b7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt @@ -730,6 +730,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseCreateParams = apply { if (validated) { return@apply @@ -870,6 +878,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply @@ -936,6 +953,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxOutputTokens.accept(new MaxOutputTokens.Visitor>() { + * @Override + * public Optional visitInteger(Long integer) { + * return Optional.of(integer.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { integer != null -> visitor.visitInteger(integer) @@ -945,6 +991,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MaxOutputTokens = apply { if (validated) { return@apply @@ -1156,6 +1211,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1288,6 +1352,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputModality = apply { if (validated) { return@apply @@ -1384,6 +1457,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolChoice.accept(new ToolChoice.Visitor>() { + * @Override + * public Optional visitOptions(ToolChoiceOptions options) { + * return Optional.of(options.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { options != null -> visitor.visitOptions(options) @@ -1394,6 +1496,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply @@ -1623,6 +1734,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitRealtimeFunction(RealtimeFunctionTool realtimeFunction) { + * return Optional.of(realtimeFunction.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtimeFunction != null -> visitor.visitRealtimeFunction(realtimeFunction) @@ -1633,6 +1773,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseStatus.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseStatus.kt index 532bb346b..959971317 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseStatus.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseStatus.kt @@ -193,6 +193,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseStatus = apply { if (validated) { return@apply @@ -356,6 +364,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -508,6 +525,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Reason = apply { if (validated) { return@apply @@ -649,6 +675,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsage.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsage.kt index ccd860f90..c9b3015e2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsage.kt @@ -298,6 +298,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseUsage = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageInputTokenDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageInputTokenDetails.kt index 3883146f6..cfced353b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageInputTokenDetails.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageInputTokenDetails.kt @@ -281,6 +281,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseUsageInputTokenDetails = apply { if (validated) { return@apply @@ -492,6 +500,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CachedTokensDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageOutputTokenDetails.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageOutputTokenDetails.kt index b1a93ec3d..3a5b5d3fc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageOutputTokenDetails.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseUsageOutputTokenDetails.kt @@ -157,6 +157,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeResponseUsageOutputTokenDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt index 9f5c943d3..7c36c7f7b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt @@ -888,6 +888,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeServerEvent.accept(new RealtimeServerEvent.Visitor>() { + * @Override + * public Optional visitConversationCreated(ConversationCreatedEvent conversationCreated) { + * return Optional.of(conversationCreated.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { conversationCreated != null -> visitor.visitConversationCreated(conversationCreated) @@ -986,6 +1015,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeServerEvent = apply { if (validated) { return@apply @@ -3181,6 +3218,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConversationItemRetrieved = apply { if (validated) { return@apply @@ -3430,6 +3476,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputAudioBufferStarted = apply { if (validated) { return@apply @@ -3679,6 +3734,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputAudioBufferStopped = apply { if (validated) { return@apply @@ -3929,6 +3993,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputAudioBufferCleared = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt index 5cdfe031d..52a26105f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt @@ -1054,6 +1054,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeSession = apply { if (validated) { return@apply @@ -1203,6 +1211,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply @@ -1343,6 +1360,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioFormat = apply { if (validated) { return@apply @@ -1496,6 +1522,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioNoiseReduction = apply { if (validated) { return@apply @@ -1567,6 +1602,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxResponseOutputTokens.accept(new MaxResponseOutputTokens.Visitor>() { + * @Override + * public Optional visitInteger(Long integer) { + * return Optional.of(integer.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { integer != null -> visitor.visitInteger(integer) @@ -1576,6 +1640,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MaxResponseOutputTokens = apply { if (validated) { return@apply @@ -1810,6 +1883,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Modality = apply { if (validated) { return@apply @@ -2027,6 +2109,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -2147,6 +2238,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Object = apply { if (validated) { return@apply @@ -2286,6 +2386,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputAudioFormat = apply { if (validated) { return@apply @@ -2358,6 +2467,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tracing.accept(new Tracing.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -2367,6 +2505,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tracing = apply { if (validated) { return@apply @@ -2699,6 +2846,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TracingConfiguration = apply { if (validated) { return@apply @@ -2803,6 +2960,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = turnDetection.accept(new TurnDetection.Visitor>() { + * @Override + * public Optional visitServerVad(ServerVad serverVad) { + * return Optional.of(serverVad.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { serverVad != null -> visitor.visitServerVad(serverVad) @@ -2812,6 +2998,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TurnDetection = apply { if (validated) { return@apply @@ -3398,6 +3593,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServerVad = apply { if (validated) { return@apply @@ -3720,6 +3925,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SemanticVad = apply { if (validated) { return@apply @@ -3868,6 +4083,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Eagerness = apply { if (validated) { return@apply @@ -4076,6 +4301,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt index 2557626d9..b1c7187d3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt @@ -763,6 +763,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeSessionCreateRequest = apply { if (validated) { return@apply @@ -900,6 +908,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply @@ -966,6 +983,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxOutputTokens.accept(new MaxOutputTokens.Visitor>() { + * @Override + * public Optional visitInteger(Long integer) { + * return Optional.of(integer.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { integer != null -> visitor.visitInteger(integer) @@ -975,6 +1021,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MaxOutputTokens = apply { if (validated) { return@apply @@ -1299,6 +1354,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -1428,6 +1492,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputModality = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolChoiceConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolChoiceConfig.kt index 9682f8914..b07ee6050 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolChoiceConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolChoiceConfig.kt @@ -78,6 +78,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeToolChoiceConfig.accept(new RealtimeToolChoiceConfig.Visitor>() { + * @Override + * public Optional visitToolChoiceOptions(ToolChoiceOptions toolChoiceOptions) { + * return Optional.of(toolChoiceOptions.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { toolChoiceOptions != null -> visitor.visitToolChoiceOptions(toolChoiceOptions) @@ -88,6 +117,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeToolChoiceConfig = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt index d9ec7606d..7180d1535 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt @@ -66,6 +66,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeToolsConfigUnion.accept(new RealtimeToolsConfigUnion.Visitor>() { + * @Override + * public Optional visitFunction(RealtimeFunctionTool function) { + * return Optional.of(function.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { function != null -> visitor.visitFunction(function) @@ -75,6 +104,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeToolsConfigUnion = apply { if (validated) { return@apply @@ -768,6 +805,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mcp = apply { if (validated) { return@apply @@ -845,6 +891,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = allowedTools.accept(new AllowedTools.Visitor>() { + * @Override + * public Optional visitMcp(List mcp) { + * return Optional.of(mcp.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcp != null -> visitor.visitMcp(mcp) @@ -854,6 +930,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllowedTools = apply { if (validated) { return@apply @@ -1174,6 +1260,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): McpToolFilter = apply { if (validated) { return@apply @@ -1369,6 +1465,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConnectorId = apply { if (validated) { return@apply @@ -1472,6 +1578,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -1559,6 +1675,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = requireApproval.accept(new RequireApproval.Visitor>() { + * @Override + * public Optional visitMcpToolApprovalFilter(McpToolApprovalFilter mcpToolApprovalFilter) { + * return Optional.of(mcpToolApprovalFilter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcpToolApprovalFilter != null -> @@ -1570,6 +1716,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RequireApproval = apply { if (validated) { return@apply @@ -1897,6 +2053,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): McpToolApprovalFilter = apply { if (validated) { return@apply @@ -2100,6 +2266,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Always = apply { if (validated) { return@apply @@ -2324,6 +2500,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Never = apply { if (validated) { return@apply @@ -2499,6 +2685,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): McpToolApprovalSetting = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTracingConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTracingConfig.kt index 50e2423dc..604fff36c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTracingConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTracingConfig.kt @@ -63,6 +63,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeTracingConfig.accept(new RealtimeTracingConfig.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -72,6 +101,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTracingConfig = apply { if (validated) { return@apply @@ -405,6 +442,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TracingConfiguration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudio.kt index 7a2213308..7ff527594 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudio.kt @@ -124,6 +124,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTranscriptionSessionAudio = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt index 97255cbf2..4aec9e955 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt @@ -331,6 +331,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTranscriptionSessionAudioInput = apply { if (validated) { return@apply @@ -475,6 +483,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NoiseReduction = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt index 8969e7ea5..0c3a7189c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt @@ -79,6 +79,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeTranscriptionSessionAudioInputTurnDetection.accept(new RealtimeTranscriptionSessionAudioInputTurnDetection.Visitor>() { + * @Override + * public Optional visitServerVad(ServerVad serverVad) { + * return Optional.of(serverVad.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { serverVad != null -> visitor.visitServerVad(serverVad) @@ -88,6 +117,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTranscriptionSessionAudioInputTurnDetection = apply { if (validated) { return@apply @@ -693,6 +730,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServerVad = apply { if (validated) { return@apply @@ -1006,6 +1052,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SemanticVad = apply { if (validated) { return@apply @@ -1154,6 +1209,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Eagerness = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionCreateRequest.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionCreateRequest.kt index 407a2a88e..0ce48ad02 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionCreateRequest.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionCreateRequest.kt @@ -221,6 +221,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTranscriptionSessionCreateRequest = apply { if (validated) { return@apply @@ -340,6 +348,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncation.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncation.kt index 05f6822d3..ff871571a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncation.kt @@ -83,6 +83,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = realtimeTruncation.accept(new RealtimeTruncation.Visitor>() { + * @Override + * public Optional visitStrategy(RealtimeTruncationStrategy strategy) { + * return Optional.of(strategy.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { strategy != null -> visitor.visitStrategy(strategy) @@ -92,6 +121,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTruncation = apply { if (validated) { return@apply @@ -358,6 +395,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTruncationStrategy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncationRetentionRatio.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncationRetentionRatio.kt index a1fb9cf82..d621e7876 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncationRetentionRatio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTruncationRetentionRatio.kt @@ -229,6 +229,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTruncationRetentionRatio = apply { if (validated) { return@apply @@ -382,6 +390,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TokenLimits = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDeltaEvent.kt index 74f5a535f..3bbc8ad5a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDeltaEvent.kt @@ -339,6 +339,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDoneEvent.kt index 6be20e648..2a9789879 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioDoneEvent.kt @@ -309,6 +309,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDeltaEvent.kt index a7c4cf708..464a31f84 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDeltaEvent.kt @@ -342,6 +342,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioTranscriptDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDoneEvent.kt index 8b291c5bf..55a54bf46 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseAudioTranscriptDoneEvent.kt @@ -357,6 +357,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioTranscriptDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCancelEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCancelEvent.kt index 26691d400..71b987f6f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCancelEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCancelEvent.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCancelEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartAddedEvent.kt index 2816fad45..b9fdf2902 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartAddedEvent.kt @@ -346,6 +346,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseContentPartAddedEvent = apply { if (validated) { return@apply @@ -585,6 +593,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Part = apply { if (validated) { return@apply @@ -708,6 +725,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartDoneEvent.kt index 4b2686f4d..f8e35c4ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseContentPartDoneEvent.kt @@ -345,6 +345,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseContentPartDoneEvent = apply { if (validated) { return@apply @@ -584,6 +592,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Part = apply { if (validated) { return@apply @@ -707,6 +724,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreateEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreateEvent.kt index 2753f3735..145d05e10 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreateEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreateEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCreateEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreatedEvent.kt index 2150339a8..8a4edb390 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseCreatedEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCreatedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseDoneEvent.kt index 6af103ae5..32e7c3f3f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseDoneEvent.kt @@ -212,6 +212,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDeltaEvent.kt index da6b64e51..eb37f0f2f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDeltaEvent.kt @@ -338,6 +338,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionCallArgumentsDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDoneEvent.kt index 7948fe5be..407540153 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseFunctionCallArgumentsDoneEvent.kt @@ -385,6 +385,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionCallArgumentsDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDelta.kt index 1e1b916a3..297085e43 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDelta.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDelta.kt @@ -341,6 +341,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallArgumentsDelta = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDone.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDone.kt index 886ecff78..261e57eec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDone.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallArgumentsDone.kt @@ -302,6 +302,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallArgumentsDone = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallCompleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallCompleted.kt index 4ce981a8e..99ee2f178 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallCompleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallCompleted.kt @@ -232,6 +232,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallCompleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallFailed.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallFailed.kt index 2c53ad190..921e93010 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallFailed.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallFailed.kt @@ -232,6 +232,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallFailed = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallInProgress.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallInProgress.kt index 950743a99..7fbfca590 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallInProgress.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseMcpCallInProgress.kt @@ -232,6 +232,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallInProgress = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt index c4ccaa4ce..bcc414416 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt @@ -373,6 +373,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputItemAddedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt index 3ada0963b..e67138100 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt @@ -376,6 +376,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputItemDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDeltaEvent.kt index d9a6dd080..6c11c105a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDeltaEvent.kt @@ -339,6 +339,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseTextDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDoneEvent.kt index 7d7350889..2753b5004 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseTextDoneEvent.kt @@ -342,6 +342,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseTextDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionCreatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionCreatedEvent.kt index b0c6200fd..2b8672e60 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionCreatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionCreatedEvent.kt @@ -232,6 +232,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SessionCreatedEvent = apply { if (validated) { return@apply @@ -305,6 +313,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = session.accept(new Session.Visitor>() { + * @Override + * public Optional visitRealtimeSessionCreateRequest(RealtimeSessionCreateRequest realtimeSessionCreateRequest) { + * return Optional.of(realtimeSessionCreateRequest.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtimeSessionCreateRequest != null -> @@ -318,6 +355,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdateEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdateEvent.kt index ec4df7bd6..b3ebf6fd3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdateEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdateEvent.kt @@ -245,6 +245,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SessionUpdateEvent = apply { if (validated) { return@apply @@ -318,6 +326,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = session.accept(new Session.Visitor>() { + * @Override + * public Optional visitRealtimeSessionCreateRequest(RealtimeSessionCreateRequest realtimeSessionCreateRequest) { + * return Optional.of(realtimeSessionCreateRequest.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtimeSessionCreateRequest != null -> @@ -331,6 +368,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdatedEvent.kt index e24a81fd7..ffe550807 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/SessionUpdatedEvent.kt @@ -229,6 +229,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SessionUpdatedEvent = apply { if (validated) { return@apply @@ -302,6 +310,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = session.accept(new Session.Visitor>() { + * @Override + * public Optional visitRealtimeSessionCreateRequest(RealtimeSessionCreateRequest realtimeSessionCreateRequest) { + * return Optional.of(realtimeSessionCreateRequest.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtimeSessionCreateRequest != null -> @@ -315,6 +352,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdate.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdate.kt index 1ac477ed3..f92390507 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdate.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdate.kt @@ -199,6 +199,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionSessionUpdate = apply { if (validated) { return@apply @@ -556,6 +564,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply @@ -681,6 +698,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply @@ -825,6 +852,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioFormat = apply { if (validated) { return@apply @@ -983,6 +1020,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudioNoiseReduction = apply { if (validated) { return@apply @@ -1275,6 +1322,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TurnDetection = apply { if (validated) { return@apply @@ -1398,6 +1455,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt index b0b17016c..5f5cd2305 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt @@ -217,6 +217,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TranscriptionSessionUpdatedEvent = apply { if (validated) { return@apply @@ -574,6 +582,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply @@ -782,6 +799,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ClientSecret = apply { if (validated) { return@apply @@ -924,6 +951,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Modality = apply { if (validated) { return@apply @@ -1206,6 +1243,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TurnDetection = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallReferParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallReferParams.kt index ccec151d4..ca25dfd68 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallReferParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallReferParams.kt @@ -385,6 +385,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallRejectParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallRejectParams.kt index e625d3ac8..ff7394197 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallRejectParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/calls/CallRejectParams.kt @@ -353,6 +353,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParams.kt index 531bb4f32..1ca9b3361 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParams.kt @@ -470,6 +470,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -666,6 +675,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -785,6 +803,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Anchor = apply { if (validated) { return@apply @@ -875,6 +903,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = session.accept(new Session.Visitor>() { + * @Override + * public Optional visitRealtime(RealtimeSessionCreateRequest realtime) { + * return Optional.of(realtime.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtime != null -> visitor.visitRealtime(realtime) @@ -884,6 +941,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt index 6f7fb659d..e28e6c050 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt @@ -227,6 +227,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ClientSecretCreateResponse = apply { if (validated) { return@apply @@ -293,6 +301,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = session.accept(new Session.Visitor>() { + * @Override + * public Optional visitRealtime(RealtimeSessionCreateResponse realtime) { + * return Optional.of(realtime.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtime != null -> visitor.visitRealtime(realtime) @@ -302,6 +339,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Session = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt index 5258ce423..3928ac73c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt @@ -170,6 +170,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeSessionClientSecret = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt index f35310cf2..b9b5483bd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt @@ -784,6 +784,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeSessionCreateResponse = apply { if (validated) { return@apply @@ -962,6 +970,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Audio = apply { if (validated) { return@apply @@ -1306,6 +1323,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -1461,6 +1488,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): NoiseReduction = apply { if (validated) { return@apply @@ -1558,6 +1595,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = turnDetection.accept(new TurnDetection.Visitor>() { + * @Override + * public Optional visitServerVad(ServerVad serverVad) { + * return Optional.of(serverVad.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { serverVad != null -> visitor.visitServerVad(serverVad) @@ -1567,6 +1634,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): TurnDetection = apply { if (validated) { return@apply @@ -2174,6 +2251,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): ServerVad = apply { if (validated) { return@apply @@ -2504,6 +2591,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): SemanticVad = apply { if (validated) { return@apply @@ -2657,6 +2754,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Eagerness = apply { if (validated) { return@apply @@ -2969,6 +3076,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -3147,6 +3264,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Voice = apply { if (validated) { return@apply @@ -3311,6 +3438,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply @@ -3377,6 +3513,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxOutputTokens.accept(new MaxOutputTokens.Visitor>() { + * @Override + * public Optional visitInteger(Long integer) { + * return Optional.of(integer.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { integer != null -> visitor.visitInteger(integer) @@ -3386,6 +3551,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MaxOutputTokens = apply { if (validated) { return@apply @@ -3710,6 +3884,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -3839,6 +4022,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputModality = apply { if (validated) { return@apply @@ -3935,6 +4127,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolChoice.accept(new ToolChoice.Visitor>() { + * @Override + * public Optional visitOptions(ToolChoiceOptions options) { + * return Optional.of(options.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { options != null -> visitor.visitOptions(options) @@ -3945,6 +4166,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply @@ -4172,6 +4402,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitRealtimeFunction(RealtimeFunctionTool realtimeFunction) { + * return Optional.of(realtimeFunction.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { realtimeFunction != null -> visitor.visitRealtimeFunction(realtimeFunction) @@ -4181,6 +4440,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -4899,6 +5167,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpTool = apply { if (validated) { return@apply @@ -4976,6 +5254,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = allowedTools.accept(new AllowedTools.Visitor>() { + * @Override + * public Optional visitMcp(List mcp) { + * return Optional.of(mcp.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcp != null -> visitor.visitMcp(mcp) @@ -4985,6 +5293,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AllowedTools = apply { if (validated) { return@apply @@ -5312,6 +5630,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): McpToolFilter = apply { if (validated) { return@apply @@ -5508,6 +5836,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ConnectorId = apply { if (validated) { return@apply @@ -5611,6 +5949,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -5700,6 +6048,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = requireApproval.accept(new RequireApproval.Visitor>() { + * @Override + * public Optional visitMcpToolApprovalFilter(McpToolApprovalFilter mcpToolApprovalFilter) { + * return Optional.of(mcpToolApprovalFilter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcpToolApprovalFilter != null -> @@ -5711,6 +6089,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequireApproval = apply { if (validated) { return@apply @@ -6056,6 +6444,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): McpToolApprovalFilter = apply { if (validated) { return@apply @@ -6264,6 +6662,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Always = apply { if (validated) { return@apply @@ -6493,6 +6901,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Never = apply { if (validated) { return@apply @@ -6670,6 +7088,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): McpToolApprovalSetting = apply { if (validated) { return@apply @@ -6791,6 +7219,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tracing.accept(new Tracing.Visitor>() { + * @Override + * public Optional visitAuto(JsonValue auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -6800,6 +7257,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tracing = apply { if (validated) { return@apply @@ -7138,6 +7604,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TracingConfiguration = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionCreateResponse.kt index f3a4a6a88..6722b5c8e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionCreateResponse.kt @@ -323,6 +323,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTranscriptionSessionCreateResponse = apply { if (validated) { return@apply @@ -459,6 +467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Audio = apply { if (validated) { return@apply @@ -741,6 +758,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -890,6 +917,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): NoiseReduction = apply { if (validated) { return@apply @@ -1065,6 +1102,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Include = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionTurnDetection.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionTurnDetection.kt index c05a864b9..d890eedb4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionTurnDetection.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeTranscriptionSessionTurnDetection.kt @@ -252,6 +252,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RealtimeTranscriptionSessionTurnDetection = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ApplyPatchTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ApplyPatchTool.kt index dab78e8b9..cc894ca70 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ApplyPatchTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ApplyPatchTool.kt @@ -112,6 +112,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApplyPatchTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt index 8dff8c36f..bbf8835d2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt @@ -435,6 +435,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CompactedResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt index 819dbe50c..82df820fd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt @@ -121,6 +121,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = computerAction.accept(new ComputerAction.Visitor>() { + * @Override + * public Optional visitClick(Click click) { + * return Optional.of(click.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { click != null -> visitor.visitClick(click) @@ -137,6 +166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComputerAction = apply { if (validated) { return@apply @@ -701,6 +738,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Click = apply { if (validated) { return@apply @@ -853,6 +899,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Button = apply { if (validated) { return@apply @@ -1148,6 +1204,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DoubleClick = apply { if (validated) { return@apply @@ -1434,6 +1499,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Drag = apply { if (validated) { return@apply @@ -1625,6 +1699,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Path = apply { if (validated) { return@apply @@ -1857,6 +1941,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Keypress = apply { if (validated) { return@apply @@ -2139,6 +2232,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Move = apply { if (validated) { return@apply @@ -2495,6 +2597,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Scroll = apply { if (validated) { return@apply @@ -2706,6 +2817,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerTool.kt index ec857f569..43360b860 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerTool.kt @@ -115,6 +115,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComputerTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerUsePreviewTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerUsePreviewTool.kt index ca5da9593..17ef58164 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerUsePreviewTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerUsePreviewTool.kt @@ -253,6 +253,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComputerUsePreviewTool = apply { if (validated) { return@apply @@ -398,6 +406,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Environment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt index 4810d0b1e..5ab2bb0c6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt @@ -342,6 +342,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerAuto = apply { if (validated) { return@apply @@ -483,6 +491,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): MemoryLimit = apply { if (validated) { return@apply @@ -545,6 +562,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = networkPolicy.accept(new NetworkPolicy.Visitor>() { + * @Override + * public Optional visitDisabled(ContainerNetworkPolicyDisabled disabled) { + * return Optional.of(disabled.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { disabled != null -> visitor.visitDisabled(disabled) @@ -554,6 +600,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NetworkPolicy = apply { if (validated) { return@apply @@ -726,6 +781,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = skill.accept(new Skill.Visitor>() { + * @Override + * public Optional visitReference(SkillReference reference) { + * return Optional.of(reference.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { reference != null -> visitor.visitReference(reference) @@ -735,6 +819,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Skill = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt index da6882610..62ed15055 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt @@ -245,6 +245,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerNetworkPolicyAllowlist = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt index 04d163f60..a3e14cd8d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt @@ -116,6 +116,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerNetworkPolicyDisabled = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt index b0a646c7f..c46842248 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt @@ -199,6 +199,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerNetworkPolicyDomainSecret = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt index a4c48a57e..0d45d9150 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerReference = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/CustomTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/CustomTool.kt index fbd6090d7..b18c0447d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/CustomTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/CustomTool.kt @@ -282,6 +282,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CustomTool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/EasyInputMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/EasyInputMessage.kt index b15c1c641..9a5d5ff5f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/EasyInputMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/EasyInputMessage.kt @@ -272,6 +272,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EasyInputMessage = apply { if (validated) { return@apply @@ -337,6 +345,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitTextInput(String textInput) { + * return Optional.of(textInput.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { textInput != null -> visitor.visitTextInput(textInput) @@ -347,6 +384,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -611,6 +657,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -742,6 +797,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Phase = apply { if (validated) { return@apply @@ -862,6 +926,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/FileSearchTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/FileSearchTool.kt index 20254d9c1..2a224c701 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/FileSearchTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/FileSearchTool.kt @@ -326,6 +326,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileSearchTool = apply { if (validated) { return@apply @@ -398,6 +406,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = filters.accept(new Filters.Visitor>() { + * @Override + * public Optional visitComparisonFilter(ComparisonFilter comparisonFilter) { + * return Optional.of(comparisonFilter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { comparisonFilter != null -> visitor.visitComparisonFilter(comparisonFilter) @@ -407,6 +444,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Filters = apply { if (validated) { return@apply @@ -757,6 +803,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RankingOptions = apply { if (validated) { return@apply @@ -962,6 +1017,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): HybridSearch = apply { if (validated) { return@apply @@ -1104,6 +1169,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Ranker = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt index e29d6357f..caf8a80fb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt @@ -188,6 +188,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionShellTool = apply { if (validated) { return@apply @@ -252,6 +260,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = environment.accept(new Environment.Visitor>() { + * @Override + * public Optional visitContainerAuto(ContainerAuto containerAuto) { + * return Optional.of(containerAuto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { containerAuto != null -> visitor.visitContainerAuto(containerAuto) @@ -262,6 +299,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Environment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionTool.kt index c20ed4bc2..6399d2048 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionTool.kt @@ -332,6 +332,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionTool = apply { if (validated) { return@apply @@ -431,6 +439,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Parameters = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt index dfb4b39a8..194c9345c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt @@ -235,6 +235,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InlineSkill = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt index bf1d7c497..5abdcd7a0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt @@ -195,6 +195,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InlineSkillSource = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt index 8f475f83f..e4395fb44 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt @@ -168,6 +168,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalEnvironment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt index a63f90035..a03e8f0e4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt @@ -199,6 +199,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalSkill = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/NamespaceTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/NamespaceTool.kt index 7c0e1adcf..7291779ca 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/NamespaceTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/NamespaceTool.kt @@ -285,6 +285,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): NamespaceTool = apply { if (validated) { return@apply @@ -353,6 +361,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitFunction(Function function) { + * return Optional.of(function.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { function != null -> visitor.visitFunction(function) @@ -362,6 +399,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -786,6 +832,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt index 9f6232bc0..be4e38dd3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt @@ -1972,6 +1972,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Response = apply { if (validated) { return@apply @@ -2164,6 +2172,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IncompleteDetails = apply { if (validated) { return@apply @@ -2281,6 +2298,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Reason = apply { if (validated) { return@apply @@ -2371,6 +2398,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = instructions.accept(new Instructions.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -2380,6 +2436,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Instructions = apply { if (validated) { return@apply @@ -2599,6 +2664,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2749,6 +2823,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolChoice.accept(new ToolChoice.Visitor>() { + * @Override + * public Optional visitOptions(ToolChoiceOptions options) { + * return Optional.of(options.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { options != null -> visitor.visitOptions(options) @@ -2764,6 +2867,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply @@ -3168,6 +3280,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply @@ -3308,6 +3429,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PromptCacheRetention = apply { if (validated) { return@apply @@ -3469,6 +3599,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceTier = apply { if (validated) { return@apply @@ -3604,6 +3743,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Truncation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt index b406fb42d..887288bc6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt @@ -337,6 +337,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseApplyPatchToolCall = apply { if (validated) { return@apply @@ -414,6 +422,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = operation.accept(new Operation.Visitor>() { + * @Override + * public Optional visitCreateFile(CreateFile createFile) { + * return Optional.of(createFile.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { createFile != null -> visitor.visitCreateFile(createFile) @@ -424,6 +461,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Operation = apply { if (validated) { return@apply @@ -771,6 +817,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreateFile = apply { if (validated) { return@apply @@ -981,6 +1037,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DeleteFile = apply { if (validated) { return@apply @@ -1221,6 +1287,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UpdateFile = apply { if (validated) { return@apply @@ -1367,6 +1443,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt index 86d82ee45..e6f757a3e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt @@ -305,6 +305,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseApplyPatchToolCallOutput = apply { if (validated) { return@apply @@ -433,6 +441,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDeltaEvent.kt index 7e728c79e..7a0d71bdf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDeltaEvent.kt @@ -203,6 +203,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDoneEvent.kt index 4d9637071..631724afd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioDoneEvent.kt @@ -170,6 +170,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDeltaEvent.kt index 274be83c8..b7726220b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDeltaEvent.kt @@ -206,6 +206,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioTranscriptDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDoneEvent.kt index cad4eb918..2601cad74 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseAudioTranscriptDoneEvent.kt @@ -173,6 +173,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseAudioTranscriptDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDeltaEvent.kt index cb95f3f9f..1ed4dbcd2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDeltaEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCodeInterpreterCallCodeDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDoneEvent.kt index d19d01139..23a217db6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCodeDoneEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCodeInterpreterCallCodeDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCompletedEvent.kt index 90adb8223..9d81d5812 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallCompletedEvent.kt @@ -247,6 +247,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCodeInterpreterCallCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInProgressEvent.kt index 828c44529..b7ecdc7bc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInProgressEvent.kt @@ -247,6 +247,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCodeInterpreterCallInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInterpretingEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInterpretingEvent.kt index 3b02758f0..809dedb11 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInterpretingEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterCallInterpretingEvent.kt @@ -248,6 +248,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCodeInterpreterCallInterpretingEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterToolCall.kt index aca21303d..84e7575c1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCodeInterpreterToolCall.kt @@ -375,6 +375,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCodeInterpreterToolCall = apply { if (validated) { return@apply @@ -443,6 +451,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = output.accept(new Output.Visitor>() { + * @Override + * public Optional visitLogs(Logs logs) { + * return Optional.of(logs.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { logs != null -> visitor.visitLogs(logs) @@ -452,6 +489,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -736,6 +782,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logs = apply { if (validated) { return@apply @@ -937,6 +993,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Image = apply { if (validated) { return@apply @@ -1099,6 +1165,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactParams.kt index ef4fd6d57..bd5b52eff 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactParams.kt @@ -869,6 +869,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1574,6 +1583,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -1642,6 +1660,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1651,6 +1698,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -1899,6 +1955,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PromptCacheRetention = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItem.kt index 4003659d4..4572f4c64 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItem.kt @@ -241,6 +241,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCompactionItem = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItemParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItemParam.kt index 01abddaaa..c97e56c00 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItemParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompactionItemParam.kt @@ -211,6 +211,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCompactionItemParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompletedEvent.kt index a57e07bbf..5c994b98c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCompletedEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCall.kt index 5c043840c..365f6eeab 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCall.kt @@ -515,6 +515,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseComputerToolCall = apply { if (validated) { return@apply @@ -740,6 +748,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PendingSafetyCheck = apply { if (validated) { return@apply @@ -888,6 +905,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1008,6 +1034,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1137,6 +1172,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = action.accept(new Action.Visitor>() { + * @Override + * public Optional visitClick(Click click) { + * return Optional.of(click.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { click != null -> visitor.visitClick(click) @@ -1153,6 +1217,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -1727,6 +1800,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Click = apply { if (validated) { return@apply @@ -1881,6 +1964,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Button = apply { if (validated) { return@apply @@ -2185,6 +2278,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DoubleClick = apply { if (validated) { return@apply @@ -2483,6 +2586,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Drag = apply { if (validated) { return@apply @@ -2674,6 +2787,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Path = apply { if (validated) { return@apply @@ -2917,6 +3040,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Keypress = apply { if (validated) { return@apply @@ -3208,6 +3341,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Move = apply { if (validated) { return@apply @@ -3582,6 +3725,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Scroll = apply { if (validated) { return@apply @@ -3797,6 +3950,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputItem.kt index 3b80ac368..87f6f21a8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputItem.kt @@ -372,6 +372,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseComputerToolCallOutputItem = apply { if (validated) { return@apply @@ -517,6 +525,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -742,6 +759,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AcknowledgedSafetyCheck = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputScreenshot.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputScreenshot.kt index b39ae27f6..2197468d1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputScreenshot.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseComputerToolCallOutputScreenshot.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseComputerToolCallOutputScreenshot = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt index 5cdb5d869..e8d23463c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt @@ -165,6 +165,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseContainerReference = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt index 99610ff13..75e055cdf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt @@ -97,6 +97,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseContent.accept(new ResponseContent.Visitor>() { + * @Override + * public Optional visitInputText(ResponseInputText inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -110,6 +139,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseContent = apply { if (validated) { return@apply @@ -493,6 +530,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReasoningTextContent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartAddedEvent.kt index 7a7e5ad8b..716f63ef6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartAddedEvent.kt @@ -353,6 +353,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseContentPartAddedEvent = apply { if (validated) { return@apply @@ -430,6 +438,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = part.accept(new Part.Visitor>() { + * @Override + * public Optional visitOutputText(ResponseOutputText outputText) { + * return Optional.of(outputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { outputText != null -> visitor.visitOutputText(outputText) @@ -440,6 +477,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Part = apply { if (validated) { return@apply @@ -753,6 +799,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReasoningText = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartDoneEvent.kt index 615224827..52f7f2cf2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContentPartDoneEvent.kt @@ -352,6 +352,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseContentPartDoneEvent = apply { if (validated) { return@apply @@ -429,6 +437,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = part.accept(new Part.Visitor>() { + * @Override + * public Optional visitOutputText(ResponseOutputText outputText) { + * return Optional.of(outputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { outputText != null -> visitor.visitOutputText(outputText) @@ -439,6 +476,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Part = apply { if (validated) { return@apply @@ -752,6 +798,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ReasoningText = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConversationParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConversationParam.kt index 1463c2307..b3f004127 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConversationParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConversationParam.kt @@ -128,6 +128,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseConversationParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt index 3ccd58813..4013b9f2d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt @@ -3384,6 +3384,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -3712,6 +3721,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContextManagement = apply { if (validated) { return@apply @@ -3796,6 +3814,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = conversation.accept(new Conversation.Visitor>() { + * @Override + * public Optional visitId(String id) { + * return Optional.of(id.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { id != null -> visitor.visitId(id) @@ -3806,6 +3853,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply @@ -3999,6 +4055,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -4008,6 +4093,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -4222,6 +4316,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -4361,6 +4464,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PromptCacheRetention = apply { if (validated) { return@apply @@ -4522,6 +4634,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceTier = apply { if (validated) { return@apply @@ -4681,6 +4802,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StreamOptions = apply { if (validated) { return@apply @@ -4834,6 +4964,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolChoice.accept(new ToolChoice.Visitor>() { + * @Override + * public Optional visitOptions(ToolChoiceOptions options) { + * return Optional.of(options.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { options != null -> visitor.visitOptions(options) @@ -4849,6 +5008,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply @@ -5233,6 +5401,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Truncation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreatedEvent.kt index ac3a23749..a0c6f6e36 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreatedEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCreatedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCall.kt index 74ff77e2b..a76c9a7b3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCall.kt @@ -293,6 +293,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCustomToolCall = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDeltaEvent.kt index 5c547788d..b06fb0eec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDeltaEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCustomToolCallInputDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDoneEvent.kt index 8d68584c2..22344daaf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallInputDoneEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCustomToolCallInputDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallItem.kt index 3114663a6..f099b0c0b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallItem.kt @@ -374,6 +374,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCustomToolCallItem = apply { if (validated) { return@apply @@ -515,6 +523,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutput.kt index 880ff57eb..fcf6f86c5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutput.kt @@ -252,6 +252,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCustomToolCallOutput = apply { if (validated) { return@apply @@ -321,6 +329,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = output.accept(new Output.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -330,6 +367,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -521,6 +567,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = functionAndCustomToolCallOutput.accept(new FunctionAndCustomToolCallOutput.Visitor>() { + * @Override + * public Optional visitInputText(ResponseInputText inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -531,6 +607,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionAndCustomToolCallOutput = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutputItem.kt index 1e1132940..bec077d39 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCustomToolCallOutputItem.kt @@ -334,6 +334,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseCustomToolCallOutputItem = apply { if (validated) { return@apply @@ -471,6 +479,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseError.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseError.kt index b617ce19b..011de28b3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseError.kt @@ -166,6 +166,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseError = apply { if (validated) { return@apply @@ -377,6 +385,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Code = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseErrorEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseErrorEvent.kt index 9f1313b95..190119a1a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseErrorEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseErrorEvent.kt @@ -277,6 +277,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseErrorEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFailedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFailedEvent.kt index bfcd94fce..0bc1f67ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFailedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFailedEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFailedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallCompletedEvent.kt index 73140f73d..2c92fcfaf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallCompletedEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFileSearchCallCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallInProgressEvent.kt index 083c74e29..4e2895900 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallInProgressEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFileSearchCallInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallSearchingEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallSearchingEvent.kt index 01a793f1f..3d4f4ab3c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallSearchingEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchCallSearchingEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFileSearchCallSearchingEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchToolCall.kt index ca62894ad..4dc2cfea5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFileSearchToolCall.kt @@ -308,6 +308,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFileSearchToolCall = apply { if (validated) { return@apply @@ -455,6 +463,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -744,6 +761,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Result = apply { if (validated) { return@apply @@ -847,6 +873,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextConfig.kt index 7ce8ad834..3c366c728 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextConfig.kt @@ -84,6 +84,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseFormatTextConfig.accept(new ResponseFormatTextConfig.Visitor>() { + * @Override + * public Optional visitText(ResponseFormatText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -94,6 +123,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatTextConfig = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextJsonSchemaConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextJsonSchemaConfig.kt index 774a2434a..9f058e76f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextJsonSchemaConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFormatTextJsonSchemaConfig.kt @@ -300,6 +300,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormatTextJsonSchemaConfig = apply { if (validated) { return@apply @@ -400,6 +408,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDeltaEvent.kt index 2d733f1cd..b668cac92 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDeltaEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionCallArgumentsDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDoneEvent.kt index 381087651..3b367d1a1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallArgumentsDoneEvent.kt @@ -308,6 +308,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionCallArgumentsDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItem.kt index 419072862..3ac7cd006 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItem.kt @@ -61,6 +61,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseFunctionCallOutputItem.accept(new ResponseFunctionCallOutputItem.Visitor>() { + * @Override + * public Optional visitInputText(ResponseInputTextContent inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -71,6 +100,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionCallOutputItem = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellCallOutputContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellCallOutputContent.kt index 869c8142d..feb1b2e0e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellCallOutputContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellCallOutputContent.kt @@ -229,6 +229,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionShellCallOutputContent = apply { if (validated) { return@apply @@ -287,6 +295,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = outcome.accept(new Outcome.Visitor>() { + * @Override + * public Optional visitTimeout(JsonValue timeout) { + * return Optional.of(timeout.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { timeout != null -> visitor.visitTimeout(timeout) @@ -296,6 +333,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Outcome = apply { if (validated) { return@apply @@ -599,6 +645,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Exit = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt index 132d87cff..1fdb5151d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt @@ -374,6 +374,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionShellToolCall = apply { if (validated) { return@apply @@ -647,6 +655,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -730,6 +747,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = environment.accept(new Environment.Visitor>() { + * @Override + * public Optional visitLocal(ResponseLocalEnvironment local) { + * return Optional.of(local.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { local != null -> visitor.visitLocal(local) @@ -739,6 +785,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Environment = apply { if (validated) { return@apply @@ -981,6 +1036,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCallOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCallOutput.kt index 9c78d2819..5ae88e05d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCallOutput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCallOutput.kt @@ -386,6 +386,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionShellToolCallOutput = apply { if (validated) { return@apply @@ -668,6 +676,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -732,6 +749,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = outcome.accept(new Outcome.Visitor>() { + * @Override + * public Optional visitTimeout(JsonValue timeout) { + * return Optional.of(timeout.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { timeout != null -> visitor.visitTimeout(timeout) @@ -741,6 +788,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Outcome = apply { if (validated) { return@apply @@ -1047,6 +1104,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Exit = apply { if (validated) { return@apply @@ -1219,6 +1286,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt index f59d8c5aa..f17f059db 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt @@ -351,6 +351,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionToolCall = apply { if (validated) { return@apply @@ -490,6 +498,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallItem.kt index be65fe1a6..27c187fb6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallItem.kt @@ -385,6 +385,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionToolCallItem = apply { if (validated) { return@apply @@ -526,6 +534,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallOutputItem.kt index 2b330e0f3..d8be6b049 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCallOutputItem.kt @@ -326,6 +326,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionToolCallOutputItem = apply { if (validated) { return@apply @@ -399,6 +407,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = output.accept(new Output.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -408,6 +445,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -599,6 +645,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = functionAndCustomToolCallOutput.accept(new FunctionAndCustomToolCallOutput.Visitor>() { + * @Override + * public Optional visitInputText(ResponseInputText inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -609,6 +685,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionAndCustomToolCallOutput = apply { if (validated) { return@apply @@ -895,6 +981,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt index e5f8a66de..edf29d553 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt @@ -271,6 +271,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFunctionWebSearch = apply { if (validated) { return@apply @@ -347,6 +355,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = action.accept(new Action.Visitor>() { + * @Override + * public Optional visitSearch(Search search) { + * return Optional.of(search.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { search != null -> visitor.visitSearch(search) @@ -357,6 +394,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -767,6 +813,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Search = apply { if (validated) { return@apply @@ -953,6 +1009,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Source = apply { if (validated) { return@apply @@ -1164,6 +1230,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OpenPage = apply { if (validated) { return@apply @@ -1406,6 +1482,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Find = apply { if (validated) { return@apply @@ -1564,6 +1650,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallCompletedEvent.kt index 5abe85fb1..ccb5bd92d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallCompletedEvent.kt @@ -242,6 +242,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseImageGenCallCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallGeneratingEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallGeneratingEvent.kt index 605324dfe..0498bf957 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallGeneratingEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallGeneratingEvent.kt @@ -245,6 +245,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseImageGenCallGeneratingEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallInProgressEvent.kt index dfe6cea13..d0d01f93e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallInProgressEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseImageGenCallInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallPartialImageEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallPartialImageEvent.kt index 0407758e3..9e835fec7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallPartialImageEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseImageGenCallPartialImageEvent.kt @@ -337,6 +337,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseImageGenCallPartialImageEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInProgressEvent.kt index d42f961d4..087f6ae68 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInProgressEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt index df8ddfbc9..a0b7586b2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt @@ -147,6 +147,14 @@ class ResponseIncludable @JsonCreator private constructor(private val value: Jso private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseIncludable = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncompleteEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncompleteEvent.kt index ede56de1f..8e1c66807 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncompleteEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncompleteEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseIncompleteEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt index 9bdb93fdb..666222f08 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt @@ -167,6 +167,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputAudio = apply { if (validated) { return@apply @@ -349,6 +357,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputAudio = apply { if (validated) { return@apply @@ -470,6 +487,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Format = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt index 252ffec1a..bc1823645 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt @@ -61,6 +61,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseInputContent.accept(new ResponseInputContent.Visitor>() { + * @Override + * public Optional visitInputText(ResponseInputText inputText) { + * return Optional.of(inputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputText != null -> visitor.visitInputText(inputText) @@ -71,6 +100,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputContent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt index e09506c77..d17dbf0f5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt @@ -282,6 +282,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputFile = apply { if (validated) { return@apply @@ -413,6 +421,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt index 14222ea69..ff23d8824 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt @@ -291,6 +291,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputFileContent = apply { if (validated) { return@apply @@ -422,6 +430,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt index 0b64ced6c..3a56242f7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt @@ -245,6 +245,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputImage = apply { if (validated) { return@apply @@ -384,6 +392,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt index b8a07e04c..8da8b949a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt @@ -235,6 +235,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputImageContent = apply { if (validated) { return@apply @@ -374,6 +382,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Detail = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt index 5f6309884..6d293840a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt @@ -380,6 +380,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseInputItem.accept(new ResponseInputItem.Visitor>() { + * @Override + * public Optional visitEasyInputMessage(EasyInputMessage easyInputMessage) { + * return Optional.of(easyInputMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { easyInputMessage != null -> visitor.visitEasyInputMessage(easyInputMessage) @@ -416,6 +445,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputItem = apply { if (validated) { return@apply @@ -1567,6 +1604,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Message = apply { if (validated) { return@apply @@ -1696,6 +1742,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -1835,6 +1891,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1957,6 +2023,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -2351,6 +2427,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ComputerCallOutput = apply { if (validated) { return@apply @@ -2588,6 +2673,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AcknowledgedSafetyCheck = apply { if (validated) { return@apply @@ -2742,6 +2837,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3096,6 +3201,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FunctionCallOutput = apply { if (validated) { return@apply @@ -3168,6 +3282,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = output.accept(new Output.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -3180,6 +3324,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -3448,6 +3602,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3785,6 +3949,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolSearchCall = apply { if (validated) { return@apply @@ -3918,6 +4091,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Execution = apply { if (validated) { return@apply @@ -4054,6 +4237,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -4337,6 +4530,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenerationCall = apply { if (validated) { return@apply @@ -4478,6 +4680,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -4790,6 +5002,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCall = apply { if (validated) { return@apply @@ -5165,6 +5386,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -5268,6 +5499,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Env = apply { if (validated) { return@apply @@ -5442,6 +5683,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -5722,6 +5973,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCallOutput = apply { if (validated) { return@apply @@ -5857,6 +6117,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -6237,6 +6507,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ShellCall = apply { if (validated) { return@apply @@ -6522,6 +6801,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -6601,6 +6890,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = environment.accept(new Environment.Visitor>() { + * @Override + * public Optional visitLocal(LocalEnvironment local) { + * return Optional.of(local.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { local != null -> visitor.visitLocal(local) @@ -6611,6 +6930,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Environment = apply { if (validated) { return@apply @@ -6854,6 +7183,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -7250,6 +7589,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ShellCallOutput = apply { if (validated) { return@apply @@ -7389,6 +7737,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -7734,6 +8092,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApplyPatchCall = apply { if (validated) { return@apply @@ -7810,6 +8177,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = operation.accept(new Operation.Visitor>() { + * @Override + * public Optional visitCreateFile(CreateFile createFile) { + * return Optional.of(createFile.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { createFile != null -> visitor.visitCreateFile(createFile) @@ -7820,6 +8217,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Operation = apply { if (validated) { return@apply @@ -8177,6 +8584,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): CreateFile = apply { if (validated) { return@apply @@ -8390,6 +8807,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DeleteFile = apply { if (validated) { return@apply @@ -8636,6 +9063,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): UpdateFile = apply { if (validated) { return@apply @@ -8786,6 +9223,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -9109,6 +9556,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ApplyPatchCallOutput = apply { if (validated) { return@apply @@ -9240,6 +9696,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -9574,6 +10040,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListTools = apply { if (validated) { return@apply @@ -9824,6 +10299,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -10159,6 +10644,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalRequest = apply { if (validated) { return@apply @@ -10483,6 +10977,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalResponse = apply { if (validated) { return@apply @@ -10975,6 +11478,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpCall = apply { if (validated) { return@apply @@ -11135,6 +11647,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -11360,6 +11882,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ItemReference = apply { if (validated) { return@apply @@ -11472,6 +12003,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt index 83cccebac..3543a67c8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt @@ -321,6 +321,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputMessageItem = apply { if (validated) { return@apply @@ -453,6 +461,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Role = apply { if (validated) { return@apply @@ -588,6 +605,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt index 3c2fa7867..ae42dc5eb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputText = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt index f5c527270..6206319f2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseInputTextContent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt index 61bfcf591..8b3da9af3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt @@ -338,6 +338,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseItem.accept(new ResponseItem.Visitor>() { + * @Override + * public Optional visitResponseInputMessageItem(ResponseInputMessageItem responseInputMessageItem) { + * return Optional.of(responseInputMessageItem.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { responseInputMessageItem != null -> @@ -373,6 +402,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseItem = apply { if (validated) { return@apply @@ -1407,6 +1444,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenerationCall = apply { if (validated) { return@apply @@ -1548,6 +1594,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1860,6 +1916,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCall = apply { if (validated) { return@apply @@ -2235,6 +2300,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -2338,6 +2413,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Env = apply { if (validated) { return@apply @@ -2512,6 +2597,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -2792,6 +2887,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCallOutput = apply { if (validated) { return@apply @@ -2927,6 +3031,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3260,6 +3374,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListTools = apply { if (validated) { return@apply @@ -3510,6 +3633,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -3845,6 +3978,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalRequest = apply { if (validated) { return@apply @@ -4168,6 +4310,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalResponse = apply { if (validated) { return@apply @@ -4660,6 +4811,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpCall = apply { if (validated) { return@apply @@ -4820,6 +4980,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseLocalEnvironment.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseLocalEnvironment.kt index 719aef2df..bb8b76956 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseLocalEnvironment.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseLocalEnvironment.kt @@ -113,6 +113,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseLocalEnvironment = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDeltaEvent.kt index edfbe1a46..6e865eb34 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDeltaEvent.kt @@ -275,6 +275,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallArgumentsDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDoneEvent.kt index c5daf23d6..d96ebb73a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallArgumentsDoneEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallArgumentsDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallCompletedEvent.kt index ed3ef5ebc..ba79633d6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallCompletedEvent.kt @@ -240,6 +240,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallFailedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallFailedEvent.kt index 1e56fd3c7..c80b91176 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallFailedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallFailedEvent.kt @@ -239,6 +239,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallFailedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallInProgressEvent.kt index 9ad63e5ac..96dab0b32 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpCallInProgressEvent.kt @@ -241,6 +241,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpCallInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsCompletedEvent.kt index 3669d9e99..e652fa00d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsCompletedEvent.kt @@ -242,6 +242,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpListToolsCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsFailedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsFailedEvent.kt index 80b58df1d..44f77741d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsFailedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsFailedEvent.kt @@ -242,6 +242,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpListToolsFailedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsInProgressEvent.kt index ab51bde98..fc9081af8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseMcpListToolsInProgressEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseMcpListToolsInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputAudio.kt index 1295a16d9..94c10132d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputAudio.kt @@ -199,6 +199,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputAudio = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItem.kt index eb7786899..f23a111eb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItem.kt @@ -326,6 +326,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseOutputItem.accept(new ResponseOutputItem.Visitor>() { + * @Override + * public Optional visitMessage(ResponseOutputMessage message) { + * return Optional.of(message.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { message != null -> visitor.visitMessage(message) @@ -358,6 +387,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputItem = apply { if (validated) { return@apply @@ -1354,6 +1391,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGenerationCall = apply { if (validated) { return@apply @@ -1495,6 +1541,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1807,6 +1863,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCall = apply { if (validated) { return@apply @@ -2182,6 +2247,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -2285,6 +2360,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Env = apply { if (validated) { return@apply @@ -2459,6 +2544,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -2739,6 +2834,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LocalShellCallOutput = apply { if (validated) { return@apply @@ -2874,6 +2978,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3364,6 +3478,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpCall = apply { if (validated) { return@apply @@ -3524,6 +3647,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3873,6 +4006,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpListTools = apply { if (validated) { return@apply @@ -4123,6 +4265,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -4458,6 +4610,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalRequest = apply { if (validated) { return@apply @@ -4781,6 +4942,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): McpApprovalResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemAddedEvent.kt index 8187283f8..041dcf7f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemAddedEvent.kt @@ -371,6 +371,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputItemAddedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemDoneEvent.kt index d808aed9d..01301e394 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItemDoneEvent.kt @@ -371,6 +371,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputItemDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputMessage.kt index 70e108a53..dee374f89 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputMessage.kt @@ -357,6 +357,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputMessage = apply { if (validated) { return@apply @@ -429,6 +437,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = content.accept(new Content.Visitor>() { + * @Override + * public Optional visitOutputText(ResponseOutputText outputText) { + * return Optional.of(outputText.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { outputText != null -> visitor.visitOutputText(outputText) @@ -438,6 +475,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -675,6 +721,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -806,6 +861,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Phase = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputRefusal.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputRefusal.kt index 1a5fa7b68..83cd9b1a0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputRefusal.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputRefusal.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputRefusal = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt index 8787d720d..5a5771c1d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt @@ -293,6 +293,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputText = apply { if (validated) { return@apply @@ -377,6 +385,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = annotation.accept(new Annotation.Visitor>() { + * @Override + * public Optional visitFileCitation(FileCitation fileCitation) { + * return Optional.of(fileCitation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { fileCitation != null -> visitor.visitFileCitation(fileCitation) @@ -389,6 +426,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Annotation = apply { if (validated) { return@apply @@ -808,6 +854,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCitation = apply { if (validated) { return@apply @@ -1134,6 +1190,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UrlCitation = apply { if (validated) { return@apply @@ -1515,6 +1581,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContainerFileCitation = apply { if (validated) { return@apply @@ -1779,6 +1855,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FilePath = apply { if (validated) { return@apply @@ -2076,6 +2162,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprob = apply { if (validated) { return@apply @@ -2309,6 +2404,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TopLogprob = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputTextAnnotationAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputTextAnnotationAddedEvent.kt index 63f546c44..4c2cb3e13 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputTextAnnotationAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputTextAnnotationAddedEvent.kt @@ -350,6 +350,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseOutputTextAnnotationAddedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsePrompt.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsePrompt.kt index 9b5397d27..2525daec8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsePrompt.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsePrompt.kt @@ -212,6 +212,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsePrompt = apply { if (validated) { return@apply @@ -304,6 +312,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Variables = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseQueuedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseQueuedEvent.kt index ba945ad42..995cacab5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseQueuedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseQueuedEvent.kt @@ -205,6 +205,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseQueuedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningItem.kt index 1b08dc244..fe72c3b76 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningItem.kt @@ -354,6 +354,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningItem = apply { if (validated) { return@apply @@ -539,6 +547,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Summary = apply { if (validated) { return@apply @@ -736,6 +753,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -885,6 +911,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartAddedEvent.kt index 336bc818f..54a2df2d1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartAddedEvent.kt @@ -315,6 +315,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningSummaryPartAddedEvent = apply { if (validated) { return@apply @@ -500,6 +508,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Part = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartDoneEvent.kt index 9c94d6347..f211d5da3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryPartDoneEvent.kt @@ -315,6 +315,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningSummaryPartDoneEvent = apply { if (validated) { return@apply @@ -500,6 +508,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Part = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDeltaEvent.kt index 06d6ef528..01329102b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDeltaEvent.kt @@ -314,6 +314,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningSummaryTextDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDoneEvent.kt index 43263d0a1..ee85eeac2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningSummaryTextDoneEvent.kt @@ -314,6 +314,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningSummaryTextDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDeltaEvent.kt index e34a6fb69..397d1289a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDeltaEvent.kt @@ -313,6 +313,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningTextDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDoneEvent.kt index 7750e65a3..888a5b7a3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseReasoningTextDoneEvent.kt @@ -312,6 +312,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseReasoningTextDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDeltaEvent.kt index 46b9e4bea..87261cc57 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDeltaEvent.kt @@ -310,6 +310,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseRefusalDeltaEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDoneEvent.kt index 7aa682e01..03047167d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRefusalDoneEvent.kt @@ -310,6 +310,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseRefusalDoneEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStatus.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStatus.kt index d56cc42fd..ac9815e30 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStatus.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStatus.kt @@ -122,6 +122,14 @@ class ResponseStatus @JsonCreator private constructor(private val value: JsonFie private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseStatus = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStreamEvent.kt index af6659240..5ee77f593 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStreamEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseStreamEvent.kt @@ -594,6 +594,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responseStreamEvent.accept(new ResponseStreamEvent.Visitor>() { + * @Override + * public Optional visitAudioDelta(ResponseAudioDeltaEvent audioDelta) { + * return Optional.of(audioDelta.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { audioDelta != null -> visitor.visitAudioDelta(audioDelta) @@ -681,6 +710,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseStreamEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt index 945d5e4a1..e29eb7313 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt @@ -230,6 +230,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseTextConfig = apply { if (validated) { return@apply @@ -358,6 +366,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Verbosity = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDeltaEvent.kt index b2e40807c..c297ff69f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDeltaEvent.kt @@ -373,6 +373,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseTextDeltaEvent = apply { if (validated) { return@apply @@ -620,6 +628,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprob = apply { if (validated) { return@apply @@ -786,6 +803,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TopLogprob = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDoneEvent.kt index 670a02f47..2278c94a1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextDoneEvent.kt @@ -373,6 +373,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseTextDoneEvent = apply { if (validated) { return@apply @@ -620,6 +628,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Logprob = apply { if (validated) { return@apply @@ -786,6 +803,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TopLogprob = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchCall.kt index 1271e26cf..598cbfa05 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchCall.kt @@ -322,6 +322,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseToolSearchCall = apply { if (validated) { return@apply @@ -452,6 +460,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Execution = apply { if (validated) { return@apply @@ -584,6 +601,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItem.kt index a0a48c05a..6f11e6838 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItem.kt @@ -460,6 +460,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseToolSearchOutputItem = apply { if (validated) { return@apply @@ -592,6 +600,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Execution = apply { if (validated) { return@apply @@ -724,6 +741,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItemParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItemParam.kt index 86f15740e..72274cbf1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItemParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseToolSearchOutputItemParam.kt @@ -429,6 +429,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseToolSearchOutputItemParam = apply { if (validated) { return@apply @@ -559,6 +567,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Execution = apply { if (validated) { return@apply @@ -691,6 +708,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseUsage.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseUsage.kt index ba9231ae3..f7179b732 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseUsage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseUsage.kt @@ -305,6 +305,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseUsage = apply { if (validated) { return@apply @@ -467,6 +475,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputTokensDetails = apply { if (validated) { return@apply @@ -636,6 +653,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputTokensDetails = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallCompletedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallCompletedEvent.kt index 211e900e9..9bcb212be 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallCompletedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallCompletedEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseWebSearchCallCompletedEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallInProgressEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallInProgressEvent.kt index f64e749f8..7f9a76f71 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallInProgressEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallInProgressEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseWebSearchCallInProgressEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallSearchingEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallSearchingEvent.kt index e72f3bdf7..c9bd875ae 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallSearchingEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseWebSearchCallSearchingEvent.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseWebSearchCallSearchingEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesClientEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesClientEvent.kt index 54a76f1ae..02c195361 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesClientEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesClientEvent.kt @@ -1803,6 +1803,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsesClientEvent = apply { if (validated) { return@apply @@ -2061,6 +2069,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContextManagement = apply { if (validated) { return@apply @@ -2145,6 +2162,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = conversation.accept(new Conversation.Visitor>() { + * @Override + * public Optional visitId(String id) { + * return Optional.of(id.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { id != null -> visitor.visitId(id) @@ -2155,6 +2201,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply @@ -2348,6 +2403,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitText(String text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -2357,6 +2441,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -2571,6 +2664,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -2710,6 +2812,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): PromptCacheRetention = apply { if (validated) { return@apply @@ -2871,6 +2982,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ServiceTier = apply { if (validated) { return@apply @@ -3030,6 +3150,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StreamOptions = apply { if (validated) { return@apply @@ -3183,6 +3312,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolChoice.accept(new ToolChoice.Visitor>() { + * @Override + * public Optional visitOptions(ToolChoiceOptions options) { + * return Optional.of(options.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { options != null -> visitor.visitOptions(options) @@ -3198,6 +3356,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply @@ -3582,6 +3749,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Truncation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt index 222e0560a..d20376985 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt @@ -637,6 +637,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = responsesServerEvent.accept(new ResponsesServerEvent.Visitor>() { + * @Override + * public Optional visitResponseAudioDelta(ResponseAudioDeltaEvent responseAudioDelta) { + * return Optional.of(responseAudioDelta.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { responseAudioDelta != null -> visitor.visitResponseAudioDelta(responseAudioDelta) @@ -757,6 +786,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsesServerEvent = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/SkillReference.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/SkillReference.kt index b84b877b6..267f76712 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/SkillReference.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/SkillReference.kt @@ -194,6 +194,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SkillReference = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt index 06918e8a6..1faad2360 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt @@ -226,6 +226,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitFunction(FunctionTool function) { + * return Optional.of(function.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { function != null -> visitor.visitFunction(function) @@ -248,6 +277,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply @@ -1288,6 +1325,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mcp = apply { if (validated) { return@apply @@ -1365,6 +1411,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = allowedTools.accept(new AllowedTools.Visitor>() { + * @Override + * public Optional visitMcp(List mcp) { + * return Optional.of(mcp.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcp != null -> visitor.visitMcp(mcp) @@ -1374,6 +1450,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AllowedTools = apply { if (validated) { return@apply @@ -1694,6 +1780,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): McpToolFilter = apply { if (validated) { return@apply @@ -1889,6 +1985,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConnectorId = apply { if (validated) { return@apply @@ -1992,6 +2098,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -2079,6 +2195,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = requireApproval.accept(new RequireApproval.Visitor>() { + * @Override + * public Optional visitMcpToolApprovalFilter(McpToolApprovalFilter mcpToolApprovalFilter) { + * return Optional.of(mcpToolApprovalFilter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { mcpToolApprovalFilter != null -> @@ -2090,6 +2236,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RequireApproval = apply { if (validated) { return@apply @@ -2417,6 +2573,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): McpToolApprovalFilter = apply { if (validated) { return@apply @@ -2620,6 +2786,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Always = apply { if (validated) { return@apply @@ -2844,6 +3020,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Never = apply { if (validated) { return@apply @@ -3019,6 +3205,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): McpToolApprovalSetting = apply { if (validated) { return@apply @@ -3268,6 +3464,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CodeInterpreter = apply { if (validated) { return@apply @@ -3341,6 +3546,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = container.accept(new Container.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -3351,6 +3586,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Container = apply { if (validated) { return@apply @@ -3788,6 +4033,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): CodeInterpreterToolAuto = apply { if (validated) { return@apply @@ -3935,6 +4190,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): MemoryLimit = apply { if (validated) { return@apply @@ -4002,6 +4267,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not + * known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = networkPolicy.accept(new NetworkPolicy.Visitor>() { + * @Override + * public Optional visitDisabled(ContainerNetworkPolicyDisabled disabled) { + * return Optional.of(disabled.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { disabled != null -> visitor.visitDisabled(disabled) @@ -4011,6 +4307,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): NetworkPolicy = apply { if (validated) { return@apply @@ -4776,6 +5082,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageGeneration = apply { if (validated) { return@apply @@ -4927,6 +5242,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Action = apply { if (validated) { return@apply @@ -5068,6 +5393,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Background = apply { if (validated) { return@apply @@ -5205,6 +5540,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputFidelity = apply { if (validated) { return@apply @@ -5385,6 +5730,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputImageMask = apply { if (validated) { return@apply @@ -5533,6 +5888,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Model = apply { if (validated) { return@apply @@ -5665,6 +6030,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Moderation = apply { if (validated) { return@apply @@ -5806,6 +6181,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OutputFormat = apply { if (validated) { return@apply @@ -5952,6 +6337,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Quality = apply { if (validated) { return@apply @@ -6095,6 +6490,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Size = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceAllowed.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceAllowed.kt index 56be1d4c0..63d41cedf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceAllowed.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceAllowed.kt @@ -243,6 +243,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceAllowed = apply { if (validated) { return@apply @@ -371,6 +379,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mode = apply { if (validated) { return@apply @@ -468,6 +485,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Tool = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceApplyPatch.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceApplyPatch.kt index b1c4c96c6..019aed5c8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceApplyPatch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceApplyPatch.kt @@ -113,6 +113,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceApplyPatch = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceCustom.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceCustom.kt index 173f048c0..18590a035 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceCustom.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceCustom.kt @@ -159,6 +159,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceCustom = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceFunction.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceFunction.kt index 057e24fa6..f4941217f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceFunction.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceFunction.kt @@ -163,6 +163,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceFunction = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceMcp.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceMcp.kt index 66d82755b..a6add462c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceMcp.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceMcp.kt @@ -204,6 +204,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceMcp = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceOptions.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceOptions.kt index e4e4010b3..8ee449ec1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceOptions.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceOptions.kt @@ -111,6 +111,14 @@ class ToolChoiceOptions @JsonCreator private constructor(private val value: Json private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceOptions = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceShell.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceShell.kt index 3c22e8ee9..b876d118f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceShell.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceShell.kt @@ -112,6 +112,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceShell = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceTypes.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceTypes.kt index 9120b28cb..bd26b7ee5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceTypes.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolChoiceTypes.kt @@ -155,6 +155,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoiceTypes = apply { if (validated) { return@apply @@ -315,6 +323,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolSearchTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolSearchTool.kt index 8c1fd0464..bde06d2c3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolSearchTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ToolSearchTool.kt @@ -209,6 +209,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolSearchTool = apply { if (validated) { return@apply @@ -333,6 +341,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Execution = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchPreviewTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchPreviewTool.kt index 3002fb3a3..8c836e9bb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchPreviewTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchPreviewTool.kt @@ -281,6 +281,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebSearchPreviewTool = apply { if (validated) { return@apply @@ -404,6 +412,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -533,6 +550,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SearchContentType = apply { if (validated) { return@apply @@ -672,6 +698,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SearchContextSize = apply { if (validated) { return@apply @@ -961,6 +996,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserLocation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchTool.kt index cda8357b1..47c003967 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/WebSearchTool.kt @@ -261,6 +261,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebSearchTool = apply { if (validated) { return@apply @@ -381,6 +389,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -554,6 +571,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Filters = apply { if (validated) { return@apply @@ -699,6 +725,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SearchContextSize = apply { if (validated) { return@apply @@ -990,6 +1025,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserLocation = apply { if (validated) { return@apply @@ -1109,6 +1153,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/InputItemListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/InputItemListParams.kt index cd0564fa5..2ec50d04e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/InputItemListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/InputItemListParams.kt @@ -372,6 +372,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/ResponseItemList.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/ResponseItemList.kt index b3cc6f2f9..655730781 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/ResponseItemList.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputitems/ResponseItemList.kt @@ -434,6 +434,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseItemList = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountParams.kt index 6cba86dbb..522ac7d5a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountParams.kt @@ -1576,6 +1576,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1700,6 +1709,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = conversation.accept(new Conversation.Visitor>() { + * @Override + * public Optional visitId(String id) { + * return Optional.of(id.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { id != null -> visitor.visitId(id) @@ -1710,6 +1748,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Conversation = apply { if (validated) { return@apply @@ -1896,6 +1943,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = input.accept(new Input.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1905,6 +1981,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -2252,6 +2337,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Text = apply { if (validated) { return@apply @@ -2385,6 +2479,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Verbosity = apply { if (validated) { return@apply @@ -2548,6 +2652,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = toolChoice.accept(new ToolChoice.Visitor>() { + * @Override + * public Optional visitOptions(ToolChoiceOptions options) { + * return Optional.of(options.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { options != null -> visitor.visitOptions(options) @@ -2563,6 +2696,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolChoice = apply { if (validated) { return@apply @@ -2946,6 +3088,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Truncation = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountResponse.kt index 140cb7389..8909c88f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/inputtokens/InputTokenCountResponse.kt @@ -160,6 +160,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputTokenCountResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/DeletedSkill.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/DeletedSkill.kt index 5ff762f91..1ff1d8219 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/DeletedSkill.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/DeletedSkill.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DeletedSkill = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/Skill.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/Skill.kt index d68b9990b..ee2dd5b97 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/Skill.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/Skill.kt @@ -353,6 +353,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Skill = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillCreateParams.kt index ee8e0b548..82958a3a3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillCreateParams.kt @@ -373,6 +373,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -434,6 +443,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = files.accept(new Files.Visitor>() { + * @Override + * public Optional visitInputStreams(List inputStreams) { + * return Optional.of(inputStreams.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputStreams != null -> visitor.visitInputStreams(inputStreams) @@ -443,6 +481,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Files = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillList.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillList.kt index 9c323852d..8a4b78876 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillList.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillList.kt @@ -286,6 +286,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SkillList = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillListParams.kt index ca18da014..3f2bf9a85 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillListParams.kt @@ -313,6 +313,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillUpdateParams.kt index bd11b640f..82c9e896d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/SkillUpdateParams.kt @@ -388,6 +388,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/DeletedSkillVersion.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/DeletedSkillVersion.kt index b382ed0f8..4149e1be8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/DeletedSkillVersion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/DeletedSkillVersion.kt @@ -220,6 +220,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): DeletedSkillVersion = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersion.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersion.kt index e523565f6..1f6c7f9c4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersion.kt @@ -330,6 +330,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SkillVersion = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersionList.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersionList.kt index 5200ebda4..66e583cbe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersionList.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/SkillVersionList.kt @@ -288,6 +288,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SkillVersionList = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionCreateParams.kt index 5db99b56e..7c772b2f7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionCreateParams.kt @@ -450,6 +450,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -514,6 +523,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = files.accept(new Files.Visitor>() { + * @Override + * public Optional visitInputStreams(List inputStreams) { + * return Optional.of(inputStreams.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputStreams != null -> visitor.visitInputStreams(inputStreams) @@ -523,6 +561,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Files = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionListParams.kt index 6930518f4..23fec2d49 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/skills/versions/VersionListParams.kt @@ -321,6 +321,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/uploads/Upload.kt b/openai-java-core/src/main/kotlin/com/openai/models/uploads/Upload.kt index b60d4a2b0..d8aba4d47 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/uploads/Upload.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/uploads/Upload.kt @@ -416,6 +416,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Upload = apply { if (validated) { return@apply @@ -562,6 +570,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCompleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCompleteParams.kt index e85fb05b9..0387a8302 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCompleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCompleteParams.kt @@ -482,6 +482,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCreateParams.kt index c4498d9b4..feb4aa95a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/uploads/UploadCreateParams.kt @@ -684,6 +684,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -900,6 +909,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/PartCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/PartCreateParams.kt index 70da0db7b..599b744e3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/PartCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/PartCreateParams.kt @@ -401,6 +401,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/UploadPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/UploadPart.kt index fda8cfc52..32859a98d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/UploadPart.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/uploads/parts/UploadPart.kt @@ -229,6 +229,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UploadPart = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/AutoFileChunkingStrategyParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/AutoFileChunkingStrategyParam.kt index d09ae43b9..31c61c28b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/AutoFileChunkingStrategyParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/AutoFileChunkingStrategyParam.kt @@ -119,6 +119,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AutoFileChunkingStrategyParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategy.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategy.kt index b12eaa775..b2e09411a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategy.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategy.kt @@ -50,6 +50,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = fileChunkingStrategy.accept(new FileChunkingStrategy.Visitor>() { + * @Override + * public Optional visitStatic(StaticFileChunkingStrategyObject static_) { + * return Optional.of(static_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { static_ != null -> visitor.visitStatic(static_) @@ -59,6 +88,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileChunkingStrategy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategyParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategyParam.kt index 18ddc3c84..7d0672698 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategyParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/FileChunkingStrategyParam.kt @@ -55,6 +55,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = fileChunkingStrategyParam.accept(new FileChunkingStrategyParam.Visitor>() { + * @Override + * public Optional visitAuto(AutoFileChunkingStrategyParam auto) { + * return Optional.of(auto.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { auto != null -> visitor.visitAuto(auto) @@ -64,6 +93,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileChunkingStrategyParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/OtherFileChunkingStrategyObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/OtherFileChunkingStrategyObject.kt index 6eab9353f..68436a031 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/OtherFileChunkingStrategyObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/OtherFileChunkingStrategyObject.kt @@ -121,6 +121,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OtherFileChunkingStrategyObject = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategy.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategy.kt index d4fec71e2..1abd2b2bf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategy.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategy.kt @@ -191,6 +191,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StaticFileChunkingStrategy = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObject.kt index 32392a9d2..26d3b9519 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObject.kt @@ -170,6 +170,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StaticFileChunkingStrategyObject = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObjectParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObjectParam.kt index f0ae97c4f..7e3871228 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObjectParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/StaticFileChunkingStrategyObjectParam.kt @@ -172,6 +172,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StaticFileChunkingStrategyObjectParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStore.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStore.kt index 486fdcaec..15d5efbd5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStore.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStore.kt @@ -527,6 +527,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStore = apply { if (validated) { return@apply @@ -835,6 +843,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCounts = apply { if (validated) { return@apply @@ -960,6 +977,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1098,6 +1124,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1286,6 +1321,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreCreateParams.kt index 14fba5722..8ce548dca 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreCreateParams.kt @@ -798,6 +798,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1018,6 +1027,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -1136,6 +1154,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreDeleted.kt index 0ee9abb54..007b07462 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListPageResponse.kt index b61b624cc..1bc7f5779 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListPageResponse.kt @@ -265,6 +265,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListParams.kt index d226ef05c..e487bc5fb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreListParams.kt @@ -351,6 +351,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchPageResponse.kt index 416f4c83d..caeee6509 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchPageResponse.kt @@ -304,6 +304,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreSearchPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchParams.kt index 8b1d0bf6c..44dfc6ed3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchParams.kt @@ -696,6 +696,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -786,6 +795,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = query.accept(new Query.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -795,6 +833,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Query = apply { if (validated) { return@apply @@ -964,6 +1011,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = filters.accept(new Filters.Visitor>() { + * @Override + * public Optional visitComparisonFilter(ComparisonFilter comparisonFilter) { + * return Optional.of(comparisonFilter.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { comparisonFilter != null -> visitor.visitComparisonFilter(comparisonFilter) @@ -973,6 +1049,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Filters = apply { if (validated) { return@apply @@ -1268,6 +1353,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RankingOptions = apply { if (validated) { return@apply @@ -1395,6 +1489,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Ranker = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchResponse.kt index 066e6d429..84d04b3e6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreSearchResponse.kt @@ -301,6 +301,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreSearchResponse = apply { if (validated) { return@apply @@ -399,6 +407,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply @@ -590,6 +607,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Content = apply { if (validated) { return@apply @@ -702,6 +728,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreUpdateParams.kt index ccadcc94e..fca133cf4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/VectorStoreUpdateParams.kt @@ -523,6 +523,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -726,6 +735,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExpiresAfter = apply { if (validated) { return@apply @@ -844,6 +862,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchCreateParams.kt index 275f87ef5..8271b3a81 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchCreateParams.kt @@ -732,6 +732,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -852,6 +861,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply @@ -1141,6 +1159,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): File = apply { if (validated) { return@apply @@ -1240,6 +1267,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesPageResponse.kt index 31ed142ff..e0e54a5bd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesPageResponse.kt @@ -270,6 +270,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileBatchListFilesPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesParams.kt index 88977f0e0..c54aa1b57 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/FileBatchListFilesParams.kt @@ -413,6 +413,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Filter = apply { if (validated) { return@apply @@ -542,6 +551,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/VectorStoreFileBatch.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/VectorStoreFileBatch.kt index 169a2ed54..e4162a7b7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/VectorStoreFileBatch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/filebatches/VectorStoreFileBatch.kt @@ -316,6 +316,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreFileBatch = apply { if (validated) { return@apply @@ -614,6 +622,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileCounts = apply { if (validated) { return@apply @@ -776,6 +793,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentPageResponse.kt index b84d91199..239b43ea2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentPageResponse.kt @@ -253,6 +253,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileContentPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentResponse.kt index 068d9e86f..405ab77b9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileContentResponse.kt @@ -143,6 +143,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileContentResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileCreateParams.kt index e5f7cddbc..34bb7c996 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileCreateParams.kt @@ -629,6 +629,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -746,6 +755,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListPageResponse.kt index 6ba19a225..68ab16c95 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListPageResponse.kt @@ -267,6 +267,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListParams.kt index 9140de763..b2cf9b600 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileListParams.kt @@ -392,6 +392,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Filter = apply { if (validated) { return@apply @@ -521,6 +530,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileUpdateParams.kt index ffcf2a1be..5d23329d0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/FileUpdateParams.kt @@ -417,6 +417,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -525,6 +534,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFile.kt index d80de97c6..16e8f4653 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFile.kt @@ -487,6 +487,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreFile = apply { if (validated) { return@apply @@ -686,6 +694,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LastError = apply { if (validated) { return@apply @@ -811,6 +828,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Code = apply { if (validated) { return@apply @@ -972,6 +999,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -1074,6 +1110,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Attributes = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFileDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFileDeleted.kt index 74eac38de..2f4d2c613 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFileDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/vectorstores/files/VectorStoreFileDeleted.kt @@ -187,6 +187,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VectorStoreFileDeleted = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/ImageInputReferenceParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/ImageInputReferenceParam.kt index 98f04d0c0..47bf6bf84 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/ImageInputReferenceParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/ImageInputReferenceParam.kt @@ -140,6 +140,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageInputReferenceParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt index aef79883f..9980a7df1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt @@ -616,6 +616,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Video = apply { if (validated) { return@apply @@ -772,6 +780,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterParams.kt index df26e3494..51bb26513 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterParams.kt @@ -439,6 +439,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterResponse.kt index 178879f84..a0dabae67 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateCharacterResponse.kt @@ -204,6 +204,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoCreateCharacterResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateError.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateError.kt index e7995b6ce..1e8d9f850 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateError.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateError.kt @@ -164,6 +164,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoCreateError = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateParams.kt index 05f2c27c6..67f37c054 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoCreateParams.kt @@ -698,6 +698,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -770,6 +779,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = inputReference.accept(new InputReference.Visitor>() { + * @Override + * public Optional visitStream(InputStream stream) { + * return Optional.of(stream.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { stream != null -> visitor.visitStream(stream) @@ -780,6 +818,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InputReference = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDeleteResponse.kt index 700aad624..ca1b3bce4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDeleteResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDeleteResponse.kt @@ -196,6 +196,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoDeleteResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDownloadContentParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDownloadContentParams.kt index 2fbfba863..5e831eca7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDownloadContentParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoDownloadContentParams.kt @@ -298,6 +298,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Variant = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoEditParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoEditParams.kt index 7a7864454..3e3f5f637 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoEditParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoEditParams.kt @@ -464,6 +464,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -530,6 +539,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = video.accept(new Video.Visitor>() { + * @Override + * public Optional visitInputStream(InputStream inputStream) { + * return Optional.of(inputStream.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputStream != null -> visitor.visitInputStream(inputStream) @@ -539,6 +577,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Video = apply { if (validated) { return@apply @@ -756,6 +803,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoReferenceInputParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoExtendParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoExtendParams.kt index 05f5dc99d..d16e486c4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoExtendParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoExtendParams.kt @@ -542,6 +542,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -612,6 +621,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = video.accept(new Video.Visitor>() { + * @Override + * public Optional visitInputStream(InputStream inputStream) { + * return Optional.of(inputStream.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { inputStream != null -> visitor.visitInputStream(inputStream) @@ -621,6 +659,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Video = apply { if (validated) { return@apply @@ -838,6 +885,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoReferenceInputParam = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoGetCharacterResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoGetCharacterResponse.kt index 13dcaef25..56e226972 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoGetCharacterResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoGetCharacterResponse.kt @@ -204,6 +204,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoGetCharacterResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListPageResponse.kt index 9fa0f0ef3..dbbe60445 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListPageResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListPageResponse.kt @@ -286,6 +286,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoListPageResponse = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListParams.kt index 2c70c01ed..09f6daf3a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoListParams.kt @@ -313,6 +313,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Order = apply { if (validated) { return@apply diff --git a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoModel.kt index c20fd7b28..49e11c28c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/videos/VideoModel.kt @@ -110,6 +110,14 @@ class VideoModel @JsonCreator private constructor(private val value: JsonField = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = unwrapWebhookEvent.accept(new UnwrapWebhookEvent.Visitor>() { + * @Override + * public Optional visitBatchCancelled(BatchCancelledWebhookEvent batchCancelled) { + * return Optional.of(batchCancelled.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { batchCancelled != null -> visitor.visitBatchCancelled(batchCancelled) @@ -205,6 +234,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnwrapWebhookEvent = apply { if (validated) { return@apply From 5a1bfdcb283dc6efc1ab5058ef96740087112288 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 17:11:54 +0000 Subject: [PATCH 02/27] feat(client): more robust error parsing --- .../com/openai/core/handlers/ErrorHandler.kt | 22 ++++++++++------ .../com/openai/core/handlers/SseHandler.kt | 8 +++--- .../com/openai/errors/BadRequestException.kt | 26 +++++++++++++------ .../openai/errors/InternalServerException.kt | 26 +++++++++++++------ .../com/openai/errors/NotFoundException.kt | 26 +++++++++++++------ .../errors/PermissionDeniedException.kt | 26 +++++++++++++------ .../com/openai/errors/RateLimitException.kt | 26 +++++++++++++------ .../kotlin/com/openai/errors/SseException.kt | 26 +++++++++++++------ .../openai/errors/UnauthorizedException.kt | 26 +++++++++++++------ .../errors/UnexpectedStatusCodeException.kt | 26 +++++++++++++------ .../errors/UnprocessableEntityException.kt | 26 +++++++++++++------ 11 files changed, 181 insertions(+), 83 deletions(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt b/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt index 1748c1b7d..6d6ee571c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt +++ b/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt @@ -7,6 +7,9 @@ package com.openai.core.handlers import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.JsonField +import com.openai.core.JsonMissing +import com.openai.core.JsonValue import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponse.Handler import com.openai.errors.BadRequestException @@ -20,23 +23,26 @@ import com.openai.errors.UnprocessableEntityException import com.openai.models.ErrorObject @JvmSynthetic -internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler { +internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler> { val handler = jsonHandler(jsonMapper) - return object : Handler { - override fun handle(response: HttpResponse): ErrorObject? = + return object : Handler> { + override fun handle(response: HttpResponse): JsonField = try { - handler.handle(response).get("error")?.let { - jsonMapper.readerFor(jacksonTypeRef()).readValue(it) - } + val node = handler.handle(response) + node.get("error")?.let { + jsonMapper.readerFor(jacksonTypeRef>()).readValue(it) + } ?: JsonValue.fromJsonNode(node) } catch (e: Exception) { - null + JsonMissing.of() } } } @JvmSynthetic -internal fun errorHandler(errorBodyHandler: Handler): Handler = +internal fun errorHandler( + errorBodyHandler: Handler> +): Handler = object : Handler { override fun handle(response: HttpResponse): HttpResponse = when (val statusCode = response.statusCode()) { diff --git a/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt b/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt index 5a0a5ebc0..8907903cc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt +++ b/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt @@ -7,6 +7,8 @@ package com.openai.core.handlers import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.JsonField +import com.openai.core.JsonMissing import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponse.Handler import com.openai.core.http.SseMessage @@ -48,10 +50,10 @@ internal fun sseHandler(jsonMapper: JsonMapper): Handler()) - .readValue(it) + .readerFor(jacksonTypeRef>()) + .readValue>(it) } catch (e: Exception) { - null + JsonMissing.of() } ) .build() diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt index bf233b5aa..7bdb7f4cb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull class BadRequestException private constructor( private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("400: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "400: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun statusCode(): Int = 400 override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun headers(): Headers = headers @@ -50,7 +58,7 @@ private constructor( class Builder internal constructor() { private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -62,11 +70,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt index 63e27034d..d573588d4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -15,18 +16,25 @@ class InternalServerException private constructor( private val statusCode: Int, private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("$statusCode: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "$statusCode: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun statusCode(): Int = statusCode @@ -53,7 +61,7 @@ private constructor( private var statusCode: Int? = null private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -68,11 +76,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt index bc4ae60d5..457b0503c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull class NotFoundException private constructor( private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("404: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "404: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun statusCode(): Int = 404 override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun headers(): Headers = headers @@ -50,7 +58,7 @@ private constructor( class Builder internal constructor() { private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -62,11 +70,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt index 03a3999f4..c9ae8beec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull class PermissionDeniedException private constructor( private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("403: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "403: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun statusCode(): Int = 403 override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun headers(): Headers = headers @@ -50,7 +58,7 @@ private constructor( class Builder internal constructor() { private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -62,11 +70,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt index 02ae02bb6..8425abb2b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull class RateLimitException private constructor( private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("429: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "429: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun statusCode(): Int = 429 override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun headers(): Headers = headers @@ -50,7 +58,7 @@ private constructor( class Builder internal constructor() { private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -62,11 +70,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt index b4488d5d5..74f969c25 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -15,18 +16,25 @@ class SseException private constructor( private val statusCode: Int, private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("$statusCode: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "$statusCode: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun statusCode(): Int = statusCode @@ -53,7 +61,7 @@ private constructor( private var statusCode: Int? = null private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -68,11 +76,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt index e8eb5a2cb..e9ae80302 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull class UnauthorizedException private constructor( private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("401: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "401: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun statusCode(): Int = 401 override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun headers(): Headers = headers @@ -50,7 +58,7 @@ private constructor( class Builder internal constructor() { private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -62,11 +70,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt index d4b32160a..16627f1f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -15,18 +16,25 @@ class UnexpectedStatusCodeException private constructor( private val statusCode: Int, private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("$statusCode: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "$statusCode: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun statusCode(): Int = statusCode @@ -54,7 +62,7 @@ private constructor( private var statusCode: Int? = null private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -69,11 +77,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt index 42a5a7ca2..f23316843 100644 --- a/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt +++ b/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt @@ -2,6 +2,7 @@ package com.openai.errors +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired @@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull class UnprocessableEntityException private constructor( private val headers: Headers, - private val error: ErrorObject?, + private val error: JsonField, cause: Throwable?, -) : OpenAIServiceException("422: ${error?._message()}", cause) { +) : + OpenAIServiceException( + "422: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}", + cause, + ) { override fun statusCode(): Int = 422 override fun body(): JsonValue = - error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of() + if (error.isMissing()) JsonMissing.of() + else JsonValue.fromJsonNode(jsonMapper().valueToTree(error)) - override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull()) + override fun code(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull()) - override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull()) + override fun param(): Optional = + Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull()) - override fun type(): Optional = Optional.ofNullable(error?.type()) + override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type()) override fun headers(): Headers = headers @@ -50,7 +58,7 @@ private constructor( class Builder internal constructor() { private var headers: Headers? = null - private var error: ErrorObject? = null + private var error: JsonField = JsonMissing.of() private var cause: Throwable? = null @JvmSynthetic @@ -62,11 +70,13 @@ private constructor( fun headers(headers: Headers) = apply { this.headers = headers } - fun error(error: ErrorObject?) = apply { this.error = error } + fun error(error: ErrorObject?) = error(JsonField.ofNullable(error)) /** Alias for calling [Builder.error] with `error.orElse(null)`. */ fun error(error: Optional) = error(error.getOrNull()) + fun error(error: JsonField) = apply { this.error = error } + fun cause(cause: Throwable?) = apply { this.cause = cause } /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ From fc57ef7963e6ebdfde0c716adc4f29d315dc9021 Mon Sep 17 00:00:00 2001 From: sweidac <17548832+sweidac@users.noreply.github.com> Date: Mon, 4 May 2026 19:40:16 +0200 Subject: [PATCH 03/27] fix(client): match `JsonSchemaValidator` heading levels to API (#733) * Update JsonSchemaValidator.kt Increase max allowed nesting depth to match the API docs * Adapt tests to check for the new max nesting depth of 10. * chore: format --------- Co-authored-by: Tomer Aberbach --- .../com/openai/core/JsonSchemaValidator.kt | 2 +- .../com/openai/core/StructuredOutputsTest.kt | 100 +++++++++++++----- 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt b/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt index f0f35422f..4242f73fe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt +++ b/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt @@ -153,7 +153,7 @@ internal class JsonSchemaValidator private constructor() { private const val MAX_ENUM_TOTAL_STRING_LENGTH = 7_500 /** The maximum depth (number of levels) of nesting allowed in a schema. */ - private const val MAX_NESTING_DEPTH = 5 + private const val MAX_NESTING_DEPTH = 10 /** The depth value that corresponds to the root level of the schema. */ private const val ROOT_DEPTH = 0 diff --git a/openai-java-core/src/test/kotlin/com/openai/core/StructuredOutputsTest.kt b/openai-java-core/src/test/kotlin/com/openai/core/StructuredOutputsTest.kt index 245f6167f..218407e43 100644 --- a/openai-java-core/src/test/kotlin/com/openai/core/StructuredOutputsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/core/StructuredOutputsTest.kt @@ -882,7 +882,12 @@ internal class StructuredOutputsTest { @Test @Suppress("unused") fun schemaTest_deepNestingBeyondLimit() { - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -893,7 +898,8 @@ internal class StructuredOutputsTest { validator.validate(schema) assertThat(validator.errors()).hasSize(1) - assertThat(validator.errors()[0]).contains("Current nesting depth is 6, but maximum is 5.") + assertThat(validator.errors()[0]) + .contains("Current nesting depth is 11, but maximum is 10.") } @Test @@ -1736,7 +1742,12 @@ internal class StructuredOutputsTest { @Suppress("unused") fun responseFormatFromClassFailureWithValidation() { // Exceed the maximum nesting depth and enable validation. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -1747,8 +1758,8 @@ internal class StructuredOutputsTest { .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -1757,20 +1768,24 @@ internal class StructuredOutputsTest { fun responseFormatFromClassFailureWithValidationDefault() { // Confirm that the default value of the `localValidation` argument is `YES` by expecting // a validation error when that argument is not given an explicit value. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) class Y(val x: X) class Z(val y: Y) - // Use default for `localValidation` flag. assertThatThrownBy { responseFormatFromClass(Z::class.java) } .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -1826,19 +1841,23 @@ internal class StructuredOutputsTest { @Suppress("unused") fun textConfigFromClassFailureWithValidation() { // Exceed the maximum nesting depth and enable validation. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) class Y(val x: X) class Z(val y: Y) - assertThatThrownBy { textConfigFromClass(Z::class.java, JsonSchemaLocalValidation.YES) } .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -1847,7 +1866,12 @@ internal class StructuredOutputsTest { fun textConfigFromClassFailureWithValidationDefault() { // Confirm that the default value of the `localValidation` argument is `YES` by expecting // a validation error when that argument is not given an explicit value. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -1859,8 +1883,8 @@ internal class StructuredOutputsTest { .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -1954,7 +1978,12 @@ internal class StructuredOutputsTest { @Suppress("unused") fun functionToolFromClassFailureWithValidation() { // Exceed the maximum nesting depth and enable validation. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -1965,8 +1994,8 @@ internal class StructuredOutputsTest { .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -1975,7 +2004,12 @@ internal class StructuredOutputsTest { fun functionToolFromClassFailureWithValidationDefault() { // Confirm that the default value of the `localValidation` argument is `YES` by expecting a // validation error when that argument is not given an explicit value. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -1987,8 +2021,8 @@ internal class StructuredOutputsTest { .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -2048,7 +2082,12 @@ internal class StructuredOutputsTest { @Suppress("unused") fun responseFunctionToolFromClassFailureWithValidation() { // Exceed the maximum nesting depth and enable validation. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -2061,8 +2100,8 @@ internal class StructuredOutputsTest { .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } @@ -2071,7 +2110,12 @@ internal class StructuredOutputsTest { fun responseFunctionToolFromClassFailureWithValidationDefault() { // Confirm that the default value of the `localValidation` argument is `YES` by expecting // a validation error when that argument is not given an explicit value. - class U(val s: String) + class A(val s: String) + class Q(val u: A) + class R(val u: Q) + class S(val u: R) + class T(val u: S) + class U(val u: T) class V(val u: U) class W(val v: V) class X(val w: W) @@ -2083,8 +2127,8 @@ internal class StructuredOutputsTest { .isExactlyInstanceOf(IllegalArgumentException::class.java) .hasMessage( "Local validation failed for JSON schema derived from ${Z::class.java}:\n" + - " - #/properties/y/properties/x/properties/w/properties/v/properties/u" + - "/properties/s: Current nesting depth is 6, but maximum is 5." + " - #/properties/y/properties/x/properties/w/properties/v/properties/u/properties/u/properties/u/properties/u/properties/u/properties/u" + + "/properties/s: Current nesting depth is 11, but maximum is 10." ) } From 82a85274f613aad7ae277765b12bc3469832e1b1 Mon Sep 17 00:00:00 2001 From: Tomer Aberbach Date: Mon, 4 May 2026 15:00:04 -0400 Subject: [PATCH 04/27] chore: fix build error --- .../com/openai/auth/WorkloadIdentityAuth.kt | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt index d823a4e6d..1066c3605 100644 --- a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt +++ b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt @@ -2,6 +2,9 @@ package com.openai.auth import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.JsonField +import com.openai.core.JsonMissing +import com.openai.core.JsonValue import com.openai.core.handlers.errorHandler import com.openai.core.http.HttpClient import com.openai.core.http.HttpMethod @@ -31,22 +34,31 @@ internal class WorkloadIdentityAuth( ) : AutoCloseable { private val errorHandler = errorHandler( - object : HttpResponse.Handler { - override fun handle(response: HttpResponse): ErrorObject? = - try { - val node = jsonMapper.readTree(response.body()) + object : HttpResponse.Handler> { + override fun handle(response: HttpResponse): JsonField { + val node = + try { + jsonMapper.readTree(response.body()) + } catch (e: Exception) { + return JsonMissing.of() + } + + return try { val errorCode = node.get("error")?.asText() val errorMessage = node.get("error_description")?.asText() ?: errorCode - jsonMapper.treeToValue( - jsonMapper.createObjectNode().apply { - errorCode?.let { put("code", it) } - errorMessage?.let { put("message", it) } - }, - ErrorObject::class.java, + JsonField.of( + jsonMapper.treeToValue( + jsonMapper.createObjectNode().apply { + errorCode?.let { put("code", it) } + errorMessage?.let { put("message", it) } + }, + ErrorObject::class.java, + ) ) } catch (e: Exception) { - null + JsonValue.fromJsonNode(node) } + } } ) private val lock = ReentrantLock() From 0c9aff015f2abf7320011bb0c7e847dc92adb12c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 19:09:42 +0000 Subject: [PATCH 05/27] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ab1af60f9..743417b14 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-21ecab7aeb61612b9da5e52ea4c0cb75a33d443d975022934b9305e97d1a7d62.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-81b872fc8a50941a72f77f3fa0791f7234b9180db95b451b38ced94279e947c5.yml openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f -config_hash: dd484e2cc01206d26516338d0f4596b0 +config_hash: 4a32815d42629ed593422278834dcca4 From b5dbd07e1147f5554509481798978717e22b03af Mon Sep 17 00:00:00 2001 From: Abdullah Khan Date: Tue, 5 May 2026 00:59:40 +0530 Subject: [PATCH 06/27] docs: remove bad semicolon (#725) The sample code wont compile with the unneeded ";". Fixed that. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85783c2d6..5405e2f1f 100644 --- a/README.md +++ b/README.md @@ -349,7 +349,7 @@ client.async().chat().completions().createStreaming(params) .subscribe(chunk -> { System.out.println(chunk); }) - .onCompleteFuture(); + .onCompleteFuture() .whenComplete((unused, error) -> { if (error != null) { System.out.println("Something went wrong!"); From e1e1161d69d30bd6639ada5ead3a30f14c68cf8d Mon Sep 17 00:00:00 2001 From: Rohan Santhosh Kumar <181558744+Rohan5commit@users.noreply.github.com> Date: Tue, 5 May 2026 03:33:25 +0800 Subject: [PATCH 07/27] docs: clarify structured output map limitations (#726) Co-authored-by: Codex --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5405e2f1f..0af37cfc9 100644 --- a/README.md +++ b/README.md @@ -711,6 +711,8 @@ properties can be derived. This may occur if, for example: - All fields and getter methods are non-`public`, but none are annotated with `@JsonProperty`. - A field or getter method is declared with a `Map` type. A `Map` is treated like a separate class with no named properties, so it will result in an empty `"properties"` field in the JSON schema. + If you need arbitrary key/value data, model it as a list of entry objects with named fields so the + generated schema still has concrete property names. ### Annotating classes and JSON schemas From 157207fefe59174141a5aec6a983c546def242b4 Mon Sep 17 00:00:00 2001 From: Vu Nguyen Duc Thang Date: Tue, 5 May 2026 02:43:48 +0700 Subject: [PATCH 08/27] fix(logging): redact Azure api-key header in logging (#717) When `OPENAI_LOG` is configured, `HttpLoggingInterceptor` logs HTTP requests/responses. Previously, only the `Authorization` header was redacted. This commit also redacts the `api-key` header to ensure Azure API keys are not exposed in application logs. --- .../src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt index 51c32b0c2..cd981f8fa 100644 --- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt +++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt @@ -95,7 +95,10 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie } if (logLevel != null) { clientBuilder.addNetworkInterceptor( - HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") } + HttpLoggingInterceptor().setLevel(logLevel).apply { + redactHeader("Authorization") + redactHeader("api-key") + } ) } From 06e43e2ca1a630dd8b4d38b151724d6b3fb5e014 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 20:07:34 +0000 Subject: [PATCH 09/27] chore: remove duplicated dokka setup --- build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index b5eeb1848..4f3562591 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,6 @@ subprojects { group = "Verification" description = "Verifies all source files are formatted." } - apply(plugin = "org.jetbrains.dokka") } subprojects { From f35ad61ae41b413ad0f7141088207c558f40ee5b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 20:44:43 +0000 Subject: [PATCH 10/27] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 743417b14..0f287ffa1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-81b872fc8a50941a72f77f3fa0791f7234b9180db95b451b38ced94279e947c5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-b29ed93b301b4a89daf4fb5bb6463cbc059ce944ff9808639679794c10e60dd6.yml openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f -config_hash: 4a32815d42629ed593422278834dcca4 +config_hash: 2524657a4d3e2779f4a70cc581c33d80 From 021f44a12a39f7e1b8e405e4f309f1a4d0223ed6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 21:31:48 +0000 Subject: [PATCH 11/27] chore(tests): update test fixtures to use valid example URLs --- .stats.yml | 4 ++-- .../conversations/ComputerScreenshotContentTest.kt | 6 +++--- .../openai/models/responses/ResponseContentTest.kt | 8 ++++---- .../responses/ResponseFunctionCallOutputItemTest.kt | 8 ++++---- .../models/responses/ResponseInputContentTest.kt | 8 ++++---- .../models/responses/ResponseInputFileContentTest.kt | 6 +++--- .../openai/models/responses/ResponseInputFileTest.kt | 6 +++--- .../responses/ResponseInputImageContentTest.kt | 6 +++--- .../models/responses/ResponseInputImageTest.kt | 6 +++--- .../models/videos/ImageInputReferenceParamTest.kt | 12 +++++++++--- 10 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0f287ffa1..ad8c348e0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-b29ed93b301b4a89daf4fb5bb6463cbc059ce944ff9808639679794c10e60dd6.yml -openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-70926f399403fb20d9cee460500dad50a9555dd72b5abb768215e9f541a648ea.yml +openapi_spec_hash: ae4a7852e20f39c14adbf6f253b8a004 config_hash: 2524657a4d3e2779f4a70cc581c33d80 diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt index fe8b29cac..33c65dc87 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt @@ -15,13 +15,13 @@ internal class ComputerScreenshotContentTest { ComputerScreenshotContent.builder() .detail(ComputerScreenshotContent.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() assertThat(computerScreenshotContent.detail()) .isEqualTo(ComputerScreenshotContent.Detail.LOW) assertThat(computerScreenshotContent.fileId()).contains("file_id") - assertThat(computerScreenshotContent.imageUrl()).contains("image_url") + assertThat(computerScreenshotContent.imageUrl()).contains("https://example.com") } @Test @@ -31,7 +31,7 @@ internal class ComputerScreenshotContentTest { ComputerScreenshotContent.builder() .detail(ComputerScreenshotContent.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() val roundtrippedComputerScreenshotContent = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt index ce3b0115b..cdedcf926 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt @@ -49,7 +49,7 @@ internal class ResponseContentTest { ResponseInputImage.builder() .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() val responseContent = ResponseContent.ofInputImage(inputImage) @@ -70,7 +70,7 @@ internal class ResponseContentTest { ResponseInputImage.builder() .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() ) @@ -90,7 +90,7 @@ internal class ResponseContentTest { .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() @@ -113,7 +113,7 @@ internal class ResponseContentTest { .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt index c0bf02749..641d62f1b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt @@ -49,7 +49,7 @@ internal class ResponseFunctionCallOutputItemTest { ResponseInputImageContent.builder() .detail(ResponseInputImageContent.Detail.LOW) .fileId("file-123") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() val responseFunctionCallOutputItem = ResponseFunctionCallOutputItem.ofInputImage(inputImage) @@ -67,7 +67,7 @@ internal class ResponseFunctionCallOutputItemTest { ResponseInputImageContent.builder() .detail(ResponseInputImageContent.Detail.LOW) .fileId("file-123") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() ) @@ -88,7 +88,7 @@ internal class ResponseFunctionCallOutputItemTest { .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() @@ -108,7 +108,7 @@ internal class ResponseFunctionCallOutputItemTest { .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt index e858d4ed1..478b5cf7c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt @@ -46,7 +46,7 @@ internal class ResponseInputContentTest { ResponseInputImage.builder() .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() val responseInputContent = ResponseInputContent.ofInputImage(inputImage) @@ -64,7 +64,7 @@ internal class ResponseInputContentTest { ResponseInputImage.builder() .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() ) @@ -84,7 +84,7 @@ internal class ResponseInputContentTest { .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() @@ -104,7 +104,7 @@ internal class ResponseInputContentTest { .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt index 6da42f675..39ade6cab 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt @@ -16,14 +16,14 @@ internal class ResponseInputFileContentTest { .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() assertThat(responseInputFileContent.detail()).contains(ResponseInputFileContent.Detail.LOW) assertThat(responseInputFileContent.fileData()).contains("file_data") assertThat(responseInputFileContent.fileId()).contains("file-123") - assertThat(responseInputFileContent.fileUrl()).contains("file_url") + assertThat(responseInputFileContent.fileUrl()).contains("https://example.com") assertThat(responseInputFileContent.filename()).contains("filename") } @@ -35,7 +35,7 @@ internal class ResponseInputFileContentTest { .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt index cdeb34f34..056c2158f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt @@ -16,14 +16,14 @@ internal class ResponseInputFileTest { .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() assertThat(responseInputFile.detail()).contains(ResponseInputFile.Detail.LOW) assertThat(responseInputFile.fileData()).contains("file_data") assertThat(responseInputFile.fileId()).contains("file_id") - assertThat(responseInputFile.fileUrl()).contains("file_url") + assertThat(responseInputFile.fileUrl()).contains("https://example.com") assertThat(responseInputFile.filename()).contains("filename") } @@ -35,7 +35,7 @@ internal class ResponseInputFileTest { .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") - .fileUrl("file_url") + .fileUrl("https://example.com") .filename("filename") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt index efca62a88..d83425b2d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt @@ -15,13 +15,13 @@ internal class ResponseInputImageContentTest { ResponseInputImageContent.builder() .detail(ResponseInputImageContent.Detail.LOW) .fileId("file-123") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() assertThat(responseInputImageContent.detail()) .contains(ResponseInputImageContent.Detail.LOW) assertThat(responseInputImageContent.fileId()).contains("file-123") - assertThat(responseInputImageContent.imageUrl()).contains("image_url") + assertThat(responseInputImageContent.imageUrl()).contains("https://example.com") } @Test @@ -31,7 +31,7 @@ internal class ResponseInputImageContentTest { ResponseInputImageContent.builder() .detail(ResponseInputImageContent.Detail.LOW) .fileId("file-123") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() val roundtrippedResponseInputImageContent = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt index 8d753c1aa..fc2dab855 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt @@ -15,12 +15,12 @@ internal class ResponseInputImageTest { ResponseInputImage.builder() .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() assertThat(responseInputImage.detail()).isEqualTo(ResponseInputImage.Detail.LOW) assertThat(responseInputImage.fileId()).contains("file_id") - assertThat(responseInputImage.imageUrl()).contains("image_url") + assertThat(responseInputImage.imageUrl()).contains("https://example.com") } @Test @@ -30,7 +30,7 @@ internal class ResponseInputImageTest { ResponseInputImage.builder() .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") - .imageUrl("image_url") + .imageUrl("https://example.com") .build() val roundtrippedResponseInputImage = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/videos/ImageInputReferenceParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/videos/ImageInputReferenceParamTest.kt index d0805739a..2d8945604 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/videos/ImageInputReferenceParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/videos/ImageInputReferenceParamTest.kt @@ -12,17 +12,23 @@ internal class ImageInputReferenceParamTest { @Test fun create() { val imageInputReferenceParam = - ImageInputReferenceParam.builder().fileId("file-123").imageUrl("image_url").build() + ImageInputReferenceParam.builder() + .fileId("file-123") + .imageUrl("https://example.com") + .build() assertThat(imageInputReferenceParam.fileId()).contains("file-123") - assertThat(imageInputReferenceParam.imageUrl()).contains("image_url") + assertThat(imageInputReferenceParam.imageUrl()).contains("https://example.com") } @Test fun roundtrip() { val jsonMapper = jsonMapper() val imageInputReferenceParam = - ImageInputReferenceParam.builder().fileId("file-123").imageUrl("image_url").build() + ImageInputReferenceParam.builder() + .fileId("file-123") + .imageUrl("https://example.com") + .build() val roundtrippedImageInputReferenceParam = jsonMapper.readValue( From 6bdc12ed832827d3e9bdb9825898bfa5aee94d26 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 23:23:12 +0000 Subject: [PATCH 12/27] perf(client): create one json mapper --- .../src/main/kotlin/com/openai/core/ObjectMappers.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt b/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt index a552585ee..4a3133fbd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt +++ b/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt @@ -29,7 +29,9 @@ import java.time.ZoneId import java.time.format.DateTimeFormatter import java.time.temporal.ChronoField -fun jsonMapper(): JsonMapper = +fun jsonMapper(): JsonMapper = JSON_MAPPER + +private val JSON_MAPPER: JsonMapper = JsonMapper.builder() .addModule(kotlinModule()) .addModule(Jdk8Module()) From 45b7c6a558e55fe3b16d6aea5ec8f2df1077eadc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 00:42:03 +0000 Subject: [PATCH 13/27] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ad8c348e0..a1b584040 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-70926f399403fb20d9cee460500dad50a9555dd72b5abb768215e9f541a648ea.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-61d75f384a1e6bee387e9e02168257426facdbbb9677b9b5cb30a3863da40b10.yml openapi_spec_hash: ae4a7852e20f39c14adbf6f253b8a004 -config_hash: 2524657a4d3e2779f4a70cc581c33d80 +config_hash: 51d639d7939b6ab974d1ee45e96c532b From 18fe08af6a53d6ef9b35e03190e137b02231608e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 08:07:56 +0000 Subject: [PATCH 14/27] docs(api): document web_search_call.results in response includables --- .stats.yml | 4 ++-- .../kotlin/com/openai/models/responses/ResponseIncludable.kt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a1b584040..fbb72ac01 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-61d75f384a1e6bee387e9e02168257426facdbbb9677b9b5cb30a3863da40b10.yml -openapi_spec_hash: ae4a7852e20f39c14adbf6f253b8a004 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-1405c20d24646f71eecd0f7ed222426973b8806ef70a3865a2428c0c57b1f050.yml +openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 config_hash: 51d639d7939b6ab974d1ee45e96c532b diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt index a0b7586b2..a520535ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseIncludable.kt @@ -9,6 +9,7 @@ import com.openai.errors.OpenAIInvalidDataException /** * Specify additional output data to include in the model response. Currently supported values are: + * - `web_search_call.results`: Include the search results of the web search tool call. * - `web_search_call.action.sources`: Include the sources of the web search tool call. * - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code * interpreter tool call items. From 28ad9189d7293388d043ed83496333132afc517f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 15:49:36 +0000 Subject: [PATCH 15/27] feat(api): launch realtime translate + update image 2 --- .stats.yml | 4 +- .../openai/models/images/ImageEditParams.kt | 80 +++++++++++-------- .../models/images/ImageGenerateParams.kt | 20 +++-- .../com/openai/models/images/ImageModel.kt | 42 +++++++--- .../com/openai/models/responses/Tool.kt | 18 +++++ .../services/async/RealtimeServiceAsync.kt | 5 ++ .../async/RealtimeServiceAsyncImpl.kt | 14 ++++ .../async/realtime/TranslationServiceAsync.kt | 47 +++++++++++ .../realtime/TranslationServiceAsyncImpl.kt | 56 +++++++++++++ .../realtime/translations/CallServiceAsync.kt | 32 ++++++++ .../translations/CallServiceAsyncImpl.kt | 30 +++++++ .../translations/ClientSecretServiceAsync.kt | 37 +++++++++ .../ClientSecretServiceAsyncImpl.kt | 30 +++++++ .../services/blocking/RealtimeService.kt | 5 ++ .../services/blocking/RealtimeServiceImpl.kt | 12 +++ .../blocking/realtime/TranslationService.kt | 46 +++++++++++ .../realtime/TranslationServiceImpl.kt | 56 +++++++++++++ .../realtime/translations/CallService.kt | 32 ++++++++ .../realtime/translations/CallServiceImpl.kt | 29 +++++++ .../translations/ClientSecretService.kt | 36 +++++++++ .../translations/ClientSecretServiceImpl.kt | 30 +++++++ .../images/ImageCreateVariationParamsTest.kt | 6 +- .../models/images/ImageEditParamsTest.kt | 6 +- .../models/images/ImageGenerateParamsTest.kt | 6 +- .../services/async/ImageServiceAsyncTest.kt | 10 +-- .../services/blocking/ImageServiceTest.kt | 10 +-- 26 files changed, 624 insertions(+), 75 deletions(-) create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsync.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsyncImpl.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsync.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsyncImpl.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsync.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsyncImpl.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationService.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationServiceImpl.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallService.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallServiceImpl.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretService.kt create mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretServiceImpl.kt diff --git a/.stats.yml b/.stats.yml index fbb72ac01..56a453917 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-1405c20d24646f71eecd0f7ed222426973b8806ef70a3865a2428c0c57b1f050.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5ae2eda70e6a4a375842fb8bf3e88deab8e0aad1b3871b86e73274f131bb37ce.yml openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 -config_hash: 51d639d7939b6ab974d1ee45e96c532b +config_hash: c15a744b2771a3948032b2438475b330 diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt index 866b2d25d..920b13bca 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt @@ -46,9 +46,9 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image - * should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. - * `chatgpt-image-latest` follows the same input constraints as GPT image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + * `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image should be a `png`, `webp`, + * or `jpg` file less than 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file less * than 4MB. @@ -104,7 +104,9 @@ private constructor( fun mask(): Optional = body.mask() /** - * The model to use for image generation. Defaults to `gpt-image-1.5`. + * The model to use for image generation. One of `dall-e-2` or a GPT image model (`gpt-image-1`, + * `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, or + * `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -347,9 +349,9 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each - * image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 - * images. `chatgpt-image-latest` follows the same input constraints as GPT image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image should + * be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file less * than 4MB. @@ -370,9 +372,9 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each - * image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 - * images. `chatgpt-image-latest` follows the same input constraints as GPT image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image should + * be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file less * than 4MB. @@ -382,9 +384,9 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each - * image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 - * images. `chatgpt-image-latest` follows the same input constraints as GPT image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image should + * be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file less * than 4MB. @@ -493,7 +495,11 @@ private constructor( */ fun mask(path: Path) = apply { body.mask(path) } - /** The model to use for image generation. Defaults to `gpt-image-1.5`. */ + /** + * The model to use for image generation. One of `dall-e-2` or a GPT image model + * (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + * `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. + */ fun model(model: ImageModel?) = apply { body.model(model) } /** Alias for calling [Builder.model] with `model.orElse(null)`. */ @@ -874,9 +880,9 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each - * image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 - * images. `chatgpt-image-latest` follows the same input constraints as GPT image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image should + * be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file less * than 4MB. @@ -933,7 +939,9 @@ private constructor( fun mask(): Optional = mask.value.getOptional("mask") /** - * The model to use for image generation. Defaults to `gpt-image-1.5`. + * The model to use for image generation. One of `dall-e-2` or a GPT image model + * (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + * `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1205,10 +1213,10 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), - * each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide - * up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT - * image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + * should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 + * images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file * less than 4MB. @@ -1236,10 +1244,10 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), - * each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide - * up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT - * image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + * should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 + * images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file * less than 4MB. @@ -1249,10 +1257,10 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), - * each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide - * up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT - * image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + * `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + * should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 + * images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file * less than 4MB. @@ -1373,7 +1381,11 @@ private constructor( .build() ) - /** The model to use for image generation. Defaults to `gpt-image-1.5`. */ + /** + * The model to use for image generation. One of `dall-e-2` or a GPT image model + * (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + * `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. + */ fun model(model: ImageModel?) = model(MultipartField.of(model)) /** Alias for calling [Builder.model] with `model.orElse(null)`. */ @@ -1730,9 +1742,9 @@ private constructor( /** * The image(s) to edit. Must be a supported image file or an array of images. * - * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image - * should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. - * `chatgpt-image-latest` follows the same input constraints as GPT image models. + * For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + * `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image should be a `png`, `webp`, + * or `jpg` file less than 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` file less * than 4MB. diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt index df188aabf..e361795ef 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt @@ -56,8 +56,9 @@ private constructor( /** * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model - * (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless a - * parameter specific to the GPT image models is used. + * (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, or + * `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific to the GPT + * image models is used. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -350,8 +351,9 @@ private constructor( /** * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image - * model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless - * a parameter specific to the GPT image models is used. + * model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, or + * `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific to the GPT + * image models is used. */ fun model(model: ImageModel?) = apply { body.model(model) } @@ -829,8 +831,9 @@ private constructor( /** * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image - * model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless - * a parameter specific to the GPT image models is used. + * model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, or + * `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific to the GPT + * image models is used. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1154,8 +1157,9 @@ private constructor( /** * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image - * model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` - * unless a parameter specific to the GPT image models is used. + * model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, or + * `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific to the + * GPT image models is used. */ fun model(model: ImageModel?) = model(JsonField.ofNullable(model)) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt index fdfcd557f..b4603b6d1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageModel.kt @@ -20,26 +20,35 @@ class ImageModel @JsonCreator private constructor(private val value: JsonField Value.GPT_IMAGE_1 + GPT_IMAGE_1_MINI -> Value.GPT_IMAGE_1_MINI + GPT_IMAGE_2 -> Value.GPT_IMAGE_2 + GPT_IMAGE_2_2026_04_21 -> Value.GPT_IMAGE_2_2026_04_21 GPT_IMAGE_1_5 -> Value.GPT_IMAGE_1_5 + CHATGPT_IMAGE_LATEST -> Value.CHATGPT_IMAGE_LATEST DALL_E_2 -> Value.DALL_E_2 DALL_E_3 -> Value.DALL_E_3 - GPT_IMAGE_1 -> Value.GPT_IMAGE_1 - GPT_IMAGE_1_MINI -> Value.GPT_IMAGE_1_MINI else -> Value._UNKNOWN } @@ -88,11 +103,14 @@ class ImageModel @JsonCreator private constructor(private val value: JsonField Known.GPT_IMAGE_1 + GPT_IMAGE_1_MINI -> Known.GPT_IMAGE_1_MINI + GPT_IMAGE_2 -> Known.GPT_IMAGE_2 + GPT_IMAGE_2_2026_04_21 -> Known.GPT_IMAGE_2_2026_04_21 GPT_IMAGE_1_5 -> Known.GPT_IMAGE_1_5 + CHATGPT_IMAGE_LATEST -> Known.CHATGPT_IMAGE_LATEST DALL_E_2 -> Known.DALL_E_2 DALL_E_3 -> Known.DALL_E_3 - GPT_IMAGE_1 -> Known.GPT_IMAGE_1 - GPT_IMAGE_1_MINI -> Known.GPT_IMAGE_1_MINI else -> throw OpenAIInvalidDataException("Unknown ImageModel: $value") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt index 1faad2360..4bf16e5e5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/Tool.kt @@ -5809,8 +5809,14 @@ private constructor( @JvmField val GPT_IMAGE_1_MINI = of("gpt-image-1-mini") + @JvmField val GPT_IMAGE_2 = of("gpt-image-2") + + @JvmField val GPT_IMAGE_2_2026_04_21 = of("gpt-image-2-2026-04-21") + @JvmField val GPT_IMAGE_1_5 = of("gpt-image-1.5") + @JvmField val CHATGPT_IMAGE_LATEST = of("chatgpt-image-latest") + @JvmStatic fun of(value: String) = Model(JsonField.of(value)) } @@ -5818,7 +5824,10 @@ private constructor( enum class Known { GPT_IMAGE_1, GPT_IMAGE_1_MINI, + GPT_IMAGE_2, + GPT_IMAGE_2_2026_04_21, GPT_IMAGE_1_5, + CHATGPT_IMAGE_LATEST, } /** @@ -5833,7 +5842,10 @@ private constructor( enum class Value { GPT_IMAGE_1, GPT_IMAGE_1_MINI, + GPT_IMAGE_2, + GPT_IMAGE_2_2026_04_21, GPT_IMAGE_1_5, + CHATGPT_IMAGE_LATEST, /** * An enum member indicating that [Model] was instantiated with an unknown value. */ @@ -5851,7 +5863,10 @@ private constructor( when (this) { GPT_IMAGE_1 -> Value.GPT_IMAGE_1 GPT_IMAGE_1_MINI -> Value.GPT_IMAGE_1_MINI + GPT_IMAGE_2 -> Value.GPT_IMAGE_2 + GPT_IMAGE_2_2026_04_21 -> Value.GPT_IMAGE_2_2026_04_21 GPT_IMAGE_1_5 -> Value.GPT_IMAGE_1_5 + CHATGPT_IMAGE_LATEST -> Value.CHATGPT_IMAGE_LATEST else -> Value._UNKNOWN } @@ -5868,7 +5883,10 @@ private constructor( when (this) { GPT_IMAGE_1 -> Known.GPT_IMAGE_1 GPT_IMAGE_1_MINI -> Known.GPT_IMAGE_1_MINI + GPT_IMAGE_2 -> Known.GPT_IMAGE_2 + GPT_IMAGE_2_2026_04_21 -> Known.GPT_IMAGE_2_2026_04_21 GPT_IMAGE_1_5 -> Known.GPT_IMAGE_1_5 + CHATGPT_IMAGE_LATEST -> Known.CHATGPT_IMAGE_LATEST else -> throw OpenAIInvalidDataException("Unknown Model: $value") } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsync.kt index 8595c99a5..6801e8478 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsync.kt @@ -5,6 +5,7 @@ package com.openai.services.async import com.openai.core.ClientOptions import com.openai.services.async.realtime.CallServiceAsync import com.openai.services.async.realtime.ClientSecretServiceAsync +import com.openai.services.async.realtime.TranslationServiceAsync import java.util.function.Consumer interface RealtimeServiceAsync { @@ -25,6 +26,8 @@ interface RealtimeServiceAsync { fun calls(): CallServiceAsync + fun translations(): TranslationServiceAsync + /** * A view of [RealtimeServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -42,5 +45,7 @@ interface RealtimeServiceAsync { fun clientSecrets(): ClientSecretServiceAsync.WithRawResponse fun calls(): CallServiceAsync.WithRawResponse + + fun translations(): TranslationServiceAsync.WithRawResponse } } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsyncImpl.kt index 4b2443bfc..b9f550789 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsyncImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/RealtimeServiceAsyncImpl.kt @@ -7,6 +7,8 @@ import com.openai.services.async.realtime.CallServiceAsync import com.openai.services.async.realtime.CallServiceAsyncImpl import com.openai.services.async.realtime.ClientSecretServiceAsync import com.openai.services.async.realtime.ClientSecretServiceAsyncImpl +import com.openai.services.async.realtime.TranslationServiceAsync +import com.openai.services.async.realtime.TranslationServiceAsyncImpl import java.util.function.Consumer class RealtimeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -22,6 +24,10 @@ class RealtimeServiceAsyncImpl internal constructor(private val clientOptions: C private val calls: CallServiceAsync by lazy { CallServiceAsyncImpl(clientOptions) } + private val translations: TranslationServiceAsync by lazy { + TranslationServiceAsyncImpl(clientOptions) + } + override fun withRawResponse(): RealtimeServiceAsync.WithRawResponse = withRawResponse override fun withOptions(modifier: Consumer): RealtimeServiceAsync = @@ -31,6 +37,8 @@ class RealtimeServiceAsyncImpl internal constructor(private val clientOptions: C override fun calls(): CallServiceAsync = calls + override fun translations(): TranslationServiceAsync = translations + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : RealtimeServiceAsync.WithRawResponse { @@ -42,6 +50,10 @@ class RealtimeServiceAsyncImpl internal constructor(private val clientOptions: C CallServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val translations: TranslationServiceAsync.WithRawResponse by lazy { + TranslationServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): RealtimeServiceAsync.WithRawResponse = @@ -52,5 +64,7 @@ class RealtimeServiceAsyncImpl internal constructor(private val clientOptions: C override fun clientSecrets(): ClientSecretServiceAsync.WithRawResponse = clientSecrets override fun calls(): CallServiceAsync.WithRawResponse = calls + + override fun translations(): TranslationServiceAsync.WithRawResponse = translations } } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsync.kt new file mode 100644 index 000000000..6c9264656 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsync.kt @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.async.realtime + +import com.openai.core.ClientOptions +import com.openai.services.async.realtime.translations.CallServiceAsync +import com.openai.services.async.realtime.translations.ClientSecretServiceAsync +import java.util.function.Consumer + +interface TranslationServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TranslationServiceAsync + + fun clientSecrets(): ClientSecretServiceAsync + + fun calls(): CallServiceAsync + + /** + * A view of [TranslationServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): TranslationServiceAsync.WithRawResponse + + fun clientSecrets(): ClientSecretServiceAsync.WithRawResponse + + fun calls(): CallServiceAsync.WithRawResponse + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsyncImpl.kt new file mode 100644 index 000000000..ce00c9f8b --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsyncImpl.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.async.realtime + +import com.openai.core.ClientOptions +import com.openai.services.async.realtime.translations.CallServiceAsync +import com.openai.services.async.realtime.translations.CallServiceAsyncImpl +import com.openai.services.async.realtime.translations.ClientSecretServiceAsync +import com.openai.services.async.realtime.translations.ClientSecretServiceAsyncImpl +import java.util.function.Consumer + +class TranslationServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TranslationServiceAsync { + + private val withRawResponse: TranslationServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val clientSecrets: ClientSecretServiceAsync by lazy { + ClientSecretServiceAsyncImpl(clientOptions) + } + + private val calls: CallServiceAsync by lazy { CallServiceAsyncImpl(clientOptions) } + + override fun withRawResponse(): TranslationServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): TranslationServiceAsync = + TranslationServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun clientSecrets(): ClientSecretServiceAsync = clientSecrets + + override fun calls(): CallServiceAsync = calls + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TranslationServiceAsync.WithRawResponse { + + private val clientSecrets: ClientSecretServiceAsync.WithRawResponse by lazy { + ClientSecretServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val calls: CallServiceAsync.WithRawResponse by lazy { + CallServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): TranslationServiceAsync.WithRawResponse = + TranslationServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun clientSecrets(): ClientSecretServiceAsync.WithRawResponse = clientSecrets + + override fun calls(): CallServiceAsync.WithRawResponse = calls + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsync.kt new file mode 100644 index 000000000..56925f06e --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsync.kt @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.async.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +interface CallServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CallServiceAsync + + /** A view of [CallServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CallServiceAsync.WithRawResponse + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsyncImpl.kt new file mode 100644 index 000000000..55c7bb5ac --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsyncImpl.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.async.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +class CallServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CallServiceAsync { + + private val withRawResponse: CallServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): CallServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): CallServiceAsync = + CallServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CallServiceAsync.WithRawResponse { + + override fun withOptions( + modifier: Consumer + ): CallServiceAsync.WithRawResponse = + CallServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsync.kt new file mode 100644 index 000000000..16511605e --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsync.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.async.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +interface ClientSecretServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ClientSecretServiceAsync + + /** + * A view of [ClientSecretServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ClientSecretServiceAsync.WithRawResponse + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsyncImpl.kt new file mode 100644 index 000000000..44f69eaa5 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsyncImpl.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.async.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +class ClientSecretServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ClientSecretServiceAsync { + + private val withRawResponse: ClientSecretServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): ClientSecretServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): ClientSecretServiceAsync = + ClientSecretServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ClientSecretServiceAsync.WithRawResponse { + + override fun withOptions( + modifier: Consumer + ): ClientSecretServiceAsync.WithRawResponse = + ClientSecretServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeService.kt index b776aa494..c32ce384d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeService.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeService.kt @@ -5,6 +5,7 @@ package com.openai.services.blocking import com.openai.core.ClientOptions import com.openai.services.blocking.realtime.CallService import com.openai.services.blocking.realtime.ClientSecretService +import com.openai.services.blocking.realtime.TranslationService import java.util.function.Consumer interface RealtimeService { @@ -25,6 +26,8 @@ interface RealtimeService { fun calls(): CallService + fun translations(): TranslationService + /** A view of [RealtimeService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -38,5 +41,7 @@ interface RealtimeService { fun clientSecrets(): ClientSecretService.WithRawResponse fun calls(): CallService.WithRawResponse + + fun translations(): TranslationService.WithRawResponse } } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeServiceImpl.kt index aa4301263..dc172def7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeServiceImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/RealtimeServiceImpl.kt @@ -7,6 +7,8 @@ import com.openai.services.blocking.realtime.CallService import com.openai.services.blocking.realtime.CallServiceImpl import com.openai.services.blocking.realtime.ClientSecretService import com.openai.services.blocking.realtime.ClientSecretServiceImpl +import com.openai.services.blocking.realtime.TranslationService +import com.openai.services.blocking.realtime.TranslationServiceImpl import java.util.function.Consumer class RealtimeServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -22,6 +24,8 @@ class RealtimeServiceImpl internal constructor(private val clientOptions: Client private val calls: CallService by lazy { CallServiceImpl(clientOptions) } + private val translations: TranslationService by lazy { TranslationServiceImpl(clientOptions) } + override fun withRawResponse(): RealtimeService.WithRawResponse = withRawResponse override fun withOptions(modifier: Consumer): RealtimeService = @@ -31,6 +35,8 @@ class RealtimeServiceImpl internal constructor(private val clientOptions: Client override fun calls(): CallService = calls + override fun translations(): TranslationService = translations + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : RealtimeService.WithRawResponse { @@ -42,6 +48,10 @@ class RealtimeServiceImpl internal constructor(private val clientOptions: Client CallServiceImpl.WithRawResponseImpl(clientOptions) } + private val translations: TranslationService.WithRawResponse by lazy { + TranslationServiceImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): RealtimeService.WithRawResponse = @@ -52,5 +62,7 @@ class RealtimeServiceImpl internal constructor(private val clientOptions: Client override fun clientSecrets(): ClientSecretService.WithRawResponse = clientSecrets override fun calls(): CallService.WithRawResponse = calls + + override fun translations(): TranslationService.WithRawResponse = translations } } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationService.kt new file mode 100644 index 000000000..ce9dd2825 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationService.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.blocking.realtime + +import com.openai.core.ClientOptions +import com.openai.services.blocking.realtime.translations.CallService +import com.openai.services.blocking.realtime.translations.ClientSecretService +import java.util.function.Consumer + +interface TranslationService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TranslationService + + fun clientSecrets(): ClientSecretService + + fun calls(): CallService + + /** + * A view of [TranslationService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): TranslationService.WithRawResponse + + fun clientSecrets(): ClientSecretService.WithRawResponse + + fun calls(): CallService.WithRawResponse + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationServiceImpl.kt new file mode 100644 index 000000000..23cf6c1bc --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationServiceImpl.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.blocking.realtime + +import com.openai.core.ClientOptions +import com.openai.services.blocking.realtime.translations.CallService +import com.openai.services.blocking.realtime.translations.CallServiceImpl +import com.openai.services.blocking.realtime.translations.ClientSecretService +import com.openai.services.blocking.realtime.translations.ClientSecretServiceImpl +import java.util.function.Consumer + +class TranslationServiceImpl internal constructor(private val clientOptions: ClientOptions) : + TranslationService { + + private val withRawResponse: TranslationService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val clientSecrets: ClientSecretService by lazy { + ClientSecretServiceImpl(clientOptions) + } + + private val calls: CallService by lazy { CallServiceImpl(clientOptions) } + + override fun withRawResponse(): TranslationService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): TranslationService = + TranslationServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun clientSecrets(): ClientSecretService = clientSecrets + + override fun calls(): CallService = calls + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TranslationService.WithRawResponse { + + private val clientSecrets: ClientSecretService.WithRawResponse by lazy { + ClientSecretServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val calls: CallService.WithRawResponse by lazy { + CallServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): TranslationService.WithRawResponse = + TranslationServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun clientSecrets(): ClientSecretService.WithRawResponse = clientSecrets + + override fun calls(): CallService.WithRawResponse = calls + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallService.kt new file mode 100644 index 000000000..e24742d71 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallService.kt @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.blocking.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +interface CallService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CallService + + /** A view of [CallService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CallService.WithRawResponse + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallServiceImpl.kt new file mode 100644 index 000000000..40073a726 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallServiceImpl.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.blocking.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +class CallServiceImpl internal constructor(private val clientOptions: ClientOptions) : CallService { + + private val withRawResponse: CallService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): CallService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): CallService = + CallServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CallService.WithRawResponse { + + override fun withOptions( + modifier: Consumer + ): CallService.WithRawResponse = + CallServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretService.kt new file mode 100644 index 000000000..f60ff149d --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretService.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.blocking.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +interface ClientSecretService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ClientSecretService + + /** + * A view of [ClientSecretService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ClientSecretService.WithRawResponse + } +} diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretServiceImpl.kt new file mode 100644 index 000000000..54da27855 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretServiceImpl.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.services.blocking.realtime.translations + +import com.openai.core.ClientOptions +import java.util.function.Consumer + +class ClientSecretServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ClientSecretService { + + private val withRawResponse: ClientSecretService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): ClientSecretService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): ClientSecretService = + ClientSecretServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ClientSecretService.WithRawResponse { + + override fun withOptions( + modifier: Consumer + ): ClientSecretService.WithRawResponse = + ClientSecretServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + } +} diff --git a/openai-java-core/src/test/kotlin/com/openai/models/images/ImageCreateVariationParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/images/ImageCreateVariationParamsTest.kt index b58bfcba0..b5c637ec9 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/images/ImageCreateVariationParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/images/ImageCreateVariationParamsTest.kt @@ -13,7 +13,7 @@ internal class ImageCreateVariationParamsTest { fun create() { ImageCreateVariationParams.builder() .image("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_1) .n(1L) .responseFormat(ImageCreateVariationParams.ResponseFormat.URL) .size(ImageCreateVariationParams.Size._1024X1024) @@ -26,7 +26,7 @@ internal class ImageCreateVariationParamsTest { val params = ImageCreateVariationParams.builder() .image("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_1) .n(1L) .responseFormat(ImageCreateVariationParams.ResponseFormat.URL) .size(ImageCreateVariationParams.Size._1024X1024) @@ -46,7 +46,7 @@ internal class ImageCreateVariationParamsTest { .isEqualTo( mapOf( "image" to MultipartField.of("Example data".byteInputStream()), - "model" to MultipartField.of(ImageModel.GPT_IMAGE_1_5), + "model" to MultipartField.of(ImageModel.GPT_IMAGE_1), "n" to MultipartField.of(1L), "response_format" to MultipartField.of(ImageCreateVariationParams.ResponseFormat.URL), diff --git a/openai-java-core/src/test/kotlin/com/openai/models/images/ImageEditParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/images/ImageEditParamsTest.kt index e55e31d17..054e84665 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/images/ImageEditParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/images/ImageEditParamsTest.kt @@ -17,7 +17,7 @@ internal class ImageEditParamsTest { .background(ImageEditParams.Background.TRANSPARENT) .inputFidelity(ImageEditParams.InputFidelity.HIGH) .mask("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .n(1L) .outputCompression(100L) .outputFormat(ImageEditParams.OutputFormat.PNG) @@ -38,7 +38,7 @@ internal class ImageEditParamsTest { .background(ImageEditParams.Background.TRANSPARENT) .inputFidelity(ImageEditParams.InputFidelity.HIGH) .mask("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .n(1L) .outputCompression(100L) .outputFormat(ImageEditParams.OutputFormat.PNG) @@ -74,7 +74,7 @@ internal class ImageEditParamsTest { "background" to MultipartField.of(ImageEditParams.Background.TRANSPARENT), "input_fidelity" to MultipartField.of(ImageEditParams.InputFidelity.HIGH), "mask" to MultipartField.of("Example data".byteInputStream()), - "model" to MultipartField.of(ImageModel.GPT_IMAGE_1_5), + "model" to MultipartField.of(ImageModel.GPT_IMAGE_2), "n" to MultipartField.of(1L), "output_compression" to MultipartField.of(100L), "output_format" to MultipartField.of(ImageEditParams.OutputFormat.PNG), diff --git a/openai-java-core/src/test/kotlin/com/openai/models/images/ImageGenerateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/images/ImageGenerateParamsTest.kt index f8b4b6323..8cc9b2e78 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/images/ImageGenerateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/images/ImageGenerateParamsTest.kt @@ -12,7 +12,7 @@ internal class ImageGenerateParamsTest { ImageGenerateParams.builder() .prompt("A cute baby sea otter") .background(ImageGenerateParams.Background.TRANSPARENT) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .moderation(ImageGenerateParams.Moderation.LOW) .n(1L) .outputCompression(100L) @@ -32,7 +32,7 @@ internal class ImageGenerateParamsTest { ImageGenerateParams.builder() .prompt("A cute baby sea otter") .background(ImageGenerateParams.Background.TRANSPARENT) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .moderation(ImageGenerateParams.Moderation.LOW) .n(1L) .outputCompression(100L) @@ -49,7 +49,7 @@ internal class ImageGenerateParamsTest { assertThat(body.prompt()).isEqualTo("A cute baby sea otter") assertThat(body.background()).contains(ImageGenerateParams.Background.TRANSPARENT) - assertThat(body.model()).contains(ImageModel.GPT_IMAGE_1_5) + assertThat(body.model()).contains(ImageModel.GPT_IMAGE_2) assertThat(body.moderation()).contains(ImageGenerateParams.Moderation.LOW) assertThat(body.n()).contains(1L) assertThat(body.outputCompression()).contains(100L) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt index 4a27902c2..e28a8f2c7 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt @@ -29,7 +29,7 @@ internal class ImageServiceAsyncTest { imageServiceAsync.createVariation( ImageCreateVariationParams.builder() .image("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_1) .n(1L) .responseFormat(ImageCreateVariationParams.ResponseFormat.URL) .size(ImageCreateVariationParams.Size._1024X1024) @@ -59,7 +59,7 @@ internal class ImageServiceAsyncTest { .background(ImageEditParams.Background.TRANSPARENT) .inputFidelity(ImageEditParams.InputFidelity.HIGH) .mask("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .n(1L) .outputCompression(100L) .outputFormat(ImageEditParams.OutputFormat.PNG) @@ -94,7 +94,7 @@ internal class ImageServiceAsyncTest { .background(ImageEditParams.Background.TRANSPARENT) .inputFidelity(ImageEditParams.InputFidelity.HIGH) .mask("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .n(1L) .outputCompression(100L) .outputFormat(ImageEditParams.OutputFormat.PNG) @@ -128,7 +128,7 @@ internal class ImageServiceAsyncTest { ImageGenerateParams.builder() .prompt("A cute baby sea otter") .background(ImageGenerateParams.Background.TRANSPARENT) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .moderation(ImageGenerateParams.Moderation.LOW) .n(1L) .outputCompression(100L) @@ -162,7 +162,7 @@ internal class ImageServiceAsyncTest { ImageGenerateParams.builder() .prompt("A cute baby sea otter") .background(ImageGenerateParams.Background.TRANSPARENT) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .moderation(ImageGenerateParams.Moderation.LOW) .n(1L) .outputCompression(100L) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ImageServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ImageServiceTest.kt index 214ca7ea3..12855c69e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ImageServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ImageServiceTest.kt @@ -29,7 +29,7 @@ internal class ImageServiceTest { imageService.createVariation( ImageCreateVariationParams.builder() .image("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_1) .n(1L) .responseFormat(ImageCreateVariationParams.ResponseFormat.URL) .size(ImageCreateVariationParams.Size._1024X1024) @@ -58,7 +58,7 @@ internal class ImageServiceTest { .background(ImageEditParams.Background.TRANSPARENT) .inputFidelity(ImageEditParams.InputFidelity.HIGH) .mask("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .n(1L) .outputCompression(100L) .outputFormat(ImageEditParams.OutputFormat.PNG) @@ -92,7 +92,7 @@ internal class ImageServiceTest { .background(ImageEditParams.Background.TRANSPARENT) .inputFidelity(ImageEditParams.InputFidelity.HIGH) .mask("Example data".byteInputStream()) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .n(1L) .outputCompression(100L) .outputFormat(ImageEditParams.OutputFormat.PNG) @@ -126,7 +126,7 @@ internal class ImageServiceTest { ImageGenerateParams.builder() .prompt("A cute baby sea otter") .background(ImageGenerateParams.Background.TRANSPARENT) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .moderation(ImageGenerateParams.Moderation.LOW) .n(1L) .outputCompression(100L) @@ -159,7 +159,7 @@ internal class ImageServiceTest { ImageGenerateParams.builder() .prompt("A cute baby sea otter") .background(ImageGenerateParams.Background.TRANSPARENT) - .model(ImageModel.GPT_IMAGE_1_5) + .model(ImageModel.GPT_IMAGE_2) .moderation(ImageGenerateParams.Moderation.LOW) .n(1L) .outputCompression(100L) From 8328a1eb51291dd0a317989e31e0989572bbfa0b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 17:11:24 +0000 Subject: [PATCH 16/27] feat(api): manual updates --- .stats.yml | 4 +- .../openai/models/images/ImageEditParams.kt | 293 +++++----------- .../models/images/ImageGenerateParams.kt | 314 +++++------------- .../com/openai/models/responses/Tool.kt | 236 ++++--------- .../services/async/RealtimeServiceAsync.kt | 5 - .../async/RealtimeServiceAsyncImpl.kt | 14 - .../async/realtime/TranslationServiceAsync.kt | 47 --- .../realtime/TranslationServiceAsyncImpl.kt | 56 ---- .../realtime/translations/CallServiceAsync.kt | 32 -- .../translations/CallServiceAsyncImpl.kt | 30 -- .../translations/ClientSecretServiceAsync.kt | 37 --- .../ClientSecretServiceAsyncImpl.kt | 30 -- .../services/blocking/RealtimeService.kt | 5 - .../services/blocking/RealtimeServiceImpl.kt | 12 - .../blocking/realtime/TranslationService.kt | 46 --- .../realtime/TranslationServiceImpl.kt | 56 ---- .../realtime/translations/CallService.kt | 32 -- .../realtime/translations/CallServiceImpl.kt | 29 -- .../translations/ClientSecretService.kt | 36 -- .../translations/ClientSecretServiceImpl.kt | 30 -- .../models/images/ImageEditParamsTest.kt | 6 +- .../models/images/ImageGenerateParamsTest.kt | 6 +- .../com/openai/models/responses/ToolTest.kt | 4 +- .../services/async/ImageServiceAsyncTest.kt | 8 +- .../services/blocking/ImageServiceTest.kt | 8 +- 25 files changed, 259 insertions(+), 1117 deletions(-) delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsync.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/TranslationServiceAsyncImpl.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsync.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/CallServiceAsyncImpl.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsync.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/async/realtime/translations/ClientSecretServiceAsyncImpl.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationService.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/TranslationServiceImpl.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallService.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/CallServiceImpl.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretService.kt delete mode 100644 openai-java-core/src/main/kotlin/com/openai/services/blocking/realtime/translations/ClientSecretServiceImpl.kt diff --git a/.stats.yml b/.stats.yml index 56a453917..aeb205052 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5ae2eda70e6a4a375842fb8bf3e88deab8e0aad1b3871b86e73274f131bb37ce.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5002c7ce1688cf372f6c268507494c5e6396f38db8d85d79029d949b7bb06fe3.yml openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 -config_hash: c15a744b2771a3948032b2438475b330 +config_hash: c6cf65d9b19a16ce4313602a2204d48f diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt index 920b13bca..8d7321096 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt @@ -69,9 +69,13 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This parameter is - * only supported for the GPT image models. Must be one of `transparent`, `opaque` or `auto` - * (default value). When `auto` is used, the model will automatically determine the best - * background for the image. + * only supported for GPT image models that support transparent backgrounds. Must be one of + * `transparent`, `opaque`, or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. Requests + * with `background` set to `transparent` will return an error for these models; use `opaque` or + * `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be set to * either `png` (default value) or `webp`. @@ -172,14 +176,20 @@ private constructor( fun responseFormat(): Optional = body.responseFormat() /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), - * `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of - * `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + * The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary + * resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height + * must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. + * Resolutions above `2560x1440` are experimental, and the maximum supported resolution is + * `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. + * The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image + * models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one + * of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, + * or `1024x1792`. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun size(): Optional = body.size() + fun size(): Optional = body.size() /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect @@ -285,7 +295,7 @@ private constructor( * * Unlike [size], this method doesn't throw if the multipart field has an unexpected type. */ - fun _size(): MultipartField = body._size() + fun _size(): MultipartField = body._size() /** * Returns the raw multipart value of [user]. @@ -414,9 +424,13 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This parameter - * is only supported for the GPT image models. Must be one of `transparent`, `opaque` or - * `auto` (default value). When `auto` is used, the model will automatically determine the - * best background for the image. + * is only supported for GPT image models that support transparent backgrounds. Must be one + * of `transparent`, `opaque`, or `auto` (default value). When `auto` is used, the model + * will automatically determine the best background for the image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. + * Requests with `background` set to `transparent` will return an error for these models; + * use `opaque` or `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be set to * either `png` (default value) or `webp`. @@ -669,22 +683,28 @@ private constructor( } /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), - * `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of - * `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + * The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, + * arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. + * Width and height must both be divisible by 16 and the requested aspect ratio must be + * between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum + * supported resolution is `3840x2160`. The requested size must also satisfy the model's + * current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and + * `1024x1536` are supported by the GPT image models; `auto` is supported for models that + * allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. + * For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. */ - fun size(size: Size?) = apply { body.size(size) } + fun size(size: String?) = apply { body.size(size) } /** Alias for calling [Builder.size] with `size.orElse(null)`. */ - fun size(size: Optional) = size(size.getOrNull()) + fun size(size: Optional) = size(size.getOrNull()) /** * Sets [Builder.size] to an arbitrary multipart value. * - * You should usually call [Builder.size] with a well-typed [Size] value instead. This + * You should usually call [Builder.size] with a well-typed [String] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun size(size: MultipartField) = apply { body.size(size) } + fun size(size: MultipartField) = apply { body.size(size) } /** * A unique identifier representing your end-user, which can help OpenAI to monitor and @@ -872,7 +892,7 @@ private constructor( private val partialImages: MultipartField, private val quality: MultipartField, private val responseFormat: MultipartField, - private val size: MultipartField, + private val size: MultipartField, private val user: MultipartField, private val additionalProperties: MutableMap, ) { @@ -903,9 +923,13 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This parameter - * is only supported for the GPT image models. Must be one of `transparent`, `opaque` or - * `auto` (default value). When `auto` is used, the model will automatically determine the - * best background for the image. + * is only supported for GPT image models that support transparent backgrounds. Must be one + * of `transparent`, `opaque`, or `auto` (default value). When `auto` is used, the model + * will automatically determine the best background for the image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. + * Requests with `background` set to `transparent` will return an error for these models; + * use `opaque` or `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be set to * either `png` (default value) or `webp`. @@ -1010,14 +1034,20 @@ private constructor( responseFormat.value.getOptional("response_format") /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), - * `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of - * `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + * The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, + * arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. + * Width and height must both be divisible by 16 and the requested aspect ratio must be + * between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum + * supported resolution is `3840x2160`. The requested size must also satisfy the model's + * current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and + * `1024x1536` are supported by the GPT image models; `auto` is supported for models that + * allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. + * For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun size(): Optional = size.value.getOptional("size") + fun size(): Optional = size.value.getOptional("size") /** * A unique identifier representing your end-user, which can help OpenAI to monitor and @@ -1137,7 +1167,7 @@ private constructor( * * Unlike [size], this method doesn't throw if the multipart field has an unexpected type. */ - @JsonProperty("size") @ExcludeMissing fun _size(): MultipartField = size + @JsonProperty("size") @ExcludeMissing fun _size(): MultipartField = size /** * Returns the raw multipart value of [user]. @@ -1187,7 +1217,7 @@ private constructor( private var partialImages: MultipartField = MultipartField.of(null) private var quality: MultipartField = MultipartField.of(null) private var responseFormat: MultipartField = MultipartField.of(null) - private var size: MultipartField = MultipartField.of(null) + private var size: MultipartField = MultipartField.of(null) private var user: MultipartField = MultipartField.of(null) private var additionalProperties: MutableMap = mutableMapOf() @@ -1295,9 +1325,14 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This - * parameter is only supported for the GPT image models. Must be one of `transparent`, - * `opaque` or `auto` (default value). When `auto` is used, the model will automatically - * determine the best background for the image. + * parameter is only supported for GPT image models that support transparent + * backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). When + * `auto` is used, the model will automatically determine the best background for the + * image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. + * Requests with `background` set to `transparent` will return an error for these + * models; use `opaque` or `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be * set to either `png` (default value) or `webp`. @@ -1563,23 +1598,30 @@ private constructor( } /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` - * (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - * models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + * The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, + * arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example + * `1536x864`. Width and height must both be divisible by 16 and the requested aspect + * ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, + * and the maximum supported resolution is `3840x2160`. The requested size must also + * satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, + * `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is + * supported for models that allow automatic sizing. For `dall-e-2`, use one of + * `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, + * `1792x1024`, or `1024x1792`. */ - fun size(size: Size?) = size(MultipartField.of(size)) + fun size(size: String?) = size(MultipartField.of(size)) /** Alias for calling [Builder.size] with `size.orElse(null)`. */ - fun size(size: Optional) = size(size.getOrNull()) + fun size(size: Optional) = size(size.getOrNull()) /** * Sets [Builder.size] to an arbitrary multipart value. * - * You should usually call [Builder.size] with a well-typed [Size] value instead. This + * You should usually call [Builder.size] with a well-typed [String] value instead. This * method is primarily for setting the field to an undocumented or not yet supported * value. */ - fun size(size: MultipartField) = apply { this.size = size } + fun size(size: MultipartField) = apply { this.size = size } /** * A unique identifier representing your end-user, which can help OpenAI to monitor and @@ -1677,7 +1719,7 @@ private constructor( partialImages() quality().ifPresent { it.validate() } responseFormat().ifPresent { it.validate() } - size().ifPresent { it.validate() } + size() user() validated = true } @@ -1912,9 +1954,13 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This parameter is - * only supported for the GPT image models. Must be one of `transparent`, `opaque` or `auto` - * (default value). When `auto` is used, the model will automatically determine the best - * background for the image. + * only supported for GPT image models that support transparent backgrounds. Must be one of + * `transparent`, `opaque`, or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. Requests + * with `background` set to `transparent` will return an error for these models; use `opaque` or + * `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be set to * either `png` (default value) or `webp`. @@ -2649,169 +2695,6 @@ private constructor( override fun toString() = value.toString() } - /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), - * `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of - * `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. - */ - class Size @JsonCreator 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 { - - @JvmField val _256X256 = of("256x256") - - @JvmField val _512X512 = of("512x512") - - @JvmField val _1024X1024 = of("1024x1024") - - @JvmField val _1536X1024 = of("1536x1024") - - @JvmField val _1024X1536 = of("1024x1536") - - @JvmField val AUTO = of("auto") - - @JvmStatic fun of(value: String) = Size(JsonField.of(value)) - } - - /** An enum containing [Size]'s known values. */ - enum class Known { - _256X256, - _512X512, - _1024X1024, - _1536X1024, - _1024X1536, - AUTO, - } - - /** - * 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, - _1536X1024, - _1024X1536, - AUTO, - /** 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 - _512X512 -> Value._512X512 - _1024X1024 -> Value._1024X1024 - _1536X1024 -> Value._1536X1024 - _1024X1536 -> Value._1024X1536 - AUTO -> Value.AUTO - 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 - _512X512 -> Known._512X512 - _1024X1024 -> Known._1024X1024 - _1536X1024 -> Known._1536X1024 - _1024X1536 -> Known._1024X1536 - AUTO -> Known.AUTO - else -> throw OpenAIInvalidDataException("Unknown Size: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws OpenAIInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws OpenAIInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Size = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OpenAIInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Size && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt index e361795ef..854b241f8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageGenerateParams.kt @@ -42,9 +42,13 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This parameter is - * only supported for the GPT image models. Must be one of `transparent`, `opaque` or `auto` - * (default value). When `auto` is used, the model will automatically determine the best - * background for the image. + * only supported for GPT image models that support transparent backgrounds. Must be one of + * `transparent`, `opaque`, or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. Requests + * with `background` set to `transparent` will return an error for these models; use `opaque` or + * `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be set to * either `png` (default value) or `webp`. @@ -138,15 +142,20 @@ private constructor( fun responseFormat(): Optional = body.responseFormat() /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), - * `1024x1536` (portrait), or `auto` (default value) for the GPT image models, one of `256x256`, - * `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792` - * for `dall-e-3`. + * The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary + * resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height + * must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. + * Resolutions above `2560x1440` are experimental, and the maximum supported resolution is + * `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. + * The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image + * models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one + * of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, + * or `1024x1792`. * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun size(): Optional = body.size() + fun size(): Optional = body.size() /** * The style of the generated images. This parameter is only supported for `dall-e-3`. Must be @@ -245,7 +254,7 @@ private constructor( * * Unlike [size], this method doesn't throw if the JSON field has an unexpected type. */ - fun _size(): JsonField = body._size() + fun _size(): JsonField = body._size() /** * Returns the raw JSON value of [style]. @@ -328,9 +337,13 @@ private constructor( /** * Allows to set transparency for the background of the generated image(s). This parameter - * is only supported for the GPT image models. Must be one of `transparent`, `opaque` or - * `auto` (default value). When `auto` is used, the model will automatically determine the - * best background for the image. + * is only supported for GPT image models that support transparent backgrounds. Must be one + * of `transparent`, `opaque`, or `auto` (default value). When `auto` is used, the model + * will automatically determine the best background for the image. + * + * `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent backgrounds. + * Requests with `background` set to `transparent` will return an error for these models; + * use `opaque` or `auto` instead. * * If `transparent`, the output format needs to support transparency, so it should be set to * either `png` (default value) or `webp`. @@ -548,23 +561,28 @@ private constructor( } /** - * The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), - * `1024x1536` (portrait), or `auto` (default value) for the GPT image models, one of - * `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, - * or `1024x1792` for `dall-e-3`. + * The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, + * arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. + * Width and height must both be divisible by 16 and the requested aspect ratio must be + * between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum + * supported resolution is `3840x2160`. The requested size must also satisfy the model's + * current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and + * `1024x1536` are supported by the GPT image models; `auto` is supported for models that + * allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. + * For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. */ - fun size(size: Size?) = apply { body.size(size) } + fun size(size: String?) = apply { body.size(size) } /** Alias for calling [Builder.size] with `size.orElse(null)`. */ - fun size(size: Optional) = size(size.getOrNull()) + fun size(size: Optional) = size(size.getOrNull()) /** * Sets [Builder.size] to an arbitrary JSON value. * - * You should usually call [Builder.size] with a well-typed [Size] value instead. This + * You should usually call [Builder.size] with a well-typed [String] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun size(size: JsonField) = apply { body.size(size) } + fun size(size: JsonField) = apply { body.size(size) } /** * The style of the generated images. This parameter is only supported for `dall-e-3`. Must @@ -756,7 +774,7 @@ private constructor( private val partialImages: JsonField, private val quality: JsonField, private val responseFormat: JsonField, - private val size: JsonField, + private val size: JsonField, private val style: JsonField